Rhino C++ API
8.14
|
#include <opennurbs_rtree.h>
Public Member Functions | |
ON_RTreeIterator () | |
ON_RTreeIterator (const class ON_RTree &a_rtree) | |
~ON_RTreeIterator () | |
bool | First () |
const ON_RTreeLeaf * | FirstLeaf () |
Iterate every leaf in an R-tree. ON_RTreeIterator rit(rtree); for ( const ON_RTreeLeaf* leaf = rit.FirstLeaf(); nullptr != leaf; leaf = rith.nextLeaf()) {...} /// More... | |
bool | Initialize (const class ON_RTree &a_rtree) |
bool | Initialize (const struct ON_RTreeNode *a_node) |
bool | Last () |
bool | Next () |
const ON_RTreeLeaf * | NextLeaf () |
Iterate every leaf in an R-tree. ON_RTreeIterator rit(rtree); for ( const ON_RTreeLeaf* leaf = rit.FirstLeaf(); nullptr != leaf; leaf = rith.nextLeaf()) {...} /// More... | |
bool | Prev () |
const ON_RTreeBranch * | Value () const |
The ON_RTreeIterator class can be used to iterate each leaf in an ON_RTree.
ON_RTreeIterator::ON_RTreeIterator | ( | ) |
Description: Construct an empty iterator. Call Initialize() to attach the iterator to an R-tree. Remark: Any calls to ON_RTree::Insert() or ON_RTree::Remove() that modify an R-tree being iterated invalidate the iterator. The iterator must be re-initialized before being used again.
There is no connection between the order elements are inserted in an R-tree and the order the elements are iterated by an iterator.
ON_RTreeIterator::ON_RTreeIterator | ( | const class ON_RTree & | a_rtree | ) |
ON_RTreeIterator::~ON_RTreeIterator | ( | ) |
bool ON_RTreeIterator::First | ( | ) |
Description: Reset the iterator so the current leaf is the first leaf in the R-tree. The Initialize() functions automatically do this, but First() can be called if an iterator needs to be used more than once or to make code easy to read and understand. Example: Iterate every leaf in an R-tree.
ON_RTree rtree; ... ON_RtreeIterator rit(rtree); const ON_RTreeBranch* rtree_leaf; for ( rit.First(); 0 != (rtree_leaf = rit.Value()); rit.Next() ) {
/ leaf id = rtree_leaf->m_id / leaf bounding box = rtree->m_rect }
Returns: True if a call to Value() will return a non-null pointer. See Also: ON_RTreeIterator::Last();
const ON_RTreeLeaf* ON_RTreeIterator::FirstLeaf | ( | ) |
Iterate every leaf in an R-tree. ON_RTreeIterator rit(rtree); for ( const ON_RTreeLeaf* leaf = rit.FirstLeaf(); nullptr != leaf; leaf = rith.nextLeaf()) {...} ///
bool ON_RTreeIterator::Initialize | ( | const class ON_RTree & | a_rtree | ) |
Description: Initialize an iterator to iterate every leaf in the rtree. Parameters: a_rtree - [in] R-tree to iterate Example: See the comment for ON_RTreeIterator::First(). Returns: True if a_rtree has at least one element. Remarks: Any calls to ON_RTree::Insert() or ON_RTree::Remove() that modify this node or its children will invalidate this iterator and it must be re-initialized.
There is no connection between the order elements are inserted in an R-tree and the order the elements are iterated by an iterator.
bool ON_RTreeIterator::Initialize | ( | const struct ON_RTreeNode * | a_node | ) |
Description: Initialize an iterator to iterate every leaf on or below a_node. Parameters: a_node - [in] R-tree node to iterate Example: See the comment for ON_RTreeIterator::First(). Returns: True if a_node has at least one element. Remarks: Any calls to ON_RTree::Insert() or ON_RTree::Remove() that modify this node or its children will invalidate this iterator and it must be re-initialized.
There is no connection between the order elements are inserted in an R-tree and the order the elements are iterated by an iterator.
bool ON_RTreeIterator::Last | ( | ) |
Description: Set the iterator so the current leaf is the last leaf in the R-tree.
Example: Iterate an R-tree in reverse order.
ON_RTree rtree; ... ON_RTreeIterator rit(rtree); const ON_RTreeBranch* rtree_leaf; for ( rit.Last(); 0 != (rtree_leaf = rit.Value()); rit.Prev() ) {
/ leaf id = rtree_leaf->m_id / leaf bounding box = rtree->m_rect }
Returns: True if a call to Value() will return a non-null pointer. See Also: ON_RTreeIterator::First();
bool ON_RTreeIterator::Next | ( | ) |
Description: Increment the iterator to the next leaf in the R-tree. Example: See the comment for ON_RTreeIterator::First() Returns: True if a call to Value() will return a non-null pointer. False if there is not a next leaf and all subsequent calls to Value() will return null. See Also: ON_RTreeIterator::Prev();
const ON_RTreeLeaf* ON_RTreeIterator::NextLeaf | ( | ) |
Iterate every leaf in an R-tree. ON_RTreeIterator rit(rtree); for ( const ON_RTreeLeaf* leaf = rit.FirstLeaf(); nullptr != leaf; leaf = rith.nextLeaf()) {...} ///
bool ON_RTreeIterator::Prev | ( | ) |
Description: Decrement the iterator to the previous leaf in the R-tree. Example: See the comment for ON_RTreeIterator::Last() Returns: True if a call to Value() will return a non-null pointer. False if there is not a previous leaf and all subsequent calls to Value() will return null. See Also: ON_RTreeIterator::Next();
const ON_RTreeBranch* ON_RTreeIterator::Value | ( | ) | const |
Description: Get the value of the current leaf element. Calling Value() does not increment or decrement the iterator. Example: See the comment for ON_RTreeIterator::First(). Return: Null pointer if there are no more leaves to iterate A pointer to the current R-tree leaf. When there are no more leaves, the returned pointer is null.