39 #ifndef PCL_OCTREE_ITERATOR_H
40 #define PCL_OCTREE_ITERATOR_H
46 #include "octree_nodes.h"
47 #include "octree_key.h"
49 #include <pcl/point_cloud.h>
50 #include <pcl/point_types.h>
56 #pragma GCC system_header
77 template<
typename OctreeT>
78 class OctreeIteratorBase :
public std::iterator<std::forward_iterator_tag, const OctreeNode, void,
79 const OctreeNode*, const OctreeNode&>
261 ret =
octree_->getBranchBitPattern (*current_branch);
280 return leaf_node->getContainer();
295 return leaf_node->getContainer();
310 return branch_node->getContainer();
325 return branch_node->getContainer();
331 virtual unsigned long
334 unsigned long id = 0;
343 unsigned int depth =
octree_->getTreeDepth ();
344 id = key.
x << (depth * 2) | key.
y << (depth * 1) | key.
z << (depth * 0);
367 template<
typename OctreeT>
453 template<
typename OctreeT>
535 template<
typename OctreeT>
BranchContainer & getBranchContainer()
Method for retrieving the container from an octree branch node.
LeafContainer & getLeafContainer()
Method for retrieving a single leaf container from the octree leaf node.
OctreeT::LeafNode LeafNode
const LeafContainer & getLeafContainer() const
Method for retrieving a single leaf container from the octree leaf node.
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
virtual ~OctreeIteratorBase()
Empty deconstructor.
virtual ~OctreeBreadthFirstIterator()
Empty deconstructor.
OctreeNode * getCurrentOctreeNode() const
Get the current octree node.
OctreeT::BranchNode BranchNode
bool operator==(const OctreeIteratorBase &other) const
Equal comparison operator.
const BranchContainer & getBranchContainer() const
Method for retrieving the container from an octree branch node.
OctreeIteratorBase(const OctreeIteratorBase &src, unsigned int max_depth_arg=0)
Copy constructor.
OctreeLeafNodeIterator & operator++()
Preincrement operator.
bool operator!=(const OctreeIteratorBase &other) const
Inequal comparison operator.
OctreeIteratorBase & operator=(const OctreeIteratorBase &src)
Copy operator.
Abstract octree node class
OctreeNode * operator*() const
*operator.
virtual void reset()
Reset the iterator to the root node of the octree.
OctreeT::LeafContainer LeafContainer
bool isLeafNode() const
check if current node is a branch node
OctreeDepthFirstIterator & operator++()
Preincrement operator.
OctreeIteratorBase< OctreeT >::BranchNode BranchNode
IteratorState * current_state_
Pointer to current iterator state.
void skipChildVoxels()
Skip all child voxels of current node and return to parent node.
OctreeT * octree_
Reference to octree class.
void reset()
Reset the iterator to the root node of the octree.
OctreeBreadthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
char getNodeConfiguration() const
Get bit pattern of children configuration of current node.
unsigned int getCurrentOctreeDepth() const
Get the current depth level of octree.
OctreeLeafNodeIterator(unsigned int max_depth_arg=0)
Empty constructor.
bool isBranchNode() const
check if current node is a branch node
Octree leaf node iterator class.
void reset()
Reset the iterator to the root node of the octree.
OctreeLeafNodeIterator(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
OctreeBreadthFirstIterator & operator=(const OctreeBreadthFirstIterator &src)
Copy operator.
OctreeT::BranchContainer BranchContainer
OctreeNode * operator*() const
*operator.
virtual ~OctreeLeafNodeIterator()
Empty deconstructor.
OctreeDepthFirstIterator(unsigned int max_depth_arg=0)
Empty constructor.
virtual unsigned long getNodeID() const
get a integer identifier for current node (note: identifier depends on tree depth).
OctreeBreadthFirstIterator & operator++()
Preincrement operator.
virtual ~OctreeDepthFirstIterator()
Empty deconstructor.
OctreeIteratorBase< OctreeT >::LeafNode LeafNode
Abstract octree iterator class
std::deque< IteratorState > FIFO_
FIFO list.
std::vector< IteratorState > stack_
Stack structure.
virtual node_type_t getNodeType() const =0
Pure virtual method for receiving the type of octree node (branch or leaf)
OctreeDepthFirstIterator & operator=(const OctreeDepthFirstIterator &src)
Copy operator.
unsigned int max_octree_depth_
Maximum octree depth.
OctreeIteratorBase(OctreeT *octree_arg, unsigned int max_depth_arg=0)
Constructor.
void reset()
Reset iterator.
OctreeIteratorBase(unsigned int max_depth_arg=0)
Empty constructor.