Mercurial > dive4elements > river
changeset 2678:d35e37b6a211
Fix issue620: synchron navigation at impossible km.
flys-artifacts/trunk@4376 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 10 May 2012 09:13:33 +0000 |
parents | 57d6670ddda3 |
children | 22c8a9b4de31 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu May 10 09:04:39 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu May 10 09:13:33 2012 +0000 @@ -1,3 +1,11 @@ +2012-05-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Fix issue620: synchron navigation at impossible kms. + + * src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java + (searchCrossSectionLine): Do not return a CrossSectionLine if there + is none found within 1km. + 2012-05-10 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/exports/ChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java Thu May 10 09:04:39 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java Thu May 10 09:13:33 2012 +0000 @@ -242,12 +242,13 @@ /** * Get CrossSectionLine spatially closest to what is specified in the data - * "cross_section.km". + * "cross_section.km", null if considered too far. * - * @return CrossSectionLine closest to "cross_section.km". + * @return CrossSectionLine closest to "cross_section.km", might be null + * if considered too far. */ public FastCrossSectionLine searchCrossSectionLine() { - + double TOO_FAR = 1d; CrossSection crossSection = CrossSectionFactory .getCrossSection(getDBID()); @@ -273,6 +274,11 @@ double km = floorD < ceilD ? floor : ceil; + // If we are too far from the wished km, return null. + if (Math.abs(km - wishKM) > TOO_FAR) { + return null; + } + return FastCrossSectionLineFactory .getCrossSectionLine(crossSection, km); }