changeset 1915:6b7557ffe2f8

Handle STATIC_WQ_ANNOTATION type facets in Computed Discharge Curve Diagrams. flys-artifacts/trunk@3275 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Nov 2011 15:49:35 +0000
parents e20a47be6207
children efff4305dc05
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java
diffstat 2 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Nov 16 15:48:01 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Nov 16 15:49:35 2011 +0000
@@ -1,3 +1,9 @@
+2011-11-16  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java:
+	  Handle STATIC_WQ_ANNOTATION type facets, build and add annotations
+	  for these.
+
 2011-11-16  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Wed Nov 16 15:48:01 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java	Wed Nov 16 15:49:35 2011 +0000
@@ -1,9 +1,14 @@
 package de.intevation.flys.exports;
 
+import java.util.List;
+import java.util.ArrayList;
+
 import org.apache.log4j.Logger;
 
 import org.w3c.dom.Document;
 
+import org.jfree.chart.annotations.XYTextAnnotation;
+
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
@@ -17,6 +22,7 @@
 import de.intevation.flys.artifacts.model.WQKms;
 
 import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StickyAxisAnnotation;
 
 
 /**
@@ -104,6 +110,9 @@
         else if (name.equals(STATIC_WQ)) {
             doWQOut(f.getData(artifact, context), facet, attr, visible);
         }
+        else if (name.equals(STATIC_WQ_ANNOTATIONS)) {
+            doWQAnnotations(f.getData(artifact, context), facet, attr, visible);
+        }
         else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)
                 || name.equals(MAINVALUES_Q)
                 || name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)
@@ -146,13 +155,35 @@
         Document theme,
         boolean  visible
     ) {
-        int size = wqkms.size();
-
-
         XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
         StyledSeriesBuilder.addPointsQW(series, wqkms);
 
         addFirstAxisSeries(series, visible);
     }
+
+
+    /**
+     * Add WQ-Annotations to plot.
+     * @param wqkms actual data
+     * @param theme theme to use.
+     */
+    protected void doWQAnnotations(
+        Object   wqkms,
+        Facet    facet,
+        Document theme,
+        boolean  visible
+    ) {
+        List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
+        double [][] data = (double [][]) wqkms;
+        for (int i = 0; i< data[0].length; i++) {
+            xy.add(new StickyAxisAnnotation(facet.getDescription(),
+                (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS));
+            xy.add(new StickyAxisAnnotation(facet.getDescription(),
+                (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+        }
+
+        doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
+            facet, theme, visible);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org