Mercurial > dive4elements > river
changeset 6445:192fbd23d97f
Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 26 Jun 2013 16:45:43 +0200 (2013-06-26) |
parents | 3681ae5dcfd4 |
children | 49760b45d4df |
files | artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java |
diffstat | 2 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Wed Jun 26 16:44:30 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Wed Jun 26 16:45:43 2013 +0200 @@ -90,19 +90,6 @@ } - /** - * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise. - */ - protected int getCurrentGaugeDatum() { - // 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) { @@ -253,9 +240,9 @@ logger.debug("ComputedDischargeCurveGenerator: doDischargeQOut"); XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); - int subtractPNP = getCurrentGaugeDatum(); + double subtractPNP = getCurrentGaugeDatum(); - if (subtractPNP == 0) { + if (subtractPNP == 0d) { StyledSeriesBuilder.addPointsQW(series, wqkms); addAxisSeries(series, YAXIS.W.idx, visible); }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Wed Jun 26 16:44:30 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Wed Jun 26 16:45:43 2013 +0200 @@ -66,6 +66,24 @@ public static final String I18N_YAXIS_LABEL_DEFAULT = "W [cm]"; + /** + * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise. + */ + public static double getCurrentGaugeDatum(double km, D4EArtifact artifact) { + // Code borrowed from FixATWriter. + Gauge gauge = RiverUtils.getGauge(artifact); + double subtractPNP = 0d; + if (Math.abs(km - gauge.getStation().doubleValue()) < 1e-4) { + subtractPNP = gauge.getDatum().doubleValue(); + } + return subtractPNP; + } + + public double getCurrentGaugeDatum() { + return getCurrentGaugeDatum(getRange()[0], (D4EArtifact) getMaster()); + } + + public DischargeCurveGenerator() { super(); }