changeset 4796:729a5edb0313

Added intersectsQRange to QRangeTree to check if a given Q range intersects the Qs of the tree. Useful for 'Umhuellende'. TODO make check depend on km range.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 12 Jan 2013 11:30:46 +0100
parents 8ee270a3ef25
children 43e69af28b3c
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java	Fri Jan 11 22:16:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java	Sat Jan 12 11:30:46 2013 +0100
@@ -220,6 +220,20 @@
         return head;
     }
 
+    public boolean intersectsQRange(double qMin, double qMax) {
+        if (qMin > qMax) {
+            double t = qMin;
+            qMin = qMax;
+            qMax = t;
+        }
+        for (Node curr = head(); curr != null; curr = curr.next) {
+            if (curr.q >= qMin || curr.q <= qMax) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public List<Range> findSegments(double a, double b) {
         if (a > b) { double t = a; a = b; b = t; }
         return findSegments(new Range(a, b));

http://dive4elements.wald.intevation.org