changeset 7542:db780379ea82

issue1585: Part 2/2 of patch from Sascha Teichmann to define datapoint shapes. Minor fix by me.
author sascha.teichmann@intevation.de
date Fri, 08 Nov 2013 11:58:55 +0100
parents d20a26e96ef1
children a338ad099c7a
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
diffstat 1 files changed, 41 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Fri Nov 08 11:57:37 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Fri Nov 08 11:58:55 2013 +0100
@@ -58,6 +58,7 @@
 import org.dive4elements.river.model.River;
 import org.dive4elements.river.themes.ThemeDocument;
 import org.dive4elements.river.utils.RiverUtils;
+import org.dive4elements.river.java2d.ShapeUtils;
 
 /**
  * Generator for WQ fixing charts.
@@ -289,12 +290,6 @@
             return;
         }
 
-        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
-        List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
-
-        DateFormat dateFormat = DateFormat.getDateInstance(
-            DateFormat.SHORT);
-
         double gaugeDatum = getCurrentGaugeDatum();
         boolean atGauge = gaugeDatum != 0d;
 
@@ -302,17 +297,29 @@
 
         double w = factor*(qwd.getW()-gaugeDatum);
 
-        series.add(qwd.getQ(), w);
+        XYSeries series = new StyledXYSeries(
+            aaf.getFacetDescription(),
+            doc,
+            qwd.getInterpolated()
+                ? ShapeUtils.INTERPOLATED_SHAPE
+                : ShapeUtils.MEASURED_SHAPE);
 
-        XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-            dateFormat.format(qwd.getDate()),
-            qwd.getQ(),
-            w);
-        textAnnos.add(anno);
+        series.add(qwd.getQ(), w);
 
         addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
 
         if (visible && doc.parseShowPointLabel()) {
+
+            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+
+            DateFormat dateFormat = DateFormat.getDateInstance(
+                DateFormat.SHORT);
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+                dateFormat.format(qwd.getDate()),
+                qwd.getQ(),
+                w);
+            textAnnos.add(anno);
+
             RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
             flysAnno.setTextAnnotations(textAnnos);
             addAnnotations(flysAnno);
@@ -330,34 +337,39 @@
             return;
         }
 
-        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, true, doc);
-        List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
-
-        DateFormat dateFormat = DateFormat.getDateInstance(
-                DateFormat.SHORT);
+        XYSeries series = new StyledXYSeries(
+            aaf.getFacetDescription(),
+            false, true, doc,
+            qwd.getInterpolated()
+                ? ShapeUtils.INTERPOLATED_SHAPE
+                : ShapeUtils.MEASURED_SHAPE);
 
         double gaugeDatum = getCurrentGaugeDatum();
-        double factor = (gaugeDatum == 0d) ? 1d : 100d;
 
-        series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false);
-        XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+        boolean atGauge = gaugeDatum != 0d;
+
+        double factor = atGauge ? 100d : 1d;
+        double w = factor*(qwd.getW()-gaugeDatum);
+
+        series.add(qwd.getQ(), w, false);
+
+        if (visible && doc.parseShowPointLabel()) {
+            DateFormat dateFormat = DateFormat.getDateInstance(
+                DateFormat.SHORT);
+
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                 dateFormat.format(qwd.getDate()),
                 qwd.getQ(),
-                factor*(qwd.getW()-gaugeDatum));
-        textAnnos.add(anno);
+                w);
 
-        if(visible && doc.parseShowPointLabel()) {
+            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+            textAnnos.add(anno);
             RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
             flysAnno.setTextAnnotations(textAnnos);
             addAnnotations(flysAnno);
         }
 
-        if (gaugeDatum == 0d) {
-            addAxisSeries(series, YAXIS.W.idx, visible);
-        }
-        else {
-            addAxisSeries(series, YAXIS.WCm.idx, visible);
-        }
+        addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
     }
 
 

http://dive4elements.wald.intevation.org