| 
    KiCad PCB EDA Suite
    
   | 
 
#include <pns_index.h>
Public Types | |
| typedef std::list< ITEM * > | NET_ITEMS_LIST | 
| typedef SHAPE_INDEX< ITEM * > | ITEM_SHAPE_INDEX | 
| typedef std::unordered_set< ITEM * > | ITEM_SET | 
Public Member Functions | |
| INDEX () | |
| void | Add (ITEM *aItem) | 
| Adds item to the spatial index.   | |
| void | Remove (ITEM *aItem) | 
| Removes an item from the spatial index.   | |
| void | Replace (ITEM *aOldItem, ITEM *aNewItem) | 
| Replaces one item with another.   | |
| template<class Visitor> | |
| int | Query (const ITEM *aItem, int aMinDistance, Visitor &aVisitor) const | 
| Searches items in the index that are in proximity of aItem.   | |
| template<class Visitor> | |
| int | Query (const SHAPE *aShape, int aMinDistance, Visitor &aVisitor) const | 
| Searches items in the index that are in proximity of aShape.   | |
| NET_ITEMS_LIST * | GetItemsForNet (NET_HANDLE aNet) | 
| Returns list of all items in a given net.   | |
| bool | Contains (ITEM *aItem) const | 
| Function Contains()   | |
| int | Size () const | 
| Returns number of items stored in the index.   | |
| ITEM_SET::iterator | begin () | 
| ITEM_SET::iterator | end () | 
Private Member Functions | |
| template<class Visitor> | |
| int | querySingle (std::size_t aIndex, const SHAPE *aShape, int aMinDistance, Visitor &aVisitor) const | 
Private Attributes | |
| std::deque< std::unique_ptr< ITEM_SHAPE_INDEX > > | m_subIndices | 
| std::map< NET_HANDLE, NET_ITEMS_LIST > | m_netMap | 
| ITEM_SET | m_allItems | 
Custom spatial index, holding our board items and allowing for very fast searches. Items are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing overlap and improving search time.
Definition at line 46 of file pns_index.h.
| typedef std::unordered_set<ITEM*> PNS::INDEX::ITEM_SET | 
Definition at line 51 of file pns_index.h.
| typedef SHAPE_INDEX<ITEM*> PNS::INDEX::ITEM_SHAPE_INDEX | 
Definition at line 50 of file pns_index.h.
| typedef std::list<ITEM*> PNS::INDEX::NET_ITEMS_LIST | 
Definition at line 49 of file pns_index.h.
      
  | 
  inline | 
Definition at line 53 of file pns_index.h.
| void PNS::INDEX::Add | ( | ITEM * | aItem | ) | 
Adds item to the spatial index.
Definition at line 28 of file pns_index.cpp.
References PNS::ITEM::Layers(), m_allItems, m_netMap, m_subIndices, and PNS::ITEM::Net().
Referenced by PNS::NODE::Branch(), and Replace().
      
  | 
  inline | 
Definition at line 118 of file pns_index.h.
References m_allItems.
      
  | 
  inline | 
Function Contains()
Returns true if item aItem exists in the index.
Definition at line 108 of file pns_index.h.
References m_allItems.
      
  | 
  inline | 
Definition at line 119 of file pns_index.h.
References m_allItems.
| INDEX::NET_ITEMS_LIST * PNS::INDEX::GetItemsForNet | ( | NET_HANDLE | aNet | ) | 
Returns list of all items in a given net.
Definition at line 76 of file pns_index.cpp.
References m_netMap.
| int PNS::INDEX::Query | ( | const ITEM * | aItem, | 
| int | aMinDistance, | ||
| Visitor & | aVisitor ) const | 
Searches items in the index that are in proximity of aItem.
For each item, function object aVisitor is called. Only items on overlapping layers are considered.
| aItem | item to search against | 
| aMinDistance | proximity distance (wrs to the item's shape) | 
| aVisitor | function object called on each found item. Return false from the visitor to stop searching. | 
Definition at line 143 of file pns_index.h.
References PNS_LAYER_RANGE::End(), PNS::ITEM::INVALID_T, PNS::ITEM::Kind(), PNS::ITEM::Layers(), querySingle(), PNS::ITEM::Shape(), and PNS_LAYER_RANGE::Start().
| int PNS::INDEX::Query | ( | const SHAPE * | aShape, | 
| int | aMinDistance, | ||
| Visitor & | aVisitor ) const | 
Searches items in the index that are in proximity of aShape.
For each item, function object aVisitor is called. Treats all layers as colliding.
| aShape | shape to search against | 
| aMinDistance | proximity distance (wrs to the item's shape) | 
| aVisitor | function object called on each found item. Return false from the visitor to stop searching. | 
Definition at line 158 of file pns_index.h.
References m_subIndices, and querySingle().
      
  | 
  private | 
Definition at line 133 of file pns_index.h.
References m_subIndices.
| void PNS::INDEX::Remove | ( | ITEM * | aItem | ) | 
Removes an item from the spatial index.
Definition at line 50 of file pns_index.cpp.
References PNS::ITEM::Layers(), m_allItems, m_netMap, m_subIndices, and PNS::ITEM::Net().
Referenced by Replace().
Replaces one item with another.
Definition at line 69 of file pns_index.cpp.
      
  | 
  inline | 
Returns number of items stored in the index.
Definition at line 116 of file pns_index.h.
References m_allItems.
Referenced by PNS::NODE::Branch().
      
  | 
  private | 
Definition at line 128 of file pns_index.h.
Referenced by Add(), begin(), Contains(), end(), Remove(), and Size().
      
  | 
  private | 
Definition at line 127 of file pns_index.h.
Referenced by Add(), GetItemsForNet(), and Remove().
      
  | 
  private | 
Definition at line 126 of file pns_index.h.
Referenced by Add(), Query(), querySingle(), and Remove().