Mercurial > dive4elements > river
changeset 320:a8e7c351bdf1
The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
flys-artifacts/trunk@1712 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 07:39:17 +0000 |
parents | d8558dd64152 |
children | 9581b88f2920 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java |
diffstat | 3 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Fri Apr 15 13:47:10 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Apr 18 07:39:17 2011 +0000 @@ -1,3 +1,13 @@ +2011-04-18 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: The + getGauge() method returns the first gauge based on the given start and + end point of the river. + + * src/main/java/de/intevation/flys/artifacts/states/WQSelect.java: + Fixed potential bugs: if no gauge could be determined, the default + values for W and Q are the minimum and maximum double values. + 2011-04-15 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/WQSelect.java: Fills
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Fri Apr 15 13:47:10 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Mon Apr 18 07:39:17 2011 +0000 @@ -487,10 +487,13 @@ logger.debug("... distance: " + dist[0] + " - " + dist[1]); } - List<Gauge> gauges = river.getGauges(); + Gauge gauge = river.determineGauge(dist[0], dist[1]); + gauge = null; - // TODO Search the desired gauge! - return gauges.get(0); + String name = gauge != null ? gauge.getName() : "'n/a"; + logger.debug("Found gauge: " + name); + + return gauge; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java Fri Apr 15 13:47:10 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java Mon Apr 18 07:39:17 2011 +0000 @@ -136,7 +136,7 @@ logger.debug("WQSelect.determineCurrentGauge"); Gauge gauge = ((FLYSArtifact) artifact).getGauge(); - double[] minmaxW = gauge.determineMinMaxW(); + double[] minmaxW = gauge != null ? gauge.determineMinMaxW() : null; double minW = minmaxW != null ? minmaxW[0] : Double.MIN_VALUE; double maxW = minmaxW != null ? minmaxW[1] : Double.MAX_VALUE; @@ -163,7 +163,9 @@ Gauge gauge = flysArtifact.getGauge(); Wst wst = WstFactory.getWst(river); - double[] minmaxQ = wst.determineMinMaxQ(gauge.getRange()); + double[] minmaxQ = gauge != null + ? wst.determineMinMaxQ(gauge.getRange()) + : null; double minQ = minmaxQ != null ? minmaxQ[0] : Double.MIN_VALUE; double maxQ = minmaxQ != null ? minmaxQ[1] : Double.MAX_VALUE;