changeset 7262:7bf8ebdcc4ac

RangeAccess: Use min/max as from/to in RangeAccess.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 08 Oct 2013 15:23:51 +0200
parents a56fe3bc6700
children cf1c4af57a41
files artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org