[PATCH] vegZone no-overlap warning

Wald Commits scm-commit at wald.intevation.org
Thu Jul 26 11:08:18 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1532596091 -7200
# Node ID 819dbd0736247887ae13580b237887dd8a6e6493
# Parent  9a9f076d5716c0cc69711f075cbf9df125f036f3
vegZone no-overlap warning

diff -r 9a9f076d5716 -r 819dbd073624 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Wed Jul 25 19:29:25 2018 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Thu Jul 26 11:08:11 2018 +0200
@@ -3676,12 +3676,18 @@
             <dc:variable name="vegzonedata" expr="dc:data_from_artifact($a_gid,'vegzones')" />
             <dc:variable name="vegzonedatalabel" expr="dc:get('ld_from'))" />
             <dc:variable name="label_temp" type="string" expr="dc:coalesce($collection_name, dc:toString($a_gid))" />
+            <dc:variable name="fromkm" type="number" expr="dc:fromValue(dc:get('ld_mode'),
+                             dc:get('ld_locations'), dc:get('ld_from'))" />
+            <dc:variable name="tokm" type="number" expr="dc:fromValue(dc:get('ld_mode'),
+                               dc:get('ld_locations'), dc:get('ld_to'))" />
             <dc:element name="${facet_name}">
               <dc:attribute name="factory" value="dummy" />
               <dc:attribute name="target_out" value="${out}" />
               <dc:attribute name="description" value="${label_temp}" />
               <!-- veg zones string as attribute -->
               <dc:attribute name="data" value="${vegzonedata}" />
+              <dc:attribute name="from_km" value="${fromkm}" />
+              <dc:attribute name="to_km" value="${tokm}" />
             </dc:element>
           </dc:for-each>
         </dc:if>
diff -r 9a9f076d5716 -r 819dbd073624 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Wed Jul 25 19:29:25 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Thu Jul 26 11:08:11 2018 +0200
@@ -12,6 +12,7 @@
 
 import org.dive4elements.river.client.client.ui.DatacageWidget;
 import org.dive4elements.river.client.client.ui.DatacageWidgetData;
+import org.dive4elements.river.client.shared.model.ArtifactDescription;
 import org.dive4elements.river.client.shared.model.DataList;
 import org.dive4elements.river.client.shared.model.User;
 
@@ -27,8 +28,24 @@
 public class VegetationzonesTablePanel extends AbstractVegZonesTablePanel {
 
     private static final long serialVersionUID = 1L;
+
+    private final static Double DELTA = 0.0000001;
+
     private final User user;
 
+    // private double lowerKm = 0.0;
+    // private double upperKm = 0.0;
+    // private final Double vegZoneFrom = null;
+    // private final Double vegZoneTo = null;
+    // private final Label kmOverlapLabel = new Label();
+
+    // TODO: in der LV steht, dass eine Warnung herausgegeben werden soll, wenn der kmBereich der ausgewählten
+    // Vegetationszone NICHT überlappt.
+    // Derzeit werden durch den XPathQuery (siehe meta-data.xml usw) solche Vegetationszonen ohnehin gefiltert (nicht
+    // angezeigt) - so wie es bisher überall standard ist, sodass
+    // die Warnfunktion obsolet ist. Sollte der AG auf die LV bestehen, müsste der Query angepasst werden und hier alles
+    // wieder einkommentiert werden
+
     public VegetationzonesTablePanel(final User user) {
         super();
         this.user = user;
@@ -37,6 +54,8 @@
     @Override
     public void createWidget(final Layout root, final DataList data) {
         createTable(root, data, "420", false);
+        // this.kmOverlapLabel.getElement().getStyle().setColor("red");
+        // root.addMember(this.kmOverlapLabel);
     }
 
     @Override
@@ -45,7 +64,23 @@
         final DatacageWidgetData data = new DatacageWidgetData(this.artifact, this.user, "uinfo.inundation_duration.vegZoneSelect", "load-system:true", false);
 
         final DatacageWidget datacage = new DatacageWidget(data);
+        final ArtifactDescription artifact = this.artifact.getArtifactDescription();
 
+        // for (final DataList item : artifact.getOldData()) {
+        // if (item.getState().equals("state.uinfo.inundationduration.distance_only")) {
+        // for (final Data fromTo : item.getAll()) {
+        // if (fromTo.getLabel().equals("ld_from")) {
+        // this.lowerKm = Double.valueOf(fromTo.getStringValue());
+        // } else if (fromTo.getLabel().equals("ld_to")) {
+        // this.upperKm = Double.valueOf(fromTo.getStringValue());
+        // }
+        //
+        // }
+        // }
+        // }
+        // final double lowerKmTmp = this.lowerKm < this.upperKm ? this.lowerKm : this.upperKm;
+        // this.upperKm = this.upperKm > this.lowerKm ? this.upperKm : this.lowerKm;
+        // this.lowerKm = lowerKmTmp;
         final Button plusBtn = new Button(this.MSG.uinfo_inundation_duration_set_vegetation_zone());
         plusBtn.setAutoFit(true);
         plusBtn.addClickHandler(new ClickHandler() {
@@ -57,8 +92,18 @@
                     return;
                 }
                 final String data = selection.get(0).getAttribute("data");
+                // final String vegZoneFromStr = selection.get(0).getAttribute("from_km");
+                // final String vegZoneToStr = selection.get(0).getAttribute("to_km");
+                // if (vegZoneFromStr != null && vegZoneToStr != null) {
+                // VegetationzonesTablePanel.this.vegZoneFrom = Double.valueOf(vegZoneFromStr);
+                // VegetationzonesTablePanel.this.vegZoneTo = Double.valueOf(vegZoneToStr);
+                // } else {
+                // VegetationzonesTablePanel.this.vegZoneFrom = null;
+                // VegetationzonesTablePanel.this.vegZoneTo = null;
+                // }
                 createTableFromDataStr(data);
                 updateValidationMsgLabel();
+                // updateKmOverlapValidationLabel();
             }
         });
 
@@ -68,4 +113,17 @@
 
         return helperLayout;
     }
+
+    // private void updateKmOverlapValidationLabel() {
+    // this.kmOverlapLabel.setText("MÖP");
+    // if (this.vegZoneFrom != null && this.vegZoneTo != null) { // standardvegetationstabelle prüfung deaktiviert, da keine
+    // km-range angegeben ist
+    // if (!(this.vegZoneFrom > this.lowerKm - DELTA && this.vegZoneFrom < this.upperKm + DELTA || //
+    // this.vegZoneTo > this.lowerKm - DELTA && this.vegZoneTo < this.upperKm + DELTA)) {
+    //
+    // this.kmOverlapLabel.setText("Warnung: Der Km-Bereich der gewählten Vegetationstabelle überlappt nicht mit dem hier
+    // angegebenen Km-Bereich.");
+    // }
+    // }
+    // }
 }


More information about the Dive4Elements-commits mailing list