locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.94k stars 442 forks source link

Add method access Quadtree internals #966

Open zdila opened 1 year ago

zdila commented 1 year ago

Add method to access Quadtree internals (Root and for Root its Nodes ). STRTree has such methods (itemsTree, getRoot).

In our case we need it for accessing any element from the Quadtree. With STRTree we can do it like this:

// STRTree st;

Object item = st.itemsTree();

if (!((List<?>) item).isEmpty()) {
  do {
    item = ((List<?>) item).get(0);
  }  while (item instanceof List);
}

// now `item` is a single element from `STRTree`