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_COMPONENT_T ) )

and iterate over the RTree items that are components only

Definition at line 181 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 183 of file sch_rtree.h.

183  : type_tree( aTree )
184  {
185  KICAD_T type = BaseType( aType );
186 
187  if( type == SCH_LOCATE_ANY_T )
188  m_rect = { { INT_MIN, INT_MIN, INT_MIN }, { INT_MAX, INT_MAX, INT_MAX } };
189  else
190  m_rect = { { type, INT_MIN, INT_MIN }, { type, INT_MAX, INT_MAX } };
191  };
constexpr KICAD_T BaseType(const KICAD_T aType)
Returns the underlying type of the given type.
Definition: typeinfo.h:228
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
ee_rtree * type_tree
Definition: sch_rtree.h:206
ee_rtree::Rect m_rect
Definition: sch_rtree.h:203

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 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, aRect.GetX(), aRect.GetY() },
199  { INT_MAX, aRect.GetRight(), aRect.GetBottom() } };
200  else
201  m_rect = { { type, aRect.GetX(), aRect.GetY() },
202  { type, aRect.GetRight(), aRect.GetBottom() } };
203  };
int GetX() const
Definition: eda_rect.h:111
constexpr KICAD_T BaseType(const KICAD_T aType)
Returns the underlying type of the given type.
Definition: typeinfo.h:228
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
int GetBottom() const
Definition: eda_rect.h:124
int GetRight() const
Definition: eda_rect.h:121
ee_rtree * type_tree
Definition: sch_rtree.h:206
ee_rtree::Rect m_rect
Definition: sch_rtree.h:203
int GetY() const
Definition: eda_rect.h:112

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

209  {
210  return type_tree->begin( m_rect );
211  }
ee_rtree * type_tree
Definition: sch_rtree.h:206
ee_rtree::Rect m_rect
Definition: sch_rtree.h:203

References m_rect, and type_tree.

Referenced by SCH_SCREEN::HasItems().

◆ end()

iterator EE_RTREE::EE_TYPE::end ( )
inline

Definition at line 213 of file sch_rtree.h.

214  {
215  return type_tree->end( m_rect );
216  }
ee_rtree * type_tree
Definition: sch_rtree.h:206
ee_rtree::Rect m_rect
Definition: sch_rtree.h:203

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 203 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 206 of file sch_rtree.h.

Referenced by begin(), and end().


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