[Dive4elements-commits] [PATCH 3 of 9] issue1370: helper to find Gauge datum if any

Wald Commits scm-commit at wald.intevation.org
Wed Jun 26 12:32:10 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372242490 -7200
# Node ID 654ed1732035bc5df2e20aedfe519a4d165b074d
# Parent  cc96f7a9f9ef8fa8d5ac8b5308a46eab3a1f768d
issue1370: helper to find Gauge datum if any.

diff -r cc96f7a9f9ef -r 654ed1732035 artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
--- 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;


More information about the Dive4elements-commits mailing list