[Dive4elements-commits] [PATCH 2 of 2] Partly fix flys/issue1142: Include specified W values at gauge for fix.real

Wald Commits scm-commit at wald.intevation.org
Tue Feb 26 11:43:10 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1361875786 -3600
# Node ID 15e856a64cddc6f53d3ea3b844b5b3f1f2eae107
# Parent  baf51f820838f296f3bdad5fb59cc4c5393280c2
Partly fix flys/issue1142: Include specified W values at gauge for fix.real.

diff -r baf51f820838 -r 15e856a64cdd flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Tue Feb 26 11:48:25 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Tue Feb 26 11:49:46 2013 +0100
@@ -32,10 +32,13 @@
 
 import de.intevation.flys.model.Gauge;
 
+import de.intevation.flys.artifacts.access.FixRealizingAccess;
 import de.intevation.flys.artifacts.access.RangeAccess;
+import de.intevation.flys.artifacts.FixationArtifact;
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.Segment;
 import de.intevation.flys.artifacts.model.WQCKms;
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.WKmsJRDataSource;
@@ -493,16 +496,31 @@
         long startTime = System.currentTimeMillis();
 
         String colDesc = desc;
+        List<Segment> segments = null;
         if (flys instanceof WINFOArtifact) {
             if (wqkms != null && wqkms.getRawValue() != null) {
                 WINFOArtifact winfo = (WINFOArtifact) flys;
                 colDesc = FLYSUtils.getNamedMainValue(winfo, wqkms.getRawValue());
             }
         }
+        else if (flys instanceof FixationArtifact) {
+            // Get W/Q input per gauge for this case.
+            FixRealizingAccess fixAccess = new FixRealizingAccess(flys, getCallContext());
+            segments = fixAccess.getSegments();
+        }
 
         for (int i = 0; i < size; i ++) {
             result = wqkms.get(i, result);
 
+            // Check if there has been W input per Gauge and use it.
+            if (segments != null) {
+                for (Segment segment: segments) {
+                    if (segment.inside(result[2])) {
+                        colDesc = "" + segment.getValues()[0];
+                    }
+                }
+            }
+
             if (atGauge) {
                 writer.writeNext(new String[] {
                     kmf.format(result[2]),


More information about the Dive4elements-commits mailing list