[Dive4elements-commits] [PATCH 18 of 19] FLYSUtils: Use RangeAcces, removed getKmRange

Wald Commits scm-commit at wald.intevation.org
Thu Jan 24 14:14:30 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1358942789 -3600
# Node ID b99656db18de40b32f16757cf82ccc6299c4cf46
# Parent  aae2b7492c1eff84651f1ce577b5d2195017cb0f
FLYSUtils: Use RangeAcces, removed getKmRange.

diff -r aae2b7492c1e -r b99656db18de flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Wed Jan 23 13:05:36 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Wed Jan 23 13:06:29 2013 +0100
@@ -219,41 +219,6 @@
         }
     }
 
-    // TODO Moved to RangeAccess. Resolve remaining calls.
-    private static RangeAccess.KM_MODE getKmRangeMode(FLYSArtifact flys) {
-        RangeAccess rangeAccess = new RangeAccess(flys, null);
-        return rangeAccess.getKmRangeMode();
-    }
-
-    /**
-     * Get min and max kilometer, independent of parametization
-     * (ld_from/to vs ld_locations).
-     */
-    public static double[] getKmRange(FLYSArtifact flys) {
-        switch (getKmRangeMode(flys)) {
-            case RANGE: {
-                return getKmFromTo(flys);
-            }
-
-            case LOCATIONS: {
-                double[] locs = getLocations(flys);
-                return new double[] { locs[0], locs[locs.length-1] };
-            }
-
-            case NONE: {
-                double[] locs = getLocations(flys);
-                if (locs != null) {
-                    return new double[] { locs[0], locs[locs.length-1] };
-                }
-                else {
-                    return getKmFromTo(flys);
-                }
-            }
-        }
-
-        return new double[] { Double.NaN, Double.NaN };
-    }
-
 
     /**
      * Get bounds for river of artifact.
@@ -464,7 +429,8 @@
             return null;
         }
 
-        double[] dist  = getKmRange(flys);
+        RangeAccess rangeAccess = new RangeAccess(flys, null);
+        double[] dist = rangeAccess.getKmRange();
 
         if (dist == null) {
             logger.debug("no range found");
@@ -911,7 +877,8 @@
             return null;
         }
 
-        double [] dist = getKmRange(flys);
+        RangeAccess rangeAccess = new RangeAccess(flys, null);
+        double[] dist = rangeAccess.getKmRange();
         if (dist == null) {
             logger.debug("getGauges: no dist!");
             return null;


More information about the Dive4elements-commits mailing list