changeset 7260:0b32f8980fed

issue1490: Fix text annotations of latest points.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 08 Oct 2013 12:07:18 +0200
parents a36e26abcf54
children a56fe3bc6700
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);

http://dive4elements.wald.intevation.org