Class tree_iterator

Inheritance Relationships

Base Type

Class Documentation

class tree_iterator : public iterator_base<NodeType>

Iterator over the complete tree (inner nodes and leafs). See below for example usage. Note that the non-trivial call to tree->end_tree() should be done only once for efficiency!

for(OcTreeTYPE::tree_iterator it = tree->begin_tree(),
       end=tree->end_tree(); it!= end; ++it)
{
  //manipulate node, e.g.:
  std::cout << "Node center: " << it.getCoordinate() << std::endl;
  std::cout << "Node size: " << it.getSize() << std::endl;
  std::cout << "Node value: " << it->getValue() << std::endl;
}

Public Functions

inline tree_iterator()
inline tree_iterator(OcTreeBaseImpl<NodeType, INTERFACE> const *ptree, uint8_t depth = 0)

Constructor of the iterator.

Parameters:
  • ptree – OcTreeBaseImpl on which the iterator is used on

  • depth – Maximum depth to traverse the tree. 0 (default): unlimited

inline tree_iterator operator++(int)

postfix increment operator of iterator (it++)

inline tree_iterator &operator++()

Prefix increment operator to advance the iterator.

inline bool isLeaf() const
Returns:

whether the current node is a leaf, i.e. has no children or is at max level