KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EE_RTREE Class Reference

Implements an R-tree for fast spatial and type indexing of schematic items. More...

#include <sch_rtree.h>

Classes

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

Public Types

using iterator = typename ee_rtree::Iterator
 

Public Member Functions

 EE_RTREE ()
 
 ~EE_RTREE ()
 
void insert (SCH_ITEM *aItem)
 Insert an item into the tree. More...
 
bool remove (SCH_ITEM *aItem)
 Remove an item from the tree. More...
 
void clear ()
 Remove all items from the RTree. More...
 
bool contains (const SCH_ITEM *aItem, bool aRobust=false) const
 Determine if a given item exists in the tree. More...
 
size_t size () const
 Return the number of items in the tree. More...
 
bool empty () const
 
EE_TYPE OfType (KICAD_T aType) const
 
EE_TYPE Overlapping (const BOX2I &aRect) const
 
EE_TYPE Overlapping (const VECTOR2I &aPoint, int aAccuracy=0) const
 
EE_TYPE Overlapping (KICAD_T aType, const VECTOR2I &aPoint, int aAccuracy=0) const
 
EE_TYPE Overlapping (KICAD_T aType, const BOX2I &aRect) const
 
iterator begin ()
 Returns a read/write iterator that points to the first element in the EE_RTREE N.B. More...
 
iterator end ()
 Returns a read/write iterator that points to one past the last element in the EE_RTREE. More...
 
const iterator begin () const
 
const iterator end () const
 

Private Types

using ee_rtree = RTree< SCH_ITEM *, int, 3, double >
 

Private Attributes

ee_rtreem_tree
 
size_t m_count
 

Detailed Description

Implements an R-tree for fast spatial and type indexing of schematic items.

Non-owning.

Definition at line 39 of file sch_rtree.h.

Member Typedef Documentation

◆ ee_rtree

using EE_RTREE::ee_rtree = RTree<SCH_ITEM*, int, 3, double>
private

Definition at line 42 of file sch_rtree.h.

◆ iterator

using EE_RTREE::iterator = typename ee_rtree::Iterator

Definition at line 181 of file sch_rtree.h.

Constructor & Destructor Documentation

◆ EE_RTREE()

EE_RTREE::EE_RTREE ( )
inline

Definition at line 45 of file sch_rtree.h.

References m_count, and m_tree.

◆ ~EE_RTREE()

EE_RTREE::~EE_RTREE ( )
inline

Definition at line 51 of file sch_rtree.h.

References m_tree.

Member Function Documentation

◆ begin() [1/2]

iterator EE_RTREE::begin ( )
inline

Returns a read/write iterator that points to the first element in the EE_RTREE N.B.

The iteration order of the RTree is not readily apparent and will change if/when you add or move items and the RTree is re-balanced. Any exposure of the RTree contents to the user MUST be sorted before being presented. See SCH_IO_KICAD_SEXPR::Format or SCH_EDITOR_CONTROL::nextMatch for examples.

Returns
Complete RTree of the screen's items

Definition at line 276 of file sch_rtree.h.

References m_tree.

Referenced by SCH_SCREEN::FreeDrawList(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), and SCH_IO_EAGLE::loadSheet().

◆ begin() [2/2]

const iterator EE_RTREE::begin ( ) const
inline

Definition at line 291 of file sch_rtree.h.

References m_tree.

◆ clear()

void EE_RTREE::clear ( )
inline

Remove all items from the RTree.

Definition at line 111 of file sch_rtree.h.

References m_count, and m_tree.

Referenced by SCH_SCREEN::Clear(), and SCH_SCREEN::FreeDrawList().

◆ contains()

bool EE_RTREE::contains ( const SCH_ITEM aItem,
bool  aRobust = false 
) const
inline

Determine if a given item exists in the tree.

Note that this does not search the full tree so if the item has been moved, this will return false when it should be true.

Parameters
aItemItem that may potentially exist in the tree.
aRobustIf true, search the whole tree, not just the bounding box.
Returns
true if the item definitely exists, false if it does not exist within bbox.

Definition at line 125 of file sch_rtree.h.

References BOX2< Vec >::GetBottom(), EDA_ITEM::GetBoundingBox(), SCH_ITEM::GetPenWidth(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), m_tree, and EDA_ITEM::Type().

Referenced by SCH_SCREEN::CheckIfOnDrawList(), and SCH_EDIT_FRAME::onNetNavigatorSelection().

◆ empty()

bool EE_RTREE::empty ( ) const
inline

