Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/model/River.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 | 20b543616e6d |
children | 26dedebbe39f |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/model/River.java Fri Jun 19 17:42:23 2015 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/River.java Wed Jun 24 14:07:26 2015 +0200 @@ -390,6 +390,21 @@ } /** + * Determine reference gauge dependent on direction of calculation + * for a range calculation, otherwise dependent on flow direction. + */ + public Gauge determineRefGauge(double[] range, boolean isRange) { + if (isRange) { + return determineGaugeByPosition( + range[0], + range[0] > range[1]); + } + else { + return determineGaugeByPosition(range[0]); + } + } + + /** * Returns the min and max distance of this river. The first position in the * resulting array contains the min distance, the second position the max * distance.