3

It seems that the R-tree in Boost does not support hierarchy traverse.

To be specific, I want to get root node of the R-tree, and then get the children of the node.

Does Boost R-tree support hierarchy traverse ?

chenzhongpu
  • 6,193
  • 8
  • 41
  • 79
  • Indeed doesn't seem to be there. I think the order in which `begin()..end()` traverses depends on the chosen parameters too http://www.boost.org/doc/libs/1_61_0/libs/geometry/doc/html/geometry/reference/spatial_indexes/parameters.html – sehe May 20 '16 at 08:10
  • @sehe `begin() ... end()` returns the iterator of the leaf node. I would like the internal node. – chenzhongpu May 21 '16 at 07:59
  • I never disputed that. Hence I started out with "doesn't seem to be there" – sehe May 21 '16 at 10:36

1 Answers1

1

In case this was XY problem. What would you like to do exactly?

Regarding your question. User-defined tree traversal is not officially supported. However if you're not affraid to dig in the internals then you could write your own node visitor, like this one:

https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/index/detail/rtree/utilities/print.hpp#L133

And use it like this:

https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/index/detail/rtree/utilities/print.hpp#L200

Adam Wulkiewicz
  • 2,068
  • 18
  • 24