24#ifndef PCBNEW_CONNECTIVITY_RTREE_H_
25#define PCBNEW_CONNECTIVITY_RTREE_H_
30#include <geometry/rtree.h>
45 this->
m_tree =
new RTree<T, int, 3, double>();
59 const BOX2I& bbox = aItem->BBox();
61 const int mmin[3] = { aItem->StartLayer(), bbox.
GetX(), bbox.
GetY() };
64 m_tree->Insert( mmin, mmax, aItem );
76 const BOX2I& bbox = aItem->BBox();
78 const int mmin[3] = { aItem->StartLayer(), bbox.
GetX(), bbox.
GetY() };
83 if(
m_tree->Remove( mmin, mmax, aItem ) )
88 const int mmin2[3] = { INT_MIN, INT_MIN, INT_MIN };
89 const int mmax2[3] = { INT_MAX, INT_MAX, INT_MAX };
90 m_tree->Remove( mmin2, mmax2, aItem );
108 template <
class Visitor>
109 void Query(
const BOX2I& aBounds,
int aStartLayer,
int aEndLayer, Visitor& aVisitor )
const
111 int start_layer = aStartLayer ==
B_Cu ? INT_MAX : aStartLayer;
112 int end_layer = aEndLayer ==
B_Cu ? INT_MAX : aEndLayer;
114 const int mmin[3] = { start_layer, aBounds.
GetX(), aBounds.
GetY() };
117 m_tree->Search( mmin, mmax, aVisitor );
constexpr coord_type GetY() const
constexpr coord_type GetX() const
constexpr coord_type GetRight() const
constexpr coord_type GetBottom() const
CN_RTREE - Implements an R-tree for fast spatial indexing of connectivity items.
void Insert(T aItem)
Function Insert() Inserts an item into the tree.
void RemoveAll()
Function RemoveAll() Removes all items from the RTree.
void Remove(T aItem)
Function Remove() Removes an item from the tree.
RTree< T, int, 3, double > * m_tree
void Query(const BOX2I &aBounds, int aStartLayer, int aEndLayer, Visitor &aVisitor) const
Function Query() Executes a function object aVisitor for each item whose bounding box intersects with...