changeset 6423:654ed1732035

issue1370: helper to find Gauge datum if any.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 26 Jun 2013 12:28:10 +0200
parents cc96f7a9f9ef
children 11d3d04f3925
files artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:26:40 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java	Wed Jun 26 12:28:10 2013 +0200
@@ -20,13 +20,21 @@
 import org.dive4elements.river.jfree.StickyAxisAnnotation;
 import org.dive4elements.river.jfree.StyledXYSeries;
 
+import org.dive4elements.river.model.Gauge;
 import org.dive4elements.river.utils.RiverUtils;
 
+import org.dive4elements.artifacts.Artifact;
+
+import java.awt.Font;
+
 import java.util.ArrayList;
 import java.util.List;
 
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.data.xy.XYSeries;
+
 import org.apache.log4j.Logger;
-import org.jfree.data.xy.XYSeries;
+
 import org.w3c.dom.Document;
 
 
@@ -83,6 +91,20 @@
     }
 
 
+    /**
+     * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise.
+     */
+    protected int atGaugeSubtractPNP() {
+        // Code borrowed from FixATWriter.
+        Gauge gauge = RiverUtils.getGauge((D4EArtifact) getMaster());
+        int subtractPNP = 0;
+        if (Math.abs(getRange()[0] - gauge.getStation().doubleValue()) < 1e-4) {
+            subtractPNP = (int) Math.round(gauge.getDatum().doubleValue() /** 100*/);
+        }
+        return subtractPNP;
+    }
+
+
     @Override
     protected String getDefaultYAxisLabel(int pos) {
         D4EArtifact flys = (D4EArtifact) master;

http://dive4elements.wald.intevation.org