changeset 4333:2d3f8af87b7b

ExtremeAccess: Added helper method to find the values for (the range of) a km.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 31 Oct 2012 13:45:14 +0100
parents 0545002e112c
children 048b3c3acd01
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Wed Oct 31 13:44:36 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Wed Oct 31 13:45:14 2012 +0100
@@ -112,6 +112,22 @@
         return function;
     }
 
+
+    /** Find first RangeWithValues for which the given location
+     * is within the range and return its values.
+     * @return values of first suitable rangewithvalues or null.
+     */
+    public double[] getValuesForRange(double location) {
+        logger.debug("ExtemeAcces.getValuesForRange");
+        for (RangeWithValues rangeValues: getRanges()) {
+            if (rangeValues.inside(location)) {
+                return rangeValues.getValues();
+            }
+        }
+        return null;
+    }
+
+
     public List<RangeWithValues> getRanges() {
 
         if (ranges == null) {

http://dive4elements.wald.intevation.org