changeset 6883:3df41681f326

issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 21 Aug 2013 11:11:56 +0200
parents a77dca301419
children a6796b25140e
files artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Aug 21 11:11:22 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java	Wed Aug 21 11:11:56 2013 +0200
@@ -211,6 +211,12 @@
                 artifactFacet,
                 theme, visible, YAXIS.W.idx);
         }
+        else if (STATIC_WQ.equals(name)) {
+            doWQOut(artifactFacet.getData(context),
+                artifactFacet,
+                theme,
+                visible);
+        }
         else {
            logger.warn("DischargeCurveGenerator.doOut: Unknown facet name: " + name);
            return;
@@ -253,5 +259,51 @@
 
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
+
+    /**
+     * Add W/Q-Series to plot.
+     * @param wqkms actual data
+     * @param theme theme to use.
+     */
+    protected void doQOut(
+        Object           wqkms,
+        ArtifactAndFacet aaf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("DischargeCurveGenerator: doQOut (add W/Q data).");
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPointsQW(series, (WQKms) wqkms);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+    /**
+     * Add WQ Data to plot.
+     * @param wq data as double[][]
+     */
+    protected void doWQOut(
+        Object           wq,
+        ArtifactAndFacet aaf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("DischargeCurveGenerator: doWQOut");
+        double [][] data = (double [][]) wq;
+
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+
+        double translate = getCurrentGaugeDatum();
+        if (translate != 0d) {
+            StyledSeriesBuilder.addPointsQW(series, data, -translate, 100d);
+            addAxisSeries(series, YAXIS.W.idx, visible);
+        }
+        else {
+            StyledSeriesBuilder.addPoints(series, data, true);
+            addAxisSeries(series, YAXIS.W.idx, visible);
+        }
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org