[PATCH] (issue1733) Use rangeaccess to access range information in location select

Wald Commits scm-commit at wald.intevation.org
Tue Oct 28 16:11:10 CET 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1414509042 -3600
# Node ID e3e5d6bb4902253eea9524982584c3c9d9bb8239
# Parent  e304f947c5a11e559b94216a744a1947c53d50aa
(issue1733) Use rangeaccess to access range information in location select

    RangeAccess and RiverUtils sort the locations properly.

diff -r e304f947c5a1 -r e3e5d6bb4902 artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationDistanceSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationDistanceSelect.java	Tue Oct 28 11:31:33 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationDistanceSelect.java	Tue Oct 28 16:10:42 2014 +0100
@@ -19,6 +19,8 @@
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.WINFOArtifact;
 
+import org.dive4elements.river.artifacts.access.RangeAccess;
+
 
 /**
  * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
@@ -134,27 +136,8 @@
 
 
     public static double[] getLocations(WINFOArtifact flys) {
-        StateData data  = flys.getData(LOCATIONS);
-        String    value = data != null ? (String) data.getValue() : null;
-
-        if (value == null || value.length() == 0) {
-            log.warn("No location data given.");
-            return null;
-        }
-
-        String[]         splitted = value.split(" ");
-        TDoubleArrayList values   = new TDoubleArrayList();
-
-        for (String split: splitted) {
-            try {
-                values.add(Double.valueOf(split));
-            }
-            catch (NumberFormatException nfe) {
-                log.warn(nfe, nfe);
-            }
-        }
-
-        return values.toNativeArray();
+        RangeAccess ra = new RangeAccess(flys);
+        return ra.getLocations();
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :


More information about the Dive4Elements-commits mailing list