25 #ifndef EESCHEMA_SCH_RTREE_H_ 26 #define EESCHEMA_SCH_RTREE_H_ 34 #include <geometry/rtree.h> 43 using ee_rtree = RTree<SCH_ITEM*, int, 3, double>;
67 const int type = int( aItem->
Type() );
68 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
71 m_tree->Insert( mmin, mmax, aItem );
87 const int type = int( aItem->
Type() );
88 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
93 if(
m_tree->Remove( mmin, mmax, aItem ) )
98 const int mmin2[3] = { INT_MIN, INT_MIN, INT_MIN };
99 const int mmax2[3] = { INT_MAX, INT_MAX, INT_MAX };
101 if(
m_tree->Remove( mmin2, mmax2, aItem ) )
133 const int type = int( aItem->
Type() );
134 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
139 [&found, &aItem](
const SCH_ITEM* aSearchItem )
141 if( aSearchItem == aItem )
150 m_tree->Search( mmin, mmax, search );
152 if( !found && aRobust )
158 const int mmin2[3] = { type, INT_MIN, INT_MIN };
159 const int mmax2[3] = { type, INT_MAX, INT_MAX };
161 m_tree->Search( mmin2, mmax2, search );
199 m_rect = { { INT_MIN, INT_MIN, INT_MIN }, { INT_MAX, INT_MAX, INT_MAX } };
201 m_rect = { { type, INT_MIN, INT_MIN }, { type, INT_MAX, INT_MAX } };
242 EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
249 EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
EE_TYPE OfType(KICAD_T aType) const
void insert(SCH_ITEM *aItem)
Insert an item into the tree.
typename ee_rtree::Iterator iterator
const iterator begin() const
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
size_t size() const
Return the number of items in the tree.
Implements an R-tree for fast spatial and type indexing of schematic items.
EE_TYPE Overlapping(const wxPoint &aPoint, int aAccuracy=0) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
EE_TYPE(ee_rtree *aTree, KICAD_T aType, const EDA_RECT aRect)
bool remove(SCH_ITEM *aItem)
Remove an item from the tree.
iterator end()
Returns a read/write iterator that points to one past the last element in the EE_RTREE.
EE_TYPE(ee_rtree *aTree, KICAD_T aType)
const iterator end() const
RTree< SCH_ITEM *, int, 3, double > ee_rtree
virtual int GetPenWidth() const
EE_TYPE Overlapping(const EDA_RECT &aRect) const
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
EE_TYPE Overlapping(KICAD_T aType, const wxPoint &aPoint, int aAccuracy=0) const
iterator begin()
Returns a read/write iterator that points to the first element in the EE_RTREE N.B.
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Handle the component boundary box.
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Base class for any item which can be embedded within the SCHEMATIC container class,...
void clear()
Remove all items from the RTree.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
KICAD_T Type() const
Returns the type of object.
EE_TYPE Overlapping(KICAD_T aType, const EDA_RECT &aRect) const