changeset 5103:15e856a64cdd

Partly fix flys/issue1142: Include specified W values at gauge for fix.real.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 26 Feb 2013 11:49:46 +0100
parents baf51f820838
children 5f70c73b11ed
files flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]),

http://dive4elements.wald.intevation.org