diff artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java @ 8755:30b1ddadf275

(issue1801) Unify reference gauge finding code The basic way as described in the method comment of the determineRefGauge method is now used in the WINFOArtifact, MainValuesService and RiverUtils.getGauge method. RiverUtils.getGauge previously just returned the first gauge found. While this is now a behavior change I believe that it is always more correct then the undeterministic behavior of the previous implmenentation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 14:07:26 +0200
parents e4606eae8ea5
children 5e38e2924c07
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java	Fri Jun 19 17:42:23 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java	Wed Jun 24 14:07:26 2015 +0200
@@ -32,6 +32,8 @@
 
 import org.dive4elements.river.artifacts.model.RiverFactory;
 
+import static org.dive4elements.river.backend.utils.EpsilonComparator.CMP;
+
 
 /**
  * This service returns the main values of a river's gauge based on the start
@@ -84,7 +86,8 @@
         }
 
         double[] minmax = getRequestedStartEnd(data, river);
-        Gauge gauge = river.determineGauge(minmax[0], minmax[1]);
+        Gauge gauge = river.determineRefGauge(minmax,
+                CMP.compare(minmax[0], minmax[1]) != 0);
 
         if (gauge == null) {
             return error("no gauge found.");

http://dive4elements.wald.intevation.org