changeset 8758:d4caab3fedde

A duration curve is always calculated for a single location. This implies that the gauge can be determined directly from that location using the default for limits between gauge ranges.
author Tom Gottfried <tom@intevation.de>
date Fri, 26 Jun 2015 16:23:32 +0200
parents bd17bd07db69
children 2faf6cef6f5f
files artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jun 26 14:31:08 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jun 26 16:23:32 2015 +0200
@@ -313,25 +313,23 @@
     public CalculationResult getDurationCurveData() {
         log.debug("WINFOArtifact.getDurationCurveData");
 
-        River r = RiverUtils.getRiver(this);
+        RangeAccess rangeAccess = new RangeAccess(this);
 
+        River r = rangeAccess.getRiver();
         if (r == null) {
             return error(null, "no.river.selected");
         }
 
-        Gauge g = RiverUtils.getGauge(this);
+        double[] locations = rangeAccess.getLocations();
+        if (locations == null) {
+            return error(null, "no.locations.selected");
+        }
 
+        Gauge g = r.determineGaugeByPosition(locations[0]);
         if (g == null) {
            return error(null, "no.gauge.selected");
         }
 
-        RangeAccess rangeAccess = new RangeAccess(this);
-        double[] locations = rangeAccess.getLocations();
-
-        if (locations == null) {
-            return error(null, "no.locations.selected");
-        }
-
         WstValueTable wst = WstValueTableFactory.getTable(r);
         if (wst == null) {
             return error(null, "no.wst.for.river");

http://dive4elements.wald.intevation.org