KiCad PCB EDA Suite
EE_RTREE::EE_TYPE Struct Reference

The EE_TYPE struct provides a type-specific auto-range iterator to the RTree. More...

#include <sch_rtree.h>

Public Member Functions

 EE_TYPE (ee_rtree *aTree, KICAD_T aType)
 
 EE_TYPE (ee_rtree *aTree, KICAD_T aType, const BOX2I &aRect)
 
iterator begin ()
 
iterator end ()
 
bool empty ()
 

Public Attributes

ee_rtree::Rect m_rect
 
ee_rtreetype_tree
 

Detailed Description

The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.

Using this struct, one can write lines like:

for( auto item : rtree.OfType( SCH_SYMBOL_T ) )

and iterate over the RTree items that are symbols only

Definition at line 191 of file sch_rtree.h.

Constructor & Destructor Documentation

◆ EE_TYPE() [1/2]

EE_RTREE::EE_TYPE::EE_TYPE ( ee_rtree aTree,
KICAD_T  aType 
)
inline

Definition at line 193 of file sch_rtree.h.

193 : type_tree( aTree )
194 {
195 KICAD_T type = BaseType( aType );
196
197 if( type == SCH_LOCATE_ANY_T )
198 m_rect = { { INT_MIN, INT_MIN, INT_MIN }, { INT_MAX, INT_MAX, INT_MAX } };
199 else
200 m_rect = { { type, INT_MIN, INT_MIN }, { type, INT_MAX, INT_MAX } };
201 };
ee_rtree::Rect m_rect
Definition: sch_rtree.h:219
ee_rtree * type_tree
Definition: sch_rtree.h:220
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
Definition: typeinfo.h:253
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:183

References BaseType(), m_rect, and SCH_LOCATE_ANY_T.

◆ EE_TYPE() [2/2]

EE_RTREE::EE_TYPE::EE_TYPE ( ee_rtree aTree,
KICAD_T  aType,
const BOX2I aRect 
)
inline

Definition at line 203 of file sch_rtree.h.

203 : type_tree( aTree )
204 {
205 KICAD_T type = BaseType( aType );
206
207 if( type == SCH_LOCATE_ANY_T )
208 {
209 m_rect = { { INT_MIN, aRect.GetX(), aRect.GetY() },
210 { INT_MAX, aRect.GetRight(), aRect.GetBottom() } };
211 }
212 else
213 {
214 m_rect = { { type, aRect.GetX(), aRect.GetY() },
215 { type, aRect.GetRight(), aRect.GetBottom() } };
216 }
217 };
coord_type GetY() const
Definition: box2.h:181
coord_type GetX() const
Definition: box2.h:180
coord_type GetRight() const
Definition: box2.h:189
coord_type GetBottom() const
Definition: box2.h:190

References BaseType(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_rect, and SCH_LOCATE_ANY_T.

Member Function Documentation

◆ begin()

iterator EE_RTREE::EE_TYPE::begin ( )
inline

Definition at line 222 of file sch_rtree.h.

223 {
224 return type_tree->begin( m_rect );
225 }

References m_rect, and type_tree.

Referenced by SCH_SCREEN::HasItems().

◆ empty()

bool EE_RTREE::EE_TYPE::empty ( )
inline

Definition at line 232 of file sch_rtree.h.

233 {
234 return type_tree->Count() == 0;
235 }

References type_tree.

◆ end()

iterator EE_RTREE::EE_TYPE::end ( )
inline

Definition at line 227 of file sch_rtree.h.

228 {
229 return type_tree->end( m_rect );
230 }

References m_rect, and type_tree.

Referenced by SCH_SCREEN::HasItems().

Member Data Documentation

◆ m_rect

ee_rtree::Rect EE_RTREE::EE_TYPE::m_rect

Definition at line 219 of file sch_rtree.h.

Referenced by begin(), EE_TYPE(), and end().

◆ type_tree

ee_rtree* EE_RTREE::EE_TYPE::type_tree

Definition at line 220 of file sch_rtree.h.

Referenced by begin(), empty(), and end().


The documentation for this struct was generated from the following file: