21#ifndef EESCHEMA_SCH_RTREE_H_
22#define EESCHEMA_SCH_RTREE_H_
30#include <unordered_set>
47 m_tree( std::move( aOther.m_tree ) ),
48 m_members( std::move( aOther.m_members ) )
50 aOther.m_members.clear();
57 m_tree = std::move( aOther.m_tree );
58 m_members = std::move( aOther.m_members );
59 aOther.m_members.clear();
77 const int type = int( aItem->
Type() );
78 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
81 const auto member =
m_members.insert( aItem );
85 m_tree.Insert( mmin, mmax, aItem );
106 const int type = int( aItem->
Type() );
107 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
112 if( !
m_tree.Remove( mmin, mmax, aItem ) )
115 const auto member =
m_members.find( aItem );
150 const int type = int( aItem->
Type() );
151 const int mmin[3] = { type, bbox.
GetX(), bbox.
GetY() };
156 [&found, &aItem](
const SCH_ITEM* aSearchItem )
158 if( aSearchItem == aItem )
167 m_tree.Search( mmin, mmax, search );
288 typename ee_rtree::Iterator
begin()
const
296 typename ee_rtree::Iterator
end()
const
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.
EE_RTREE(EE_RTREE &&aOther) noexcept
EE_RTREE & operator=(const EE_RTREE &)=delete
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
EE_RTREE(const EE_RTREE &)=delete
bool remove(SCH_ITEM *aItem)
Remove an item from the tree.
ee_rtree::Iterator begin() const
Return a read/write iterator that points to the first.
std::unordered_multiset< const SCH_ITEM * > m_members
void insert(SCH_ITEM *aItem)
Insert an item into the tree.
bool contains(const SCH_ITEM *aItem, bool aRobust=false) const
Determine if a given item exists in the tree.
KIRTREE::DYNAMIC_RTREE< SCH_ITEM *, int, 3 > ee_rtree
EE_TYPE Overlapping(const VECTOR2I &aPoint, int aAccuracy=0) const
ee_rtree::Iterator end() const
Return a read/write iterator that points to one past the last element in the EE_RTREE.
EE_RTREE & operator=(EE_RTREE &&aOther) noexcept
EE_TYPE Overlapping(KICAD_T aType, const VECTOR2I &aPoint, int aAccuracy=0) const
EE_TYPE OfType(KICAD_T aType) const
void clear()
Remove all items from the RTree.
Dynamic R*-tree with SoA node layout and stored insertion bounding boxes.
SearchRange Overlapping(const ELEMTYPE aMin[NUMDIMS], const ELEMTYPE aMax[NUMDIMS]) const
Return a lazy range of items overlapping the query rectangle.
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_rtree::SearchRange m_range
EE_TYPE(const ee_rtree &aTree, KICAD_T aType, const BOX2I &aRect)
typename ee_rtree::SearchIterator SearchIter
EE_TYPE(const ee_rtree &aTree, KICAD_T aType)
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