From d4408be39eb43e67c91b5a06bfcfa5dbc2328b88 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 10 Dec 2020 13:21:41 +0200 Subject: [PATCH] Contains method for QuadTree gitlab #658 Change-Id: I37f8855694d803368fd433250e7c7adb053c21e1 --- .../utils/datastructures/collections/QuadTree.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java index ce918484f..b22fa2703 100644 --- a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java +++ b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java @@ -104,6 +104,15 @@ public class QuadTree { } } + public boolean contains(T object) { + if (leaf) { + return contains.contains(object); + } else { + return pXnY.contains(object) || pXpY.contains(object) || nXnY.contains(object) || nXpY.contains(object); + } + + } + /** * Returns objects within the given area. * @param bounds -- 2.47.1