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 symbols only

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

180  : type_tree( aTree )
181  {
182  KICAD_T type = BaseType( aType );
183 
184  if( type == SCH_LOCATE_ANY_T )
185  m_rect = { { INT_MIN, INT_MIN, INT_MIN }, { INT_MAX, INT_MAX, INT_MAX } };
186  else
187  m_rect = { { type, INT_MIN, INT_MIN }, { type, INT_MAX, INT_MAX } };
188  };
constexpr KICAD_T BaseType(const KICAD_T aType)
Returns the underlying type of the given type.
Definition: typeinfo.h:235
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:203
ee_rtree::Rect m_rect
Definition: sch_rtree.h:200

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

190  : type_tree( aTree )
191  {
192  KICAD_T type = BaseType( aType );
193 
194  if( type == SCH_LOCATE_ANY_T )
195  m_rect = { { INT_MIN, aRect.GetX(), aRect.GetY() },
196  { INT_MAX, aRect.GetRight(), aRect.GetBottom() } };
197  else
198  m_rect = { { type, aRect.GetX(), aRect.GetY() },
199  { type, aRect.GetRight(), aRect.GetBottom() } };
200  };
int GetX() const
Definition: eda_rect.h:103
constexpr KICAD_T BaseType(const KICAD_T aType)
Returns the underlying type of the given type.
Definition: typeinfo.h:235
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:119
int GetRight() const
Definition: eda_rect.h:116
ee_rtree * type_tree
Definition: sch_rtree.h:203
ee_rtree::Rect m_rect
Definition: sch_rtree.h:200
int GetY() const
Definition: eda_rect.h:104

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

206  {
207  return type_tree->begin( m_rect );
208  }
ee_rtree * type_tree
Definition: sch_rtree.h:203
ee_rtree::Rect m_rect
Definition: sch_rtree.h:200

References m_rect, and type_tree.

Referenced by SCH_SCREEN::HasItems().

◆ end()

iterator EE_RTREE::EE_TYPE::end ( )
inline

Definition at line 210 of file sch_rtree.h.

211  {
212  return type_tree->end( m_rect );
213  }
ee_rtree * type_tree
Definition: sch_rtree.h:203
ee_rtree::Rect m_rect
Definition: sch_rtree.h:200

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

Referenced by begin(), and end().


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