[PATCH 8 of 9] issue1512: Adjusted Q and WOutProcessors to handle data

Wald Commits scm-commit at wald.intevation.org
Fri Oct 11 12:05:20 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381486372 -7200
# Node ID 015e12aac2dcd4d203720aff6701ddda9ea39181
# Parent  01e103ad884524c6e855dea05e1b19209d8d8146
issue1512: Adjusted Q and WOutProcessors to handle data
coming from FlowVelocityMeasurementArtifacts.

diff -r 01e103ad8845 -r 015e12aac2dc artifacts/src/main/java/org/dive4elements/river/exports/process/QOutProcessor.java
--- 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);
diff -r 01e103ad8845 -r 015e12aac2dc artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java
--- 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;


More information about the Dive4elements-commits mailing list