changeset 5371:92c07d5c433c

MainValuesArtifact: For hist. W/Q diagram mainvalues, get location from gauge.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 22 Mar 2013 09:09:52 +0100
parents 2a5d7f9f268f
children ae3625b89cfd
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Fri Mar 22 09:08:04 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Fri Mar 22 09:09:52 2013 +0100
@@ -204,6 +204,20 @@
             logger.error("No location for mainvalues given.");
         }
         importData(winfo, "river");
+        // In the case of DischargeWQCurves, there are no locations, but a gauge.
+        if (getDataAsString("ld_locations") == null) {
+            // TODO its a tad difficult to remodel Range/Gauge-Access to
+            // do this.
+            String refGaugeID = winfo.getDataAsString("reference_gauge");
+            if (refGaugeID != null) {
+                Gauge g = Gauge.getGaugeByOfficialNumber(Integer.parseInt(refGaugeID));
+                addData("ld_locations", new DefaultStateData("ld_locations", null, null,
+                    String.valueOf(g.getStation())));
+            }
+            else {
+                logger.error("MainValuesArtifact: No location/gauge.");
+            }
+        }
     }
 
 

http://dive4elements.wald.intevation.org