[Dive4elements-commits] [PATCH 2 of 2] Added marker for Ws and Qs in Historical Discharge WQ charts

Wald Commits scm-commit at wald.intevation.org
Mon Oct 29 06:00:08 CET 2012


# HG changeset patch
# User Ingo Weinzierl <ingo.weinzierl at intevation.de>
# Date 1351486767 -3600
# Node ID 8b49888159747dc28de7a327becf1a6a93bea657
# Parent  7b6c313904273c5de2e3c7976d6f665f8d01274a
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).

diff -r 7b6c31390427 -r 8b4988815974 flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java
--- 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,
diff -r 7b6c31390427 -r 8b4988815974 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
--- 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);
     }
 
 


More information about the Dive4elements-commits mailing list