28#include <unordered_set>
71 std::unique_ptr<INDEX>
Clone()
const
73 auto clone = std::make_unique<INDEX>();
76 clone->m_subIndices.emplace_back( std::make_unique<ITEM_SHAPE_INDEX>( si->Clone() ) );
109 template<
class Visitor>
110 int Query(
const ITEM* aItem,
int aMinDistance, Visitor& aVisitor )
const;
123 template<
class Visitor>
124 int Query(
const SHAPE* aShape,
int aMinDistance, Visitor& aVisitor )
const;
150 template <
class Visitor>
151 int querySingle( std::size_t aIndex,
const SHAPE* aShape,
int aMinDistance, Visitor& aVisitor )
const;
161template<
class Visitor>
168 return m_subIndices[aIndex]->Query( aShape, aMinDistance, aVisitor);
171template<
class Visitor>
180 for(
int i = layers.
Start(); i <= layers.
End(); ++i )
186template<
class Visitor>
192 total +=
querySingle( i, aShape, aMinDistance, aVisitor );
std::deque< std::unique_ptr< ITEM_SHAPE_INDEX > > m_subIndices
void Replace(ITEM *aOldItem, ITEM *aNewItem)
Replaces one item with another.
int querySingle(std::size_t aIndex, const SHAPE *aShape, int aMinDistance, Visitor &aVisitor) const
std::unordered_set< ITEM * > ITEM_SET
void Remove(ITEM *aItem)
Removes an item from the spatial index.
bool Contains(ITEM *aItem) const
Function Contains()
std::unique_ptr< INDEX > Clone() const
Create a copy-on-write clone of this index.
std::list< ITEM * > NET_ITEMS_LIST
SHAPE_INDEX< ITEM * > ITEM_SHAPE_INDEX
void SetDeferred(bool aDeferred)
When deferred, Add() registers items in metadata but skips spatial index insertion.
int Size() const
Returns number of items stored in the index.
ITEM_SET::iterator begin()
void Add(ITEM *aItem)
Adds item to the spatial index.
int Query(const ITEM *aItem, int aMinDistance, Visitor &aVisitor) const
Searches items in the index that are in proximity of aItem.
NET_ITEMS_LIST * GetItemsForNet(NET_HANDLE aNet)
Returns list of all items in a given net.
std::map< NET_HANDLE, NET_ITEMS_LIST > m_netMap
void BuildSpatialIndex()
Bulk load the spatial sub-indices from all registered items.
Base class for PNS router board items.
virtual const SHAPE * Shape(int aLayer) const
Return the geometrical shape of the item.
const PNS_LAYER_RANGE & Layers() const
PnsKind Kind() const
Return the type (kind) of the item.
Represent a contiguous set of PCB layers.
An abstract shape on 2D plane.
Push and Shove diff pair dimensions (gap) settings dialog.