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 EDA_RECT aRect)
 
iterator begin ()
 
iterator end ()
 

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 192 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 194 of file sch_rtree.h.

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

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 EDA_RECT  aRect 
)
inline

Definition at line 204 of file sch_rtree.h.

204  : type_tree( aTree )
205  {
206  KICAD_T type = BaseType( aType );
207 
208  if( type == SCH_LOCATE_ANY_T )
209  m_rect = { { INT_MIN, aRect.GetX(), aRect.GetY() },
210  { INT_MAX, aRect.GetRight(), aRect.GetBottom() } };
211  else
212  m_rect = { { type, aRect.GetX(), aRect.GetY() },
213  { type, aRect.GetRight(), aRect.GetBottom() } };
214  };
int GetX() const
Definition: eda_rect.h:107
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
Definition: typeinfo.h:231
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
int GetBottom() const
Definition: eda_rect.h:123
int GetRight() const
Definition: eda_rect.h:120
ee_rtree * type_tree
Definition: sch_rtree.h:217
ee_rtree::Rect m_rect
Definition: sch_rtree.h:214
int GetY() const
Definition: eda_rect.h:108

References BaseType(), EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), m_rect, and SCH_LOCATE_ANY_T.

Member Function Documentation

◆ begin()

iterator EE_RTREE::EE_TYPE::begin ( )
inline

Definition at line 219 of file sch_rtree.h.

220  {
221  return type_tree->begin( m_rect );
222  }
ee_rtree * type_tree
Definition: sch_rtree.h:217
ee_rtree::Rect m_rect
Definition: sch_rtree.h:214

References m_rect, and type_tree.

Referenced by SCH_SCREEN::HasItems().

◆ end()

iterator EE_RTREE::EE_TYPE::end ( )
inline

Definition at line 224 of file sch_rtree.h.

225  {
226  return type_tree->end( m_rect );
227  }
ee_rtree * type_tree
Definition: sch_rtree.h:217
ee_rtree::Rect m_rect
Definition: sch_rtree.h:214

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 214 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 217 of file sch_rtree.h.

Referenced by begin(), and end().


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