changeset 4282:8b4988815974

Added marker for Ws and Qs in Historical Discharge WQ charts. Therefore, the XYChartGenerator got two new methods addDomainMarker(Marker, boolean) and addValueMarker(Marker, boolean). The boolean parameters determine, if the marker should be visible or not. This is analogous to addAxisSeries(XYSeries, int, boolean).
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 29 Oct 2012 05:59:27 +0100
parents 7b6c31390427
children 7140bb0f92b0
files flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 2 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java	Mon Oct 29 05:56:36 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java	Mon Oct 29 05:59:27 2012 +0100
@@ -10,6 +10,7 @@
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.Timerange;
 import de.intevation.flys.artifacts.model.WQKms;
+import de.intevation.flys.jfree.StyledValueMarker;
 import de.intevation.flys.jfree.StyledXYSeries;
 import de.intevation.flys.utils.FLYSUtils;
 
@@ -128,16 +129,14 @@
 
     protected void doHistoricalDischargeOutQ(FLYSArtifact artifact,
         Object data, String desc, Document theme, boolean visible) {
-        logger.debug("doHistoricalDischargeOutQ(): description = " + desc);
-
-        // addAxisDataset(series, YAXIS.Q.idx, visible);
+        double value = Double.valueOf(data.toString());
+        addDomainMarker(new StyledValueMarker(value, theme), visible);
     }
 
     protected void doHistoricalDischargeOutW(FLYSArtifact artifact,
         Object data, String desc, Document theme, boolean visible) {
-        logger.debug("doHistoricalDischargeOutW(): description = " + desc);
-
-        // addAxisDataset(series, YAXIS.W.idx, visible);
+        double value = Double.valueOf(data.toString());
+        addValueMarker(new StyledValueMarker(value, theme), visible);
     }
 
     protected void doHistoricalDischargeCurveOut(FLYSArtifact artifact,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Oct 29 05:56:36 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Mon Oct 29 05:59:27 2012 +0100
@@ -503,11 +503,20 @@
      * Add the given vertical marker to the chart.
      */
     public void addDomainMarker(Marker marker) {
-        if (marker == null) {
-            return;
+        addDomainMarker(marker, true);
+    }
+
+
+    /**
+     * Add the given vertical marker to the chart.<b>Note:</b> the marker is
+     * added to the chart only if it is not null and if <i>visible</i> is true.
+     * @param marker The marker that should be added to the chart.
+     * @param visible The visibility of the marker.
+     */
+    public void addDomainMarker(Marker marker, boolean visible) {
+        if (visible && marker != null) {
+            domainMarkers.add(marker);
         }
-
-        domainMarkers.add(marker);
     }
 
 
@@ -515,11 +524,20 @@
      * Add the given vertical marker to the chart.
      */
     public void addValueMarker(Marker marker) {
-        if (marker == null) {
-            return;
+        addValueMarker(marker, true);
+    }
+
+
+    /**
+     * Add the given horizontal marker to the chart.<b>Note:</b> the marker is
+     * added to the chart only if it is not null and if <i>visible</i> is true.
+     * @param marker The marker that should be added to the chart.
+     * @param visible The visibility of the marker.
+     */
+    public void addValueMarker(Marker marker, boolean visible) {
+        if (visible && marker != null) {
+            valueMarkers.add(marker);
         }
-
-        valueMarkers.add(marker);
     }
 
 

http://dive4elements.wald.intevation.org