KiCad PCB EDA Suite
DRC_RTREE Class Reference

Implement an R-tree for fast spatial and layer indexing of connectable items. More...

#include <drc_rtree.h>

Classes

struct  DRC_LAYER
 The DRC_LAYER struct provides a layer-specific auto-range iterator to the RTree. More...
 
struct  ITEM_WITH_SHAPE
 
struct  PAIR_INFO
 

Public Types

typedef std::pair< PCB_LAYER_ID, PCB_LAYER_IDLAYER_PAIR
 
using iterator = typename drc_rtree::Iterator
 

Public Member Functions

 DRC_RTREE ()
 
 ~DRC_RTREE ()
 
void Insert (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int aWorstClearance=0)
 Insert an item into the tree on a particular layer with an optional worst clearance. More...
 
void clear ()
 Remove all items from the RTree. More...
 
bool CheckColliding (SHAPE *aRefShape, PCB_LAYER_ID aTargetLayer, int aClearance=0, std::function< bool(BOARD_ITEM *)> aFilter=nullptr) const
 
int QueryColliding (BOARD_ITEM *aRefItem, PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer, std::function< bool(BOARD_ITEM *)> aFilter=nullptr, std::function< bool(BOARD_ITEM *)> aVisitor=nullptr, int aClearance=0) const
 This is a fast test which essentially does bounding-box overlap given a worst-case clearance. More...
 
bool QueryColliding (EDA_RECT aBox, SHAPE *aRefShape, PCB_LAYER_ID aLayer, int aClearance, int *aActual, VECTOR2I *aPos) const
 This one is for tessellated items. More...
 
bool QueryColliding (EDA_RECT aBox, SHAPE *aRefShape, PCB_LAYER_ID aLayer) const
 Quicker version of above that just reports a raw yes/no. More...
 
int QueryCollidingPairs (DRC_RTREE *aRefTree, std::vector< LAYER_PAIR > aLayerPairs, std::function< bool(const LAYER_PAIR &, ITEM_WITH_SHAPE *, ITEM_WITH_SHAPE *, bool *aCollision)> aVisitor, int aMaxClearance, std::function< bool(int, int)> aProgressReporter) const
 
size_t size () const
 Return the number of items in the tree. More...
 
bool empty () const
 
DRC_LAYER OnLayer (PCB_LAYER_ID aLayer) const
 
DRC_LAYER Overlapping (PCB_LAYER_ID aLayer, const wxPoint &aPoint, int aAccuracy=0) const
 
DRC_LAYER Overlapping (PCB_LAYER_ID aLayer, const EDA_RECT &aRect) const
 

Private Types

using drc_rtree = RTree< ITEM_WITH_SHAPE *, int, 2, double >
 

Private Attributes

drc_rtreem_tree [PCB_LAYER_ID_COUNT]
 
size_t m_count
 

Detailed Description

Implement an R-tree for fast spatial and layer indexing of connectable items.

Non-owning.

Definition at line 46 of file drc_rtree.h.

Member Typedef Documentation

◆ drc_rtree

using DRC_RTREE::drc_rtree = RTree<ITEM_WITH_SHAPE*, int, 2, double>
private

Definition at line 67 of file drc_rtree.h.

◆ iterator

using DRC_RTREE::iterator = typename drc_rtree::Iterator

Definition at line 433 of file drc_rtree.h.

◆ LAYER_PAIR

Definition at line 329 of file drc_rtree.h.

Constructor & Destructor Documentation

◆ DRC_RTREE()

DRC_RTREE::DRC_RTREE ( )
inline

Definition at line 71 of file drc_rtree.h.

72  {
73  for( int layer : LSET::AllLayersMask().Seq() )
74  m_tree[layer] = new drc_rtree();
75 
76  m_count = 0;
77  }
RTree< ITEM_WITH_SHAPE *, int, 2, double > drc_rtree
Definition: drc_rtree.h:67
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
size_t m_count
Definition: drc_rtree.h:490
static LSET AllLayersMask()
Definition: lset.cpp:787

References LSET::AllLayersMask(), m_count, and m_tree.

◆ ~DRC_RTREE()

DRC_RTREE::~DRC_RTREE ( )
inline

Definition at line 79 of file drc_rtree.h.

80  {
81  for( auto tree : m_tree )
82  delete tree;
83  }
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489

References m_tree.

Member Function Documentation

◆ CheckColliding()

bool DRC_RTREE::CheckColliding ( SHAPE aRefShape,
PCB_LAYER_ID  aTargetLayer,
int  aClearance = 0,
std::function< bool(BOARD_ITEM *)>  aFilter = nullptr 
) const
inline

Definition at line 141 of file drc_rtree.h.

143  {
144  BOX2I box = aRefShape->BBox();
145  box.Inflate( aClearance );
146 
147  int min[2] = { box.GetX(), box.GetY() };
148  int max[2] = { box.GetRight(), box.GetBottom() };
149 
150  int count = 0;
151 
152  auto visit =
153  [&] ( ITEM_WITH_SHAPE* aItem ) -> bool
154  {
155  if( !aFilter || aFilter( aItem->parent ) )
156  {
157  int actual;
158 
159  if( aRefShape->Collide( aItem->shape, aClearance, &actual ) )
160  {
161  count++;
162  return false;
163  }
164  }
165 
166  return true;
167  };
168 
169  this->m_tree[aTargetLayer]->Search( min, max, visit );
170  return count > 0;
171  }
coord_type GetX() const
Definition: box2.h:173
coord_type GetRight() const
Definition: box2.h:182
coord_type GetBottom() const
Definition: box2.h:183
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition: shape.h:165
virtual const BOX2I BBox(int aClearance=0) const =0
Compute a bounding box of the shape, with a margin of aClearance a collision.
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
coord_type GetY() const
Definition: box2.h:174
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281

References SHAPE::BBox(), SHAPE::Collide(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), and m_tree.

Referenced by extractDiffPairCoupledItems().

◆ clear()

void DRC_RTREE::clear ( )
inline

Remove all items from the RTree.

Definition at line 133 of file drc_rtree.h.

134  {
135  for( auto tree : m_tree )
136  tree->RemoveAll();
137 
138  m_count = 0;
139  }
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
size_t m_count
Definition: drc_rtree.h:490

References m_count, and m_tree.

Referenced by DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run().

◆ empty()

bool DRC_RTREE::empty ( ) const
inline

Definition at line 428 of file drc_rtree.h.

429  {
430  return m_count == 0;
431  }
size_t m_count
Definition: drc_rtree.h:490

References m_count.

◆ Insert()

void DRC_RTREE::Insert ( BOARD_ITEM aItem,
PCB_LAYER_ID  aLayer,
int  aWorstClearance = 0 
)
inline

Insert an item into the tree on a particular layer with an optional worst clearance.

Definition at line 88 of file drc_rtree.h.

89  {
90  wxCHECK( aLayer != UNDEFINED_LAYER, /* void */ );
91 
92  if( aItem->Type() == PCB_FP_TEXT_T && !static_cast<FP_TEXT*>( aItem )->IsVisible() )
93  return;
94 
95  std::vector<SHAPE*> subshapes;
96  std::shared_ptr<SHAPE> shape = aItem->GetEffectiveShape( ToLAYER_ID( aLayer ) );
97  subshapes.clear();
98 
99  if( shape->HasIndexableSubshapes() )
100  shape->GetIndexableSubshapes( subshapes );
101  else
102  subshapes.push_back( shape.get() );
103 
104  if( aItem->Type() == PCB_PAD_T )
105  {
106  PAD* pad = static_cast<PAD*>( aItem );
107 
108  if( pad->GetDrillSizeX() )
109  {
110  const SHAPE* hole = pad->GetEffectiveHoleShape();
111  subshapes.push_back( const_cast<SHAPE*>( hole ) );
112  }
113  }
114 
115  for( SHAPE* subshape : subshapes )
116  {
117  BOX2I bbox = subshape->BBox();
118 
119  bbox.Inflate( aWorstClearance );
120 
121  const int mmin[2] = { bbox.GetX(), bbox.GetY() };
122  const int mmax[2] = { bbox.GetRight(), bbox.GetBottom() };
123  ITEM_WITH_SHAPE* itemShape = new ITEM_WITH_SHAPE( aItem, subshape, shape );
124 
125  m_tree[aLayer]->Insert( mmin, mmax, itemShape );
126  m_count++;
127  }
128  }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
coord_type GetX() const
Definition: box2.h:173
coord_type GetRight() const
Definition: box2.h:182
class PAD, a pad in a footprint
Definition: typeinfo.h:89
coord_type GetBottom() const
Definition: box2.h:183
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
size_t m_count
Definition: drc_rtree.h:490
An abstract shape on 2D plane.
Definition: shape.h:116
coord_type GetY() const
Definition: box2.h:174
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: board_item.cpp:169
Definition: pad.h:57
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References BOX2< Vec >::GetBottom(), BOARD_ITEM::GetEffectiveShape(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), m_count, m_tree, pad, PCB_FP_TEXT_T, PCB_PAD_T, ToLAYER_ID(), EDA_ITEM::Type(), and UNDEFINED_LAYER.

Referenced by TRACKS_CLEANER::cleanup(), DRC_TEST_PROVIDER_SILK_TO_MASK::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run().

◆ OnLayer()

DRC_LAYER DRC_RTREE::OnLayer ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 470 of file drc_rtree.h.

471  {
472  return DRC_LAYER( m_tree[int( aLayer )] );
473  }
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489

References m_tree.

Referenced by QueryCollidingPairs().

◆ Overlapping() [1/2]

DRC_LAYER DRC_RTREE::Overlapping ( PCB_LAYER_ID  aLayer,
const wxPoint &  aPoint,
int  aAccuracy = 0 
) const
inline

Definition at line 475 of file drc_rtree.h.

476  {
477  EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
478  rect.Inflate( aAccuracy );
479  return DRC_LAYER( m_tree[int( aLayer )], rect );
480  }
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
Handle the component boundary box.
Definition: eda_rect.h:42

References EDA_RECT::Inflate(), and m_tree.

◆ Overlapping() [2/2]

DRC_LAYER DRC_RTREE::Overlapping ( PCB_LAYER_ID  aLayer,
const EDA_RECT aRect 
) const
inline

Definition at line 482 of file drc_rtree.h.

483  {
484  return DRC_LAYER( m_tree[int( aLayer )], aRect );
485  }
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489

References m_tree.

◆ QueryColliding() [1/3]

int DRC_RTREE::QueryColliding ( BOARD_ITEM aRefItem,
PCB_LAYER_ID  aRefLayer,
PCB_LAYER_ID  aTargetLayer,
std::function< bool(BOARD_ITEM *)>  aFilter = nullptr,
std::function< bool(BOARD_ITEM *)>  aVisitor = nullptr,
int  aClearance = 0 
) const
inline

This is a fast test which essentially does bounding-box overlap given a worst-case clearance.

It's used when looking up the specific item-to-item clearance might be expensive and should be deferred till we know we have a possible hit.

Definition at line 178 of file drc_rtree.h.

184  {
185  // keep track of BOARD_ITEMs that have been already found to collide (some items
186  // might be build of COMPOUND/triangulated shapes and a single subshape collision
187  // means we have a hit)
188  std::unordered_set<BOARD_ITEM*> collidingCompounds;
189 
190  // keep track of results of client filter so we don't ask more than once for compound
191  // shapes
192  std::map<BOARD_ITEM*, bool> filterResults;
193 
194  EDA_RECT box = aRefItem->GetBoundingBox();
195  box.Inflate( aClearance );
196 
197  int min[2] = { box.GetX(), box.GetY() };
198  int max[2] = { box.GetRight(), box.GetBottom() };
199 
200  std::shared_ptr<SHAPE> refShape = aRefItem->GetEffectiveShape( aRefLayer );
201 
202  int count = 0;
203 
204  auto visit =
205  [&]( ITEM_WITH_SHAPE* aItem ) -> bool
206  {
207  if( aItem->parent == aRefItem )
208  return true;
209 
210  if( collidingCompounds.find( aItem->parent ) != collidingCompounds.end() )
211  return true;
212 
213  bool filtered;
214  auto it = filterResults.find( aItem->parent );
215 
216  if( it == filterResults.end() )
217  {
218  filtered = aFilter && !aFilter( aItem->parent );
219  filterResults[ aItem->parent ] = filtered;
220  }
221  else
222  {
223  filtered = it->second;
224  }
225 
226  if( filtered )
227  return true;
228 
229  if( refShape->Collide( aItem->shape, aClearance ) )
230  {
231  collidingCompounds.insert( aItem->parent );
232  count++;
233 
234  if( aVisitor )
235  return aVisitor( aItem->parent );
236  }
237 
238  return true;
239  };
240 
241  this->m_tree[aTargetLayer]->Search( min, max, visit );
242  return count;
243  }
int GetX() const
Definition: eda_rect.h:98
int GetBottom() const
Definition: eda_rect.h:114
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
int GetRight() const
Definition: eda_rect.h:111
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:99
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: board_item.cpp:169
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References EDA_RECT::GetBottom(), EDA_ITEM::GetBoundingBox(), BOARD_ITEM::GetEffectiveShape(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), EDA_RECT::Inflate(), and m_tree.

Referenced by calcIsInsideArea(), TRACKS_CLEANER::cleanup(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances().

◆ QueryColliding() [2/3]

bool DRC_RTREE::QueryColliding ( EDA_RECT  aBox,
SHAPE aRefShape,
PCB_LAYER_ID  aLayer,
int  aClearance,
int *  aActual,
VECTOR2I aPos 
) const
inline

This one is for tessellated items.

(All shapes in the tree will be from a single BOARD_ITEM.) It checks all items in the bbox overlap to find the minimal actual distance and position.

Definition at line 251 of file drc_rtree.h.

253  {
254  aBox.Inflate( aClearance );
255 
256  int min[2] = { aBox.GetX(), aBox.GetY() };
257  int max[2] = { aBox.GetRight(), aBox.GetBottom() };
258 
259  bool collision = false;
260  int actual = INT_MAX;
261  VECTOR2I pos;
262 
263  auto visit =
264  [&]( ITEM_WITH_SHAPE* aItem ) -> bool
265  {
266  int curActual;
267  VECTOR2I curPos;
268 
269  if( aRefShape->Collide( aItem->shape, aClearance, &curActual, &curPos ) )
270  {
271  collision = true;
272 
273  if( curActual < actual )
274  {
275  actual = curActual;
276  pos = curPos;
277  }
278 
279  // Stop looking after we have a true collision
280  if( actual <= 0 )
281  return false;
282  }
283 
284  return true;
285  };
286 
287  this->m_tree[aLayer]->Search( min, max, visit );
288 
289  if( collision )
290  {
291  if( aActual )
292  *aActual = std::max( 0, actual );
293 
294  if( aPos )
295  *aPos = pos;
296 
297  return true;
298  }
299 
300  return false;
301  }
int GetX() const
Definition: eda_rect.h:98
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition: shape.h:165
int GetBottom() const
Definition: eda_rect.h:114
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
int GetRight() const
Definition: eda_rect.h:111
int GetY() const
Definition: eda_rect.h:99
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References SHAPE::Collide(), EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), EDA_RECT::Inflate(), and m_tree.

◆ QueryColliding() [3/3]

bool DRC_RTREE::QueryColliding ( EDA_RECT  aBox,
SHAPE aRefShape,
PCB_LAYER_ID  aLayer 
) const
inline

Quicker version of above that just reports a raw yes/no.

Definition at line 306 of file drc_rtree.h.

307  {
308  int min[2] = { aBox.GetX(), aBox.GetY() };
309  int max[2] = { aBox.GetRight(), aBox.GetBottom() };
310  bool collision = false;
311 
312  auto visit =
313  [&]( ITEM_WITH_SHAPE* aItem ) -> bool
314  {
315  if( aRefShape->Collide( aItem->shape, 0 ) )
316  {
317  collision = true;
318  return false;
319  }
320 
321  return true;
322  };
323 
324  this->m_tree[aLayer]->Search( min, max, visit );
325 
326  return collision;
327  }
int GetX() const
Definition: eda_rect.h:98
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Definition: shape.h:165
int GetBottom() const
Definition: eda_rect.h:114
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
int GetRight() const
Definition: eda_rect.h:111
int GetY() const
Definition: eda_rect.h:99

References SHAPE::Collide(), EDA_RECT::GetBottom(), EDA_RECT::GetRight(), EDA_RECT::GetX(), EDA_RECT::GetY(), and m_tree.

◆ QueryCollidingPairs()

int DRC_RTREE::QueryCollidingPairs ( DRC_RTREE aRefTree,
std::vector< LAYER_PAIR aLayerPairs,
std::function< bool(const LAYER_PAIR &, ITEM_WITH_SHAPE *, ITEM_WITH_SHAPE *, bool *aCollision)>  aVisitor,
int  aMaxClearance,
std::function< bool(int, int)>  aProgressReporter 
) const
inline

Definition at line 344 of file drc_rtree.h.

351  {
352  std::vector<PAIR_INFO> pairsToVisit;
353 
354  for( LAYER_PAIR& layerPair : aLayerPairs )
355  {
356  const PCB_LAYER_ID refLayer = layerPair.first;
357  const PCB_LAYER_ID targetLayer = layerPair.second;
358 
359  for( ITEM_WITH_SHAPE* refItem : aRefTree->OnLayer( refLayer ) )
360  {
361  BOX2I box = refItem->shape->BBox();
362  box.Inflate( aMaxClearance );
363 
364  int min[2] = { box.GetX(), box.GetY() };
365  int max[2] = { box.GetRight(), box.GetBottom() };
366 
367  auto visit =
368  [&]( ITEM_WITH_SHAPE* aItemToTest ) -> bool
369  {
370  // don't collide items against themselves
371  if( aItemToTest->parent == refItem->parent )
372  return true;
373 
374  pairsToVisit.emplace_back( layerPair, refItem, aItemToTest );
375  return true;
376  };
377 
378  this->m_tree[targetLayer]->Search( min, max, visit );
379  };
380  }
381 
382  // keep track of BOARD_ITEMs pairs that have been already found to collide (some items
383  // might be build of COMPOUND/triangulated shapes and a single subshape collision
384  // means we have a hit)
385  std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, int> collidingCompounds;
386 
387  int progress = 0;
388  int count = pairsToVisit.size();
389 
390  for( const PAIR_INFO& pair : pairsToVisit )
391  {
392  if( !aProgressReporter( progress++, count ) )
393  break;
394 
395  BOARD_ITEM* a = pair.refItem->parent;
396  BOARD_ITEM* b = pair.testItem->parent;
397 
398  // store canonical order so we don't collide in both directions (a:b and b:a)
399  if( static_cast<void*>( a ) > static_cast<void*>( b ) )
400  std::swap( a, b );
401 
402  // don't report multiple collisions for compound or triangulated shapes
403  if( collidingCompounds.count( { a, b } ) )
404  continue;
405 
406  bool collisionDetected = false;
407 
408  if( !aVisitor( pair.layerPair, pair.refItem, pair.testItem, &collisionDetected ) )
409  break;
410 
411  if( collisionDetected )
412  collidingCompounds[ { a, b } ] = 1;
413  }
414 
415  return 0;
416  }
coord_type GetX() const
Definition: box2.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
coord_type GetRight() const
Definition: box2.h:182
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > LAYER_PAIR
Definition: drc_rtree.h:329
coord_type GetBottom() const
Definition: box2.h:183
drc_rtree * m_tree[PCB_LAYER_ID_COUNT]
Definition: drc_rtree.h:489
coord_type GetY() const
Definition: box2.h:174
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
DRC_LAYER OnLayer(PCB_LAYER_ID aLayer) const
Definition: drc_rtree.h:470

References BOX2< Vec >::GetBottom(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), BOX2< Vec >::Inflate(), m_tree, and OnLayer().

Referenced by DRC_TEST_PROVIDER_SILK_TO_MASK::Run(), and DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

◆ size()

size_t DRC_RTREE::size ( ) const
inline

Return the number of items in the tree.

Returns
number of elements in the tree.

Definition at line 423 of file drc_rtree.h.

424  {
425  return m_count;
426  }
size_t m_count
Definition: drc_rtree.h:490

References m_count.

Referenced by DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

Member Data Documentation

◆ m_count

size_t DRC_RTREE::m_count
private

Definition at line 490 of file drc_rtree.h.

Referenced by clear(), DRC_RTREE(), empty(), Insert(), and size().

◆ m_tree


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