[PATCH 2 of 2] issue1490: Fix text annotations of latest points

Wald Commits scm-commit at wald.intevation.org
Tue Oct 8 11:57:58 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381226838 -7200
# Node ID 0b32f8980fed666fe8f915021eb04e8613112ff5
# Parent  a36e26abcf545ea265911a37a1c6a15c2677d734
issue1490: Fix text annotations of latest points.

diff -r a36e26abcf54 -r 0b32f8980fed artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Tue Oct 08 11:49:28 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Tue Oct 08 12:07:18 2013 +0200
@@ -282,15 +282,22 @@
             DateFormat dateFormat = DateFormat.getDateInstance(
                     DateFormat.SHORT);
 
-            series.add(qwd.getQ(), qwd.getW());
+            double gaugeDatum = getCurrentGaugeDatum();
+            double factor = (gaugeDatum == 0d) ? 1d : 100d;
 
+            series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum));
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                     dateFormat.format(qwd.getDate()),
                     qwd.getQ(),
-                    qwd.getW());
+                    factor*(qwd.getW()-gaugeDatum));
             textAnnos.add(anno);
 
-            addAxisSeries(series, YAXIS.W.idx, visible);
+            if (gaugeDatum == 0d) {
+                addAxisSeries(series, YAXIS.W.idx, visible);
+            }
+            else {
+                addAxisSeries(series, YAXIS.WCm.idx, visible);
+            }
             if(visible && doc.parseShowPointLabel()) {
                 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
                 flysAnno.setTextAnnotations(textAnnos);
@@ -356,6 +363,8 @@
             return;
         }
         double[] kms = wqkms.getKms();
+        double gaugeDatum = getCurrentGaugeDatum();
+        double factor = (gaugeDatum == 0d) ? 1d : 100d;
         for (int i = 0 ; i< kms.length; i++) {
             if (Math.abs(kms[i] - ckm) <= EPSILON) {
                 series.add(wqkms.getQ(i), wqkms.getW(i), false);
@@ -365,7 +374,7 @@
                     XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                             title,
                             wqkms.getQ(i),
-                            wqkms.getW(i));
+                            factor*(wqkms.getW(i)-gaugeDatum));
                     textAnnos.add(anno);
                     RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme);
                     flysAnno.setTextAnnotations(textAnnos);


More information about the Dive4elements-commits mailing list