# HG changeset patch # User Sascha L. Teichmann # Date 1357986646 -3600 # Node ID 729a5edb03139f9534d690a984d90fff81f33bf5 # Parent 8ee270a3ef252c8e5d685d34901e54c1217bd435 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. diff -r 8ee270a3ef25 -r 729a5edb0313 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java --- 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 findSegments(double a, double b) { if (a > b) { double t = a; a = b; b = t; } return findSegments(new Range(a, b));