changeset 7289:015e12aac2dc

issue1512: Adjusted Q and WOutProcessors to handle data coming from FlowVelocityMeasurementArtifacts.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 11 Oct 2013 12:12:52 +0200
parents 01e103ad8845
children 1843023549df
files artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
diffstat 2 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java	Fri Oct 11 11:44:21 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java	Fri Oct 11 12:12:52 2013 +0200
@@ -16,6 +16,7 @@
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.WQKms;
 import org.dive4elements.river.artifacts.model.FlowVelocityData;
+import org.dive4elements.river.model.FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue;
 
 import org.dive4elements.river.exports.StyledSeriesBuilder;
 import org.dive4elements.river.exports.XYChartGenerator;
@@ -52,8 +53,17 @@
         String facetName = bundle.getFacetName();
 
         if (facetName.equals(FacetTypes.FLOW_VELOCITY_DISCHARGE)) {
-            FlowVelocityData fData = (FlowVelocityData) data;
-            StyledSeriesBuilder.addPoints(series, fData.getQPoints(), true);
+            if (data instanceof FlowVelocityData) {
+                FlowVelocityData fData = (FlowVelocityData) data;
+                StyledSeriesBuilder.addPoints(series, fData.getQPoints(), true);
+            }
+            else {
+                FastFlowVelocityMeasurementValue fData =
+                    (FastFlowVelocityMeasurementValue) data;
+                double[][] points = new double[][] {{fData.getStation()},{fData.getQ()}};
+                StyledSeriesBuilder.addPoints(series, points, true);
+                generator.addAxisSeries(series, axisName, visible);
+            }
         } else {
             WQKms wqkms = (WQKms) data;
             StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Fri Oct 11 11:44:21 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java	Fri Oct 11 12:12:52 2013 +0200
@@ -23,6 +23,7 @@
 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
+import org.dive4elements.river.model.FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue;
 import org.dive4elements.river.utils.RiverUtils;
 
 /**
@@ -46,15 +47,27 @@
             DiagramGenerator generator,
             ArtifactAndFacet bundle,
             ThemeDocument    theme,
-            boolean          visible) {
+            boolean          visible
+    ) {
+        logger.debug("Processing facet: " + bundle.getFacetName());
         CallContext context = generator.getCallContext();
         Object data = bundle.getData(context);
-        WKms wkms = (WKms) data;
-
-        logger.debug("Processing facet: " + bundle.getFacetName());
 
         XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
 
+        // Handle non WKms data.
+        if (bundle.getFacetName().equals(FacetTypes.FLOW_VELOCITY_WATERLEVEL)) {
+            FastFlowVelocityMeasurementValue fData =
+                (FastFlowVelocityMeasurementValue) data;
+            double[][] points = new double[][] {{fData.getStation()},{fData.getW()}};
+            StyledSeriesBuilder.addPoints(series, points, true);
+            generator.addAxisSeries(series, axisName, visible);
+            return;
+        }
+
+        // Handle WKms data.
+        WKms wkms = (WKms) data;
+
         if (bundle.getFacetName().equals(FacetTypes.DISCHARGE_LONGITUDINAL_C)) {
             // Add corrected values
             WQCKms wqckms = (WQCKms) data;
@@ -162,6 +175,7 @@
                 || facetType.equals(FacetTypes.HEIGHTMARKS_POINTS)
                 || facetType.equals(FacetTypes.STATIC_WQKMS)
                 || facetType.equals(FacetTypes.STATIC_WQKMS_W)
+                || facetType.equals(FacetTypes.FLOW_VELOCITY_WATERLEVEL)
                 || facetType.equals(FacetTypes.DISCHARGE_LONGITUDINAL_W)
                 || facetType.equals(FacetTypes.DISCHARGE_LONGITUDINAL_C)) {
             return true;

http://dive4elements.wald.intevation.org