Horizon
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
PNS::INDEX Class Reference

INDEX. More...

#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

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 (int 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 ()
 

Detailed Description

INDEX.

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.

Member Function Documentation

◆ Contains()

bool PNS::INDEX::Contains ( ITEM aItem) const
inline

Function Contains()

Returns true if item aItem exists in the index.

◆ Query() [1/2]

template<class Visitor >
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.

Parameters
aItemitem to search against
aMinDistanceproximity distance (wrs to the item's shape)
aVisitorfunction object called on each found item. Return false from the visitor to stop searching.
Returns
number of items found.

◆ Query() [2/2]

template<class Visitor >
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.

Parameters
aShapeshape to search against
aMinDistanceproximity distance (wrs to the item's shape)
aVisitorfunction object called on each found item. Return false from the visitor to stop searching.
Returns
number of items found.

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