changeset 6474:6aac9ad1f8a8

issue1370: FixWQCurveGenerator: second y axis for fix-w/q diagrams.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 27 Jun 2013 12:02:09 +0200
parents 70185cd48058
children b0b0ba6e7bb0
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Thu Jun 27 11:53:38 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Thu Jun 27 12:02:09 2013 +0200
@@ -216,6 +216,7 @@
             doWQOut(aaf.getData(context), aaf, doc, visible);
         }
         else if (name.equals(DISCHARGE_CURVE)) {
+        logger.debug("diso " + name);
             doDischargeOut(
                     (WINFOArtifact) aaf.getArtifact(),
                     aaf.getData(context),
@@ -375,7 +376,20 @@
                     0.0 ,  // start
                     maxQ); // end
 
-            addAxisSeries(series, YAXIS.W.idx, visible);
+            double gaugeDatum = getCurrentGaugeDatum();
+
+            double factor = (gaugeDatum == 0d) ? 1d : 100d;
+
+            if (gaugeDatum == 0d) {
+                addAxisSeries(series, YAXIS.W.idx, visible);
+            }
+            else {
+                // Use second axis at cm if at gauge.
+                for (int i = 0; i < series.getItemCount(); i++) {
+                    series.updateByIndex(i, new Double(factor*(series.getY(i).doubleValue()-gaugeDatum)));
+                }
+                addAxisSeries(series, YAXIS.WCm.idx, visible);
+            }
         }
         else {
             logger.warn("doWQCurveOut: maxQ <= 0");

http://dive4elements.wald.intevation.org