Definition at line 176 of file sch_rtree.h.

References m_count.

Referenced by SCH_EDIT_TOOL::Init(), SCH_SCREEN::IsEmpty(), and SCH_EDIT_FRAME::setupUIConditions().

◆ end() [1/2]

iterator EE_RTREE::end ( )
inline

Returns a read/write iterator that points to one past the last element in the EE_RTREE.

Definition at line 285 of file sch_rtree.h.

References m_tree.

Referenced by SCH_SCREEN::FreeDrawList(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), and SCH_IO_EAGLE::loadSheet().

◆ end() [2/2]

const iterator EE_RTREE::end ( ) const
inline

Definition at line 296 of file sch_rtree.h.

References m_tree.

◆ insert()

void EE_RTREE::insert ( SCH_ITEM aItem)
inline

◆ OfType()

EE_TYPE EE_RTREE::OfType ( KICAD_T  aType) const
inline

Definition at line 238 of file sch_rtree.h.

References m_tree.

Referenced by SCH_IO_EAGLE::addBusEntries(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::AutoRotateItem(), BOOST_AUTO_TEST_CASE(), SCH_EDIT_FRAME::BreakSegmentsOnJunctions(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_SCREENS::buildScreenList(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SHEET::CleanupSheet(), SCH_SHEET::CountSheets(), NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo(), findItemsFromSyncSelection(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_SCREEN::HasItems(), SCH_SHEET::HasUndefinedPins(), SCH_IO_KICAD_SEXPR::loadHierarchy(), SCH_IO_KICAD_LEGACY::loadHierarchy(), KI_TEST::LoadHierarchy(), SCH_IO_EAGLE::loadSheet(), SCH_SHEET::LocatePathOfScreen(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeSymbols(), DIALOG_SHEET_PIN_PROPERTIES::onComboBox(), DIALOG_ERC::OnERCItemRClick(), SCH_IO_ALTIUM::ParseAltiumSch(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::Remove(), SCH_EDITOR_CONTROL::RepairSchematic(), SCH_EDIT_FRAME::SaveProject(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SHEET::SearchHierarchy(), SCH_SHEET::SymbolCount(), ERC_TESTER::TestDuplicateSheetNames(), DIALOG_ERC::testErc(), ERC_TESTER::TestTextVars(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow(), DIALOG_CHANGE_SYMBOLS::updateFieldsList(), PANEL_SYNC_SHEET_PINS::UpdateForms(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ Overlapping() [1/4]

◆ Overlapping() [2/4]

EE_TYPE EE_RTREE::Overlapping ( const VECTOR2I aPoint,
int  aAccuracy = 0 
) const
inline

Definition at line 248 of file sch_rtree.h.

References BOX2< Vec >::Inflate(), m_tree, and SCH_LOCATE_ANY_T.

◆ Overlapping() [3/4]

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

Definition at line 262 of file sch_rtree.h.

References m_tree.

◆ Overlapping() [4/4]

EE_TYPE EE_RTREE::Overlapping ( KICAD_T  aType,
const VECTOR2I aPoint,
int  aAccuracy = 0 
) const
inline

Definition at line 255 of file sch_rtree.h.

References BOX2< Vec >::Inflate(), and m_tree.

◆ remove()

bool EE_RTREE::remove ( SCH_ITEM aItem)
inline

Remove an item from the tree.

Removal is done by comparing pointers, attempting to remove a copy of the item will fail.

Definition at line 78 of file sch_rtree.h.

References BOX2< Vec >::GetBottom(), EDA_ITEM::GetBoundingBox(), SCH_ITEM::GetPenWidth(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), m_count, m_tree, and EDA_ITEM::Type().

Referenced by SCH_SCREEN::Remove(), and SCH_SCREEN::UpdateLocalLibSymbolLinks().

◆ size()

size_t EE_RTREE::size ( ) const
inline

Return the number of items in the tree.

Returns
number of elements in the tree.

Definition at line 171 of file sch_rtree.h.

References m_count.

Member Data Documentation

◆ m_count

size_t EE_RTREE::m_count
private

Definition at line 304 of file sch_rtree.h.

Referenced by clear(), EE_RTREE(), empty(), insert(), remove(), and size().

◆ m_tree

ee_rtree* EE_RTREE::m_tree
private

Definition at line 303 of file sch_rtree.h.

Referenced by begin(), clear(), contains(), EE_RTREE(), end(), insert(), OfType(), Overlapping(), remove(), and ~EE_RTREE().


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