|
KiCad PCB EDA Suite
|
Implement a non-owning R-tree for fast spatial indexing of VIEW items. More...
#include <view_rtree.h>
Public Member Functions | |
| void | Insert (VIEW_ITEM *aItem, const BOX2I &bbox) |
| Insert an item into the tree. | |
| void | Remove (VIEW_ITEM *aItem, const BOX2I *aBbox) |
| Remove an item from the tree. | |
| template<class Visitor> | |
| void | Query (const BOX2I &aBounds, Visitor &aVisitor) const |
| Execute a function object aVisitor for each item whose bounding box intersects with aBounds. | |
| void | RemoveAll () |
| Remove all items from the tree. | |
| void | BulkLoad (std::vector< std::pair< VIEW_ITEM *, BOX2I > > &aItems) |
| Build the R-tree from a batch of items using packed bulk loading. | |
Private Attributes | |
| KIRTREE::DYNAMIC_RTREE< VIEW_ITEM *, int, 2 > | m_tree |
Implement a non-owning R-tree for fast spatial indexing of VIEW items.
Uses DYNAMIC_RTREE with stored insertion bboxes, eliminating the O(N) fallback removal that the old RTree required when bbox was unavailable.
Definition at line 45 of file view_rtree.h.
Build the R-tree from a batch of items using packed bulk loading.
Dramatically faster than individual Insert calls when rebuilding from scratch.
Definition at line 128 of file view_rtree.h.
References m_tree.
Insert an item into the tree.
Item's bounding box is taken via its ViewBBox() method.
Definition at line 53 of file view_rtree.h.
References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), and m_tree.
|
inline |
Execute a function object aVisitor for each item whose bounding box intersects with aBounds.
Definition at line 92 of file view_rtree.h.
References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_tree, and BOX2< Vec >::SetMaximum().
Remove an item from the tree.
Removal is done by comparing pointers, attempting to remove a copy of the item will fail.
Definition at line 68 of file view_rtree.h.
References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), and m_tree.
|
inline |
|
private |
Definition at line 149 of file view_rtree.h.
Referenced by BulkLoad(), Insert(), Query(), Remove(), and RemoveAll().