25#ifndef EESCHEMA_SCH_RTREE_H_
26#define EESCHEMA_SCH_RTREE_H_
33#include <geometry/rtree.h>
42 using ee_rtree = RTree<SCH_ITEM*, int, 3, double>;
66 const int type = int( aItem->
Type() );
67 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
70 m_tree->Insert( mmin, mmax, aItem );
86 const int type = int( aItem->
Type() );
87 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
92 if(
m_tree->Remove( mmin, mmax, aItem ) )
97 const int mmin2[3] = { INT_MIN, INT_MIN, INT_MIN };
98 const int mmax2[3] = { INT_MAX, INT_MAX, INT_MAX };
100 if(
m_tree->Remove( mmin2, mmax2, aItem ) )
132 const int type = int( aItem->
Type() );
133 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
138 [&found, &aItem](
const SCH_ITEM* aSearchItem )
140 if( aSearchItem == aItem )
149 m_tree->Search( mmin, mmax, search );
151 if( !found && aRobust )
157 const int mmin2[3] = { type, INT_MIN, INT_MIN };
158 const int mmax2[3] = { type, INT_MAX, INT_MAX };
160 m_tree->Search( mmin2, mmax2, search );
198 m_rect = { { INT_MIN, INT_MIN, INT_MIN }, { INT_MAX, INT_MAX, INT_MAX } };
200 m_rect = { { type, INT_MIN, INT_MIN }, { type, INT_MAX, INT_MAX } };
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr coord_type GetY() const
constexpr coord_type GetX() const
constexpr coord_type GetRight() const
constexpr coord_type GetBottom() const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
KICAD_T Type() const
Returns the type of object.
Implements an R-tree for fast spatial and type indexing of schematic items.
typename ee_rtree::Iterator iterator
RTree< SCH_ITEM *, int, 3, double > ee_rtree
EE_TYPE Overlapping(KICAD_T aType, const BOX2I &aRect) const
size_t size() const
Return the number of items in the tree.
EE_TYPE Overlapping(const BOX2I &aRect) const
bool remove(SCH_ITEM *aItem)
Remove an item from the tree.
void insert(SCH_ITEM *aItem)
Insert an item into the tree.
const iterator end() const
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
iterator end()
Returns a read/write iterator that points to one past the last element in the EE_RTREE.
EE_TYPE Overlapping(const VECTOR2I &aPoint, int aAccuracy=0) const
iterator begin()
Returns a read/write iterator that points to the first element in the EE_RTREE N.B.
EE_TYPE Overlapping(KICAD_T aType, const VECTOR2I &aPoint, int aAccuracy=0) const
const iterator begin() const
EE_TYPE OfType(KICAD_T aType) const
void clear()
Remove all items from the RTree.
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual int GetPenWidth() const
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
EE_TYPE(ee_rtree *aTree, KICAD_T aType)
EE_TYPE(ee_rtree *aTree, KICAD_T aType, const BOX2I &aRect)
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
VECTOR2< int32_t > VECTOR2I