[PATCH 45 of 45] Merge of MINFO improvement developments
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 10 17:06:13 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1426003302 -3600
# Node ID a8048aac8831d92b37ba3ab39a7738cde6ca0f18
# Parent c16d04f2c5bcb2f9223a618ec44129ee6fe5ab36
# Parent 4dd6d89ce95eee55403e2bb9b1872c693bca0a11
Merge of MINFO improvement developments
diff -r c16d04f2c5bc -r a8048aac8831 artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Fri Mar 06 12:26:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Tue Mar 10 17:01:42 2015 +0100
@@ -301,7 +301,13 @@
protected void appendMapInformation(Element parent, ElementCreator c) {
- String mE = GeometryUtils.jtsBoundsToOLBounds(this.maxExtent);
+ String mE;
+ if (this.maxExtent != null) {
+ mE = GeometryUtils.jtsBoundsToOLBounds(this.maxExtent);
+ } else {
+ log.error("Layer without extent. Probably no geometry at all.");
+ mE = "0 0 0 0";
+ }
Element maxExtent = c.create("maxExtent");
maxExtent.setTextContent(mE);
diff -r c16d04f2c5bc -r a8048aac8831 artifacts/src/main/java/org/dive4elements/river/jfree/StableXYDifferenceRenderer.java
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/StableXYDifferenceRenderer.java Fri Mar 06 12:26:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StableXYDifferenceRenderer.java Tue Mar 10 17:01:42 2015 +0100
@@ -1640,7 +1640,7 @@
Object[] l_xValues = x_xValues.toArray();
Object[] l_yValues = x_yValues.toArray();
- double area = calculateArea(l_xValues, l_yValues)/2d;
+ double area = calculateArea(l_xValues, l_yValues);
if (x_positive) positiveArea += area;
else negativeArea += area;
updateCentroid(l_xValues, l_yValues);
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue Mar 10 17:01:42 2015 +0100
@@ -1202,6 +1202,8 @@
String editpoints();
+ String manual_date_points_y();
+
// Manual WaterLine (WSP) Editor.
String addWSPButton();
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Mar 10 17:01:42 2015 +0100
@@ -658,6 +658,7 @@
addWSPButton = Add Manual LS
addWSP = Add Manual LS
selection = Selection
+manual_date_points_y = Y ([m\u00b3/s]/[cm])
# Reference Curves
reference_curve = Reference Curve
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Mar 10 17:01:42 2015 +0100
@@ -658,6 +658,7 @@
addWSP = Neues WSP Thema anlegen
addWSPButton = WSP Thema
selection = Auswahl
+manual_date_points_y = Y ([m\u00b3/s]/[cm])
# Reference Curves
reference_curve = Bezugslinie
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Tue Mar 10 17:01:42 2015 +0100
@@ -633,6 +633,7 @@
addWSP = Add Manual LS
addWSPButton = Add Manual LS
selection = Selection
+manual_date_points_y = Y ([m\u00b3/s]/[cm])
# Reference Curves
reference_curve = Reference Curve
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java Tue Mar 10 17:01:42 2015 +0100
@@ -62,8 +62,7 @@
/** The ModuleService used to retrieve the available modules of a user.*/
protected ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
- private List<String> fixRivers;
- private List<String> minfoRivers;
+ private Map<String, List<String> > modulesRiverMap;
protected Map<String, HLayout> rivers;
/**
@@ -71,9 +70,7 @@
*/
public ModuleSelection() {
rivers = null;
- //TODO: put all the rivers into a config file, or something.
- fixRivers = new ArrayList<String>();
- minfoRivers = new ArrayList<String>();
+ modulesRiverMap = new LinkedHashMap<String, List<String> >();
readModules();
}
@@ -123,6 +120,29 @@
});
}
+ private void checkRivers(String selected) {
+ if (selected == null) {
+ selected = getSelectedModule();
+ }
+ if (rivers != null && !rivers.isEmpty() && modules != null && selected != null) {
+ List<String> allowedRivers = modulesRiverMap.get(selected);
+ if ( allowedRivers == null ) {
+ GWT.log("No configured rivers for module: " + selected);
+ }
+ for (Map.Entry<String, HLayout> s: rivers.entrySet()) {
+ if ( allowedRivers == null ) {
+ s.getValue().hide();
+ continue;
+ }
+ if (!allowedRivers.contains(s.getKey())) {
+ s.getValue().hide();
+ } else {
+ s.getValue().show();
+ }
+ }
+ }
+ }
+
private void setModules() {
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
@@ -135,21 +155,13 @@
radio.setDefaultValue(module.getName());
}
}
- if (module.getName().equals("fixanalysis")) {
- for (String river: module.getRivers()) {
- fixRivers.add(river);
- }
- }
- if (module.getName().equals("minfo")) {
- for (String river: module.getRivers()) {
- minfoRivers.add(river);
- }
- }
+ modulesRiverMap.put(module.getName(), module.getRivers());
}
}
if (radio != null) {
radio.setValueMap(values);
}
+ checkRivers(null);
}
/**
@@ -167,20 +179,7 @@
radio.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
- String selected = (String)event.getValue();
- if (!rivers.isEmpty()) {
- for (Map.Entry<String, HLayout> s: rivers.entrySet()) {
- if (selected.equals("minfo") && !minfoRivers.contains(s.getKey())) {
- s.getValue().hide();
- }
- else if (selected.equals("fixanalysis") && !fixRivers.contains(s.getKey())) {
- s.getValue().hide();
- }
- else {
- s.getValue().show();
- }
- }
- }
+ checkRivers((String)event.getValue());
}
});
@@ -232,6 +231,9 @@
}-*/;
private static String getSelectedModule() {
+ if (radio == null) {
+ return null;
+ }
return radio.getValueAsString();
}
}
diff -r c16d04f2c5bc -r a8048aac8831 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualDatePointsEditor.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualDatePointsEditor.java Fri Mar 06 12:26:12 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualDatePointsEditor.java Tue Mar 10 17:01:42 2015 +0100
@@ -180,9 +180,7 @@
xAxis = name.getValue();
}
else if (yAxis.equals("Y")) {
- StringProperty name =
- (StringProperty)pg.getPropertyByName("label");
- yAxis = name.getValue();
+ yAxis = MSG.manual_date_points_y();
}
}
}
More information about the Dive4Elements-commits
mailing list