KiCad PCB EDA Suite
connectivity_algo.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 2016-2018 CERN
5  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
28 #include <board_commit.h>
29 
30 #include <thread>
31 #include <mutex>
32 #include <algorithm>
33 #include <future>
34 
35 #ifdef PROFILE
36 #include <profile.h>
37 #endif
38 
39 
41 {
42  markItemNetAsDirty( aItem );
43 
44  switch( aItem->Type() )
45  {
46  case PCB_MODULE_T:
47  for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() )
48  {
49  m_itemMap[pad].MarkItemsAsInvalid();
50  m_itemMap.erase( pad );
51  }
52 
53  m_itemList.SetDirty( true );
54  break;
55 
56  case PCB_PAD_T:
57  m_itemMap[aItem].MarkItemsAsInvalid();
58  m_itemMap.erase( aItem );
59  m_itemList.SetDirty( true );
60  break;
61 
62  case PCB_TRACE_T:
63  case PCB_ARC_T:
64  m_itemMap[aItem].MarkItemsAsInvalid();
65  m_itemMap.erase( aItem );
66  m_itemList.SetDirty( true );
67  break;
68 
69  case PCB_VIA_T:
70  m_itemMap[aItem].MarkItemsAsInvalid();
71  m_itemMap.erase( aItem );
72  m_itemList.SetDirty( true );
73  break;
74 
75  case PCB_ZONE_AREA_T:
76  {
77  m_itemMap[aItem].MarkItemsAsInvalid();
78  m_itemMap.erase ( aItem );
79  m_itemList.SetDirty( true );
80  break;
81  }
82 
83  default:
84  return false;
85  }
86 
87  // Once we delete an item, it may connect between lists, so mark both as potentially invalid
88  m_itemList.SetHasInvalid( true );
89 
90  return true;
91 }
92 
93 
95 {
96  if( aItem->IsConnected() )
97  {
98  auto citem = static_cast<const BOARD_CONNECTED_ITEM*>( aItem );
99  MarkNetAsDirty( citem->GetNetCode() );
100  }
101  else
102  {
103  if( aItem->Type() == PCB_MODULE_T )
104  {
105  auto mod = static_cast <const MODULE*>( aItem );
106 
107  for( auto pad : mod->Pads() )
108  MarkNetAsDirty( pad->GetNetCode() );
109  }
110  }
111 }
112 
113 
115 {
116  if( !aItem->IsOnCopperLayer() )
117  return false;
118 
119  markItemNetAsDirty ( aItem );
120 
121  switch( aItem->Type() )
122  {
123  case PCB_NETINFO_T:
124  {
125  MarkNetAsDirty( static_cast<NETINFO_ITEM*>( aItem )->GetNet() );
126  break;
127  }
128  case PCB_MODULE_T:
129  for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() )
130  {
131  if( m_itemMap.find( pad ) != m_itemMap.end() )
132  return false;
133 
134  add( m_itemList, pad );
135  }
136 
137  break;
138 
139  case PCB_PAD_T:
140  if( m_itemMap.find ( aItem ) != m_itemMap.end() )
141  return false;
142 
143  add( m_itemList, static_cast<D_PAD*>( aItem ) );
144 
145  break;
146 
147  case PCB_TRACE_T:
148  {
149  if( m_itemMap.find( aItem ) != m_itemMap.end() )
150  return false;
151 
152  add( m_itemList, static_cast<TRACK*>( aItem ) );
153 
154  break;
155  }
156 
157  case PCB_ARC_T:
158  {
159  if( m_itemMap.find( aItem ) != m_itemMap.end() )
160  return false;
161 
162  add( m_itemList, static_cast<ARC*>( aItem ) );
163 
164  break;
165  }
166 
167  case PCB_VIA_T:
168  if( m_itemMap.find( aItem ) != m_itemMap.end() )
169  return false;
170 
171  add( m_itemList, static_cast<VIA*>( aItem ) );
172 
173  break;
174 
175  case PCB_ZONE_AREA_T:
176  {
177  auto zone = static_cast<ZONE_CONTAINER*>( aItem );
178 
179  if( m_itemMap.find( aItem ) != m_itemMap.end() )
180  return false;
181 
182  m_itemMap[zone] = ITEM_MAP_ENTRY();
183 
184  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
185  for( auto zitem : m_itemList.Add( zone, layer ) )
186  m_itemMap[zone].Link( zitem );
187 
188  break;
189  }
190 
191  default:
192  return false;
193  }
194 
195  return true;
196 }
197 
198 
200 {
201 #ifdef CONNECTIVITY_DEBUG
202  printf("Search start\n");
203 #endif
204 
205 #ifdef PROFILE
206  PROF_COUNTER garbage_collection( "garbage-collection" );
207 #endif
208  std::vector<CN_ITEM*> garbage;
209  garbage.reserve( 1024 );
210 
211  m_itemList.RemoveInvalidItems( garbage );
212 
213  for( auto item : garbage )
214  delete item;
215 
216 #ifdef PROFILE
217  garbage_collection.Show();
218  PROF_COUNTER search_basic( "search-basic" );
219 #endif
220 
221  std::vector<CN_ITEM*> dirtyItems;
222  std::copy_if( m_itemList.begin(), m_itemList.end(), std::back_inserter( dirtyItems ),
223  [] ( CN_ITEM* aItem ) { return aItem->Dirty(); } );
224 
225  if( m_progressReporter )
226  {
227  m_progressReporter->SetMaxProgress( dirtyItems.size() );
229  }
230 
231  if( m_itemList.IsDirty() )
232  {
233  size_t parallelThreadCount = std::min<size_t>( std::thread::hardware_concurrency(),
234  ( dirtyItems.size() + 7 ) / 8 );
235 
236  std::atomic<size_t> nextItem( 0 );
237  std::vector<std::future<size_t>> returns( parallelThreadCount );
238 
239  auto conn_lambda = [&nextItem, &dirtyItems]
240  ( CN_LIST* aItemList, PROGRESS_REPORTER* aReporter) -> size_t
241  {
242  for( size_t i = nextItem++; i < dirtyItems.size(); i = nextItem++ )
243  {
244  CN_VISITOR visitor( dirtyItems[i] );
245  aItemList->FindNearby( dirtyItems[i], visitor );
246 
247  if( aReporter )
248  aReporter->AdvanceProgress();
249  }
250 
251  return 1;
252  };
253 
254  if( parallelThreadCount <= 1 )
255  conn_lambda( &m_itemList, m_progressReporter );
256  else
257  {
258  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
259  returns[ii] = std::async( std::launch::async, conn_lambda,
261 
262  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
263  {
264  // Here we balance returns with a 100ms timeout to allow UI updating
265  std::future_status status;
266  do
267  {
268  if( m_progressReporter )
270 
271  status = returns[ii].wait_for( std::chrono::milliseconds( 100 ) );
272  } while( status != std::future_status::ready );
273  }
274  }
275 
276  if( m_progressReporter )
278  }
279 
280 #ifdef PROFILE
281  search_basic.Show();
282 #endif
283 
285 
286 #ifdef CONNECTIVITY_DEBUG
287  printf("Search end\n");
288 #endif
289 
290 }
291 
292 
294 {
295  constexpr KICAD_T types[] =
297  constexpr KICAD_T no_zones[] =
299 
300  if( aMode == CSM_PROPAGATE )
301  return SearchClusters( aMode, no_zones, -1 );
302  else
303  return SearchClusters( aMode, types, -1 );
304 }
305 
306 
308  const KICAD_T aTypes[], int aSingleNet )
309 {
310  bool withinAnyNet = ( aMode != CSM_PROPAGATE );
311 
312  std::deque<CN_ITEM*> Q;
313  std::set<CN_ITEM*> item_set;
314 
315  CLUSTERS clusters;
316 
317  if( m_itemList.IsDirty() )
319 
320  auto addToSearchList = [&item_set, withinAnyNet, aSingleNet, aTypes] ( CN_ITEM *aItem )
321  {
322  if( withinAnyNet && aItem->Net() <= 0 )
323  return;
324 
325  if( !aItem->Valid() )
326  return;
327 
328  if( aSingleNet >=0 && aItem->Net() != aSingleNet )
329  return;
330 
331  bool found = false;
332 
333  for( int i = 0; aTypes[i] != EOT; i++ )
334  {
335  if( aItem->Parent()->Type() == aTypes[i] )
336  {
337  found = true;
338  break;
339  }
340  }
341 
342  if( !found )
343  return;
344 
345  aItem->SetVisited( false );
346 
347  item_set.insert( aItem );
348  };
349 
350  std::for_each( m_itemList.begin(), m_itemList.end(), addToSearchList );
351 
352  while( !item_set.empty() )
353  {
354  CN_CLUSTER_PTR cluster ( new CN_CLUSTER() );
355  CN_ITEM* root;
356  auto it = item_set.begin();
357 
358  while( it != item_set.end() && (*it)->Visited() )
359  it = item_set.erase( item_set.begin() );
360 
361  if( it == item_set.end() )
362  break;
363 
364  root = *it;
365  root->SetVisited ( true );
366 
367  Q.clear();
368  Q.push_back( root );
369 
370  while( Q.size() )
371  {
372  CN_ITEM* current = Q.front();
373 
374  Q.pop_front();
375  cluster->Add( current );
376 
377  for( auto n : current->ConnectedItems() )
378  {
379  if( withinAnyNet && n->Net() != root->Net() )
380  continue;
381 
382  if( !n->Visited() && n->Valid() )
383  {
384  n->SetVisited( true );
385  Q.push_back( n );
386  }
387  }
388  }
389 
390  clusters.push_back( cluster );
391  }
392 
393 
394  std::sort( clusters.begin(), clusters.end(), []( CN_CLUSTER_PTR a, CN_CLUSTER_PTR b ) {
395  return a->OriginNet() < b->OriginNet();
396  } );
397 
398 #ifdef CONNECTIVITY_DEBUG
399  printf("Active clusters: %d\n", clusters.size() );
400 
401  for( auto cl : clusters )
402  {
403  printf( "Net %d\n", cl->OriginNet() );
404  cl->Dump();
405  }
406 #endif
407 
408  return clusters;
409 }
410 
411 
413 {
414  for( int i = 0; i<aBoard->GetAreaCount(); i++ )
415  {
416  auto zone = aBoard->GetArea( i );
417  Add( zone );
418  }
419 
420  for( auto tv : aBoard->Tracks() )
421  Add( tv );
422 
423  for( auto mod : aBoard->Modules() )
424  {
425  for( auto pad : mod->Pads() )
426  Add( pad );
427  }
428 
429  /*wxLogTrace( "CN", "zones : %lu, pads : %lu vias : %lu tracks : %lu\n",
430  m_zoneList.Size(), m_padList.Size(),
431  m_viaList.Size(), m_trackList.Size() );*/
432 }
433 
434 
435 void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
436 {
437  for( auto item : aItems )
438  {
439  switch( item->Type() )
440  {
441  case PCB_TRACE_T:
442  case PCB_ARC_T:
443  case PCB_VIA_T:
444  case PCB_PAD_T:
445  Add( item );
446  break;
447 
448  case PCB_MODULE_T:
449  {
450  for( auto pad : static_cast<MODULE*>( item )->Pads() )
451  {
452  Add( pad );
453  }
454 
455  break;
456  }
457 
458  default:
459  break;
460  }
461  }
462 }
463 
464 
466 {
467  for( const auto& cluster : m_connClusters )
468  {
469  if( cluster->IsConflicting() )
470  {
471  wxLogTrace( "CN", "Conflicting nets in cluster %p\n", cluster.get() );
472  }
473  else if( cluster->IsOrphaned() )
474  {
475  wxLogTrace( "CN", "Skipping orphaned cluster %p [net: %s]\n", cluster.get(),
476  (const char*) cluster->OriginNetName().c_str() );
477  }
478  else if( cluster->HasValidNet() )
479  {
480  // normal cluster: just propagate from the pads
481  int n_changed = 0;
482 
483  for( auto item : *cluster )
484  {
485  if( item->CanChangeNet() )
486  {
487  if( item->Valid() && item->Parent()->GetNetCode() != cluster->OriginNet() )
488  {
489  MarkNetAsDirty( item->Parent()->GetNetCode() );
490  MarkNetAsDirty( cluster->OriginNet() );
491 
492  if( aCommit )
493  aCommit->Modify( item->Parent() );
494 
495  item->Parent()->SetNetCode( cluster->OriginNet() );
496  n_changed++;
497  }
498  }
499  }
500 
501  if( n_changed )
502  {
503  wxLogTrace( "CN", "Cluster %p : net : %d %s\n", cluster.get(),
504  cluster->OriginNet(), (const char*) cluster->OriginNetName().c_str() );
505  }
506  else
507  wxLogTrace( "CN", "Cluster %p : nothing to propagate\n", cluster.get() );
508  }
509  else
510  {
511  wxLogTrace( "CN", "Cluster %p : connected to unused net\n", cluster.get() );
512  }
513  }
514 }
515 
516 
518 {
520  propagateConnections( aCommit );
521 }
522 
523 
525  PCB_LAYER_ID aLayer,
526  std::vector<int>& aIslands )
527 {
528  if( aZone->GetFilledPolysList( aLayer ).IsEmpty() )
529  return;
530 
531  aIslands.clear();
532 
533  Remove( aZone );
534  Add( aZone );
535 
537 
538  for( const auto& cluster : m_connClusters )
539  {
540  if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
541  {
542  for( auto z : *cluster )
543  {
544  if( z->Parent() == aZone && z->Layer() == aLayer )
545  {
546  aIslands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
547  }
548  }
549  }
550  }
551 
552  wxLogTrace( "CN", "Found %u isolated islands\n", (unsigned)aIslands.size() );
553 }
554 
555 void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
556 {
557  for( auto& z : aZones )
558  {
559  Remove( z.m_zone );
560  Add( z.m_zone );
561  }
562 
564 
565  for( auto& zone : aZones )
566  {
567  for( PCB_LAYER_ID layer : zone.m_zone->GetLayerSet().Seq() )
568  {
569  if( zone.m_zone->GetFilledPolysList( layer ).IsEmpty() )
570  continue;
571 
572  for( const auto& cluster : m_connClusters )
573  {
574  if( cluster->Contains( zone.m_zone ) && cluster->IsOrphaned() )
575  {
576  for( auto z : *cluster )
577  {
578  if( z->Parent() == zone.m_zone && z->Layer() == layer )
579  {
580  zone.m_islands[layer].push_back(
581  static_cast<CN_ZONE*>( z )->SubpolyIndex() );
582  }
583  }
584  }
585  }
586  }
587  }
588 }
589 
590 
592 {
594  return m_ratsnestClusters;
595 }
596 
597 
599 {
600  if( aNet < 0 )
601  return;
602 
603  if( (int) m_dirtyNets.size() <= aNet )
604  {
605  int lastNet = m_dirtyNets.size() - 1;
606 
607  if( lastNet < 0 )
608  lastNet = 0;
609 
610  m_dirtyNets.resize( aNet + 1 );
611 
612  for( int i = lastNet; i < aNet + 1; i++ )
613  m_dirtyNets[i] = true;
614  }
615 
616  m_dirtyNets[aNet] = true;
617 }
618 
619 
621 {
622  if( aZone->Net() != aItem->Net() && !aItem->CanChangeNet() )
623  return;
624 
625  if( !aZone->BBox().Intersects( aItem->BBox() ) )
626  return;
627 
628  CN_ZONE* zoneItem = static_cast<CN_ZONE*> ( aZone );
629  int accuracy = 0;
630 
631  if( aItem->Valid() && aItem->Parent()->Type() == PCB_VIA_T )
632  accuracy = ( static_cast<VIA*>( aItem->Parent() )->GetWidth() + 1 ) / 2;
633 
634  for( int i = 0; i < aItem->AnchorCount(); ++i )
635  {
636  if( zoneItem->ContainsPoint( aItem->GetAnchor( i ), accuracy ) )
637  {
638  zoneItem->Connect( aItem );
639  aItem->Connect( zoneItem );
640  return;
641  }
642  }
643 }
644 
646 {
647  const auto parentA = static_cast<const ZONE_CONTAINER*>( aZoneA->Parent() );
648  const auto parentB = static_cast<const ZONE_CONTAINER*>( aZoneB->Parent() );
649 
650  if( aZoneB == aZoneA || parentA == parentB )
651  return;
652 
653  if( aZoneA->Layer() != aZoneB->Layer() )
654  return;
655 
656  if( aZoneB->Net() != aZoneA->Net() )
657  return; // we only test zones belonging to the same net
658 
659  const BOX2I& boxA = aZoneA->BBox();
660  const BOX2I& boxB = aZoneB->BBox();
661 
662  int radiusA = 0;
663  int radiusB = 0;
664 
665  if( parentA->GetFilledPolysUseThickness() )
666  radiusA = ( parentA->GetMinThickness() + 1 ) / 2;
667 
668  if( parentB->GetFilledPolysUseThickness() )
669  radiusB = ( parentB->GetMinThickness() + 1 ) / 2;
670 
671  PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aZoneA->Layer() );
672 
673  const auto& outline = parentA->GetFilledPolysList( layer ).COutline( aZoneA->SubpolyIndex() );
674 
675  for( int i = 0; i < outline.PointCount(); i++ )
676  {
677  if( !boxB.Contains( outline.CPoint( i ) ) )
678  continue;
679 
680  if( aZoneB->ContainsPoint( outline.CPoint( i ), radiusA ) )
681  {
682  aZoneA->Connect( aZoneB );
683  aZoneB->Connect( aZoneA );
684  return;
685  }
686  }
687 
688  const auto& outline2 =
689  parentB->GetFilledPolysList( layer ).COutline( aZoneB->SubpolyIndex() );
690 
691  for( int i = 0; i < outline2.PointCount(); i++ )
692  {
693  if( !boxA.Contains( outline2.CPoint( i ) ) )
694  continue;
695 
696  if( aZoneA->ContainsPoint( outline2.CPoint( i ), radiusB ) )
697  {
698  aZoneA->Connect( aZoneB );
699  aZoneB->Connect( aZoneA );
700  return;
701  }
702  }
703 }
704 
705 
706 bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
707 {
708  const BOARD_CONNECTED_ITEM* parentA = aCandidate->Parent();
709  const BOARD_CONNECTED_ITEM* parentB = m_item->Parent();
710 
711  if( !aCandidate->Valid() || !m_item->Valid() )
712  return true;
713 
714  if( parentA == parentB )
715  return true;
716 
717  if( !( parentA->GetLayerSet() & parentB->GetLayerSet() ).any() )
718  return true;
719 
720  // If both m_item and aCandidate are marked dirty, they will both be searched
721  // Since we are reciprocal in our connection, we arbitrarily pick one of the connections
722  // to conduct the expensive search
723  if( aCandidate->Dirty() && aCandidate < m_item )
724  return true;
725 
726  // We should handle zone-zone connection separately
727  if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
728  {
729  checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ),
730  static_cast<CN_ZONE*>( aCandidate ) );
731  return true;
732  }
733 
734  if( parentA->Type() == PCB_ZONE_AREA_T )
735  {
736  checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item );
737  return true;
738  }
739 
740  if( parentB->Type() == PCB_ZONE_AREA_T )
741  {
742  checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate );
743  return true;
744  }
745 
746  // Items do not necessarily have reciprocity as we only check for anchors
747  // therefore, we check HitTest both directions A->B & B->A
748  for( int i = 0; i < aCandidate->AnchorCount(); ++i )
749  {
750  if( parentB->HitTest( wxPoint( aCandidate->GetAnchor( i ) ) ) )
751  {
752  m_item->Connect( aCandidate );
753  aCandidate->Connect( m_item );
754  return true;
755  }
756  }
757 
758  for( int i = 0; i < m_item->AnchorCount(); ++i )
759  {
760  if( parentA->HitTest( wxPoint( m_item->GetAnchor( i ) ) ) )
761  {
762  m_item->Connect( aCandidate );
763  aCandidate->Connect( m_item );
764  return true;
765  }
766  }
767 
768  return true;
769 };
770 
771 
773 {
774  m_ratsnestClusters.clear();
775  m_connClusters.clear();
776  m_itemMap.clear();
777  m_itemList.Clear();
778 
779 }
780 
782 {
783  m_progressReporter = aReporter;
784 }
void RemoveInvalidItems(std::vector< CN_ITEM * > &aGarbage)
const CONNECTED_ITEMS & ConnectedItems() const
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
void propagateConnections(BOARD_COMMIT *aCommit=nullptr)
bool Remove(BOARD_ITEM *aItem)
void SetHasInvalid(bool aInvalid=true)
void PropagateNets(BOARD_COMMIT *aCommit=nullptr)
Propagates nets from pads to other items in clusters.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
int SubpolyIndex() const
A progress reporter for use in multi-threaded environments.
void checkZoneItemConnection(CN_ZONE *aZone, CN_ITEM *aItem)
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
CN_ITEM * Add(D_PAD *pad)
void ClearDirtyFlags()
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
const BOX2I & BBox()
const SHAPE_POLY_SET & GetFilledPolysList(PCB_LAYER_ID aLayer) const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:605
void SetVisited(bool aVisited)
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
bool IsDirty() const
void MarkNetAsDirty(int aNet)
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
bool Add(BOARD_ITEM *aItem)
bool Dirty() const
BOARD_CONNECTED_ITEM * Parent() const
void add(Container &c, BItem brditem)
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:44
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
void SetDirty(bool aDirty=true)
int Net() const
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
std::vector< bool > m_dirtyNets
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
virtual int AnchorCount() const
const CLUSTERS SearchClusters(CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], int aSingleNet)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: base_struct.h:307
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:236
class MODULE, a footprint
Definition: typeinfo.h:89
PCB_LAYER_ID
A quick note on layer IDs:
void markItemNetAsDirty(const BOARD_ITEM *aItem)
void FindIsolatedCopperIslands(ZONE_CONTAINER *aZone, PCB_LAYER_ID aLayer, std::vector< int > &aIslands)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:958
MODULES & Modules()
Definition: class_board.h:273
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:151
a few functions useful in geometry calculations.
virtual const VECTOR2I GetAnchor(int n) const
void Build(BOARD *aBoard)
bool CanChangeNet() const
bool operator()(CN_ITEM *aCandidate)
const CLUSTERS & GetClusters()
void checkZoneZoneConnection(CN_ZONE *aZoneA, CN_ZONE *aZoneB)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:184
Struct CN_VISTOR.
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
bool KeepRefreshing(bool aWait=false)
Update the UI dialog.
bool ContainsPoint(const VECTOR2I p, int aAccuracy=0) const
std::shared_ptr< CN_CLUSTER > CN_CLUSTER_PTR
virtual int Layer() const
Function Layer()
virtual bool IsConnected() const
Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.
void Connect(CN_ITEM *b)
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void Show(std::ostream &aStream=std::cerr)
Print the elapsed time (in a suitable unit) to a stream.
Definition: profile.h:99
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:923
CN_ITEM * m_item
the item we are looking for connections to
void SetMaxProgress(int aMaxProgress)
Fix the value thar gives the 100 precent progress bar length (inside the current virtual zone)
std::vector< CN_CLUSTER_PTR > CLUSTERS
TRACKS & Tracks()
Definition: class_board.h:264
virtual bool IsOnCopperLayer() const
std::unordered_map< const BOARD_ITEM *, ITEM_MAP_ENTRY > m_itemMap
const BOX2I & BBox()
virtual LSET GetLayerSet() const
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
bool Valid() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
PROGRESS_REPORTER * m_progressReporter