diff artifacts/src/main/java/org/dive4elements/river/artifacts/access/ComputationRangeAccess.java @ 9132:8cc192731c7d

WQSelect can now handle distance-only data
author gernotbelger
date Wed, 06 Jun 2018 14:24:51 +0200
parents e3519c3e7a0a
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/ComputationRangeAccess.java	Wed Jun 06 14:17:18 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/ComputationRangeAccess.java	Wed Jun 06 14:24:51 2018 +0200
@@ -54,6 +54,26 @@
         }
     }
 
+    public final double getStartKm() {
+
+        final KM_MODE mode = getKmRangeMode();
+        switch (mode) {
+        case RANGE:
+        case DISTANCE_ONLY:
+            return getFrom();
+
+        case LOCATIONS:
+        case NONE:
+        default:
+            final double[] locations = getLocations();
+            if( locations != null && locations.length > 0 )
+                // TODO: this is the old behaviour, but what happens if the user enters the values unsorted?
+                return locations[0];
+
+            return Double.NaN;
+        }
+    }
+
     public double[] getKms() {
 
         if (isRange())

http://dive4elements.wald.intevation.org