Mercurial > dive4elements > river
changeset 736:d9d9f67af984
Fix for flys/issue86
flys-artifacts/trunk@2231 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 26 Jun 2011 10:33:38 +0000 (2011-06-26) |
parents | db68806e6563 |
children | 6b38b8488401 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Sat Jun 25 17:35:50 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Sun Jun 26 10:33:38 2011 +0000 @@ -347,14 +347,21 @@ double refKm = Double.NaN; if (!isFreeQ()) { - double pos = kms[river.getKmUp() ? 0 : kms.length-1]; - Gauge gauge = river.determineGaugeByPosition(pos); + double [] range = getDistance(); + if (range == null) { + return error(new WQKms[0], "No range found"); + } + + Gauge gauge = river.determineGaugeByPosition(range[0]); if (gauge == null) { - logger.warn("no gauge found at km " + pos); + return error( + new WQKms[0], "No gauge found for km " + range[0]); } - else { - refKm = gauge.getStation().doubleValue(); - } + + refKm = gauge.getStation().doubleValue(); + + logger.debug( + "reference gauge: " + gauge.getName() + " (km " + refKm + ")"); } return computeWaterlevelData(