[PATCH 6 of 7] issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data

Wald Commits scm-commit at wald.intevation.org
Wed Aug 21 11:03:06 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1377076316 -7200
# Node ID 3df41681f326dc60dcdf1cabfb0b6eaa6ffd702c
# Parent  a77dca301419035a9c7ea6121a9e8e69fff4448a
issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.

diff -r a77dca301419 -r 3df41681f326 artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
--- 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 :


More information about the Dive4elements-commits mailing list