changeset 7113:099f9faf5bf9 generator-refactoring

Process corrected WQkms (WQCKms) also in the WOutProcessor
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 24 Sep 2013 11:42:04 +0200
parents 7b88b87958ac
children e3333da25634
files artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Tue Sep 24 11:40:43 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Tue Sep 24 11:42:04 2013 +0200
@@ -16,6 +16,7 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.WKms;
+import org.dive4elements.river.artifacts.model.WQCKms;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
 import org.dive4elements.river.exports.XYChartGenerator;
 import org.dive4elements.river.exports.DiagramGenerator;
@@ -47,13 +48,23 @@
             ThemeDocument    theme,
             boolean          visible) {
         CallContext context = generator.getCallContext();
-        WKms wkms = (WKms) bundle.getData(context);
+        Object data = bundle.getData(context);
+        WKms wkms = (WKms) data;
 
-        logger.debug("doOut");
+        logger.debug("Processing facet: " + bundle.getFacetName());
 
         XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
 
-        StyledSeriesBuilder.addPoints(series, wkms);
+        if (bundle.getFacetName().equals(FacetTypes.DISCHARGE_LONGITUDINAL_C)) {
+            // Add corrected values
+            WQCKms wqckms = (WQCKms) data;
+            int size = wqckms.size();
+            for (int i = 0; i < size; i++) {
+                series.add(wqckms.getKm(i), wqckms.getC(i), false);
+            }
+        } else {
+            StyledSeriesBuilder.addPoints(series, wkms);
+        }
         generator.addAxisSeries(series, axisName, visible);
 
         // If a "band around the curve shall be drawn, add according area.
@@ -75,9 +86,11 @@
 
         if (bundle.getFacetName().equals(FacetTypes.LONGITUDINAL_W) ||
             bundle.getFacetName().equals(FacetTypes.DISCHARGE_LONGITUDINAL_W) ||
-            bundle.getFacetName().equals(FacetTypes.STATIC_WQKMS_W)) {
+            bundle.getFacetName().equals(FacetTypes.STATIC_WQKMS_W) ||
+            bundle.getFacetName().equals(FacetTypes.DISCHARGE_LONGITUDINAL_C)) {
             /* Only use W values to check if the diagram should be inverted
              * see flys/issue1290 for details */
+            logger.debug("Check for RTL data: "+ wkms.guessRTLData());
             generator.setInverted(wkms.guessRTLData());
         }
     }

http://dive4elements.wald.intevation.org