[PATCH 2 of 3] RangeAccess: Use min/max as from/to in RangeAccess

Wald Commits scm-commit at wald.intevation.org
Tue Oct 8 15:13:49 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381238631 -7200
# Node ID 7bf8ebdcc4aced95187967e039deabb4b7ae437e
# Parent  a56fe3bc670082f567470af6995a15f65bb8cbbd
RangeAccess: Use min/max as from/to in RangeAccess.

diff -r a56fe3bc6700 -r 7bf8ebdcc4ac artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Tue Oct 08 14:50:58 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Tue Oct 08 15:23:51 2013 +0200
@@ -122,28 +122,38 @@
     }
 
 
-    /** Return ld_from data (in km). */
+    /** Return ld_from data (in km). If not found, the min. */
     public double getFrom() {
         if (from == null) {
             from = getDouble("ld_from");
         }
 
         if (logger.isDebugEnabled()) {
-            logger.debug("from: '" + from + "'");
+            logger.debug("from from data: '" + from + "'");
+        }
+
+        if (from == null) {
+            logger.warn("No 'from' found. assume max of river.");
+            return getRiver().determineMinMaxDistance()[0];
         }
 
         return from.doubleValue();
     }
 
 
-    /** Return ld_to data (in km). */
+    /** Return ld_to data (in km), if not found, the max. */
     public double getTo() {
         if (to == null) {
             to = getDouble("ld_to");
         }
 
         if (logger.isDebugEnabled()) {
-            logger.debug("to: '" + to + "'");
+            logger.debug("to from data: '" + to + "'");
+        }
+
+        if (to == null) {
+            logger.warn("No 'to' found. assume max of river.");
+            return getRiver().determineMinMaxDistance()[1];
         }
 
         return to.doubleValue();


More information about the Dive4elements-commits mailing list