[Dive4elements-commits] [PATCH 9 of 9] issue1370: Add discharge q data to second axis

Wald Commits scm-commit at wald.intevation.org
Wed Jun 26 12:32:16 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372243227 -7200
# Node ID e32b166c881bb691529e8fb14a1ed769be5c5f1d
# Parent  39aba54a4c15aa3bfd9d286f995a1db647979ae3
issue1370: Add discharge q data to second axis.

diff -r 39aba54a4c15 -r e32b166c881b artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:38:54 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:40:27 2013 +0200
@@ -167,7 +167,7 @@
         //XXX DEAD CODE // Facet facet = artifactFacet.getFacet();
 
         if (name.equals(COMPUTED_DISCHARGE_Q)) {
-            doQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
+            doDischargeQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
         }
         else if (name.equals(STATIC_WQ)) {
             doWQOut(artifactFacet.getData(context), artifactFacet, attr, visible);
@@ -242,6 +242,38 @@
 
 
     /**
+     * Add discharge Q-Series to plot, scale if at gauge.
+     * @param wqkms actual data
+     * @param theme theme to use.
+     */
+    protected void doDischargeQOut(
+        WQKms            wqkms,
+        ArtifactAndFacet aaf,
+        Document         theme,
+        boolean          visible
+    ) {
+        logger.debug("ComputedDischargeCurveGenerator: doDischargeQOut");
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+
+        int subtractPNP = atGaugeSubtractPNP();
+
+        if (subtractPNP == 0) {
+            StyledSeriesBuilder.addPointsQW(series, wqkms);
+            addAxisSeries(series, YAXIS.W.idx, visible);
+        }
+        else {
+            XYSeries series2 = new StyledXYSeries(aaf.getFacetDescription(), theme);
+            StyledSeriesBuilder.addPointsQW(series2, wqkms);
+            addAxisSeries(series2, YAXIS.W.idx, false);
+
+            // Use second axis...
+            StyledSeriesBuilder.addPointsQW(series, wqkms, -subtractPNP, 100d);
+            addAxisSeries(series, YAXIS.WCm.idx, visible);
+        }
+    }
+
+
+    /**
      * Add Q-Series to plot.
      * @param wqkms actual data
      * @param theme theme to use.


More information about the Dive4elements-commits mailing list