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[ static_cast<BOARD_CONNECTED_ITEM*>( pad ) ].MarkItemsAsInvalid();
50  m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( pad ) );
51  }
52 
53  m_itemList.SetDirty( true );
54  break;
55 
56  case PCB_PAD_T:
57  m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
58  m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
59  m_itemList.SetDirty( true );
60  break;
61 
62  case PCB_TRACE_T:
63  m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
64  m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
65  m_itemList.SetDirty( true );
66  break;
67 
68  case PCB_VIA_T:
69  m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
70  m_itemMap.erase( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
71  m_itemList.SetDirty( true );
72  break;
73 
74  case PCB_ZONE_AREA_T:
75  {
76  m_itemMap[ static_cast<BOARD_CONNECTED_ITEM*>( aItem ) ].MarkItemsAsInvalid();
77  m_itemMap.erase ( static_cast<BOARD_CONNECTED_ITEM*>( aItem ) );
78  m_itemList.SetDirty( true );
79  break;
80  }
81 
82  default:
83  return false;
84  }
85 
86  // Once we delete an item, it may connect between lists, so mark both as potentially invalid
87  m_itemList.SetHasInvalid( true );
88 
89  return true;
90 }
91 
92 
94 {
95  if( aItem->IsConnected() )
96  {
97  auto citem = static_cast<const BOARD_CONNECTED_ITEM*>( aItem );
98  MarkNetAsDirty( citem->GetNetCode() );
99  }
100  else
101  {
102  if( aItem->Type() == PCB_MODULE_T )
103  {
104  auto mod = static_cast <const MODULE*>( aItem );
105 
106  for( auto pad : mod->Pads() )
107  MarkNetAsDirty( pad->GetNetCode() );
108  }
109  }
110 }
111 
112 
114 {
115  if( !aItem->IsOnCopperLayer() )
116  return false;
117 
118  markItemNetAsDirty ( aItem );
119 
120  switch( aItem->Type() )
121  {
122  case PCB_NETINFO_T:
123  {
124  MarkNetAsDirty( static_cast<NETINFO_ITEM*>( aItem )->GetNet() );
125  break;
126  }
127  case PCB_MODULE_T:
128  for( auto pad : static_cast<MODULE*>( aItem ) -> Pads() )
129  {
130  if( m_itemMap.find( pad ) != m_itemMap.end() )
131  return false;
132 
133  add( m_itemList, pad );
134  }
135 
136  break;
137 
138  case PCB_PAD_T:
139  if( m_itemMap.find ( static_cast<D_PAD*>( aItem ) ) != m_itemMap.end() )
140  return false;
141 
142  add( m_itemList, static_cast<D_PAD*>( aItem ) );
143 
144  break;
145 
146  case PCB_TRACE_T:
147  {
148  if( m_itemMap.find( static_cast<TRACK*>( aItem ) ) != m_itemMap.end() )
149  return false;
150 
151  add( m_itemList, static_cast<TRACK*>( aItem ) );
152 
153  break;
154  }
155 
156  case PCB_VIA_T:
157  if( m_itemMap.find( static_cast<VIA*>( aItem ) ) != m_itemMap.end() )
158  return false;
159 
160  add( m_itemList, static_cast<VIA*>( aItem ) );
161 
162  break;
163 
164  case PCB_ZONE_AREA_T:
165  {
166  auto zone = static_cast<ZONE_CONTAINER*>( aItem );
167 
168  if( m_itemMap.find( static_cast<ZONE_CONTAINER*>( aItem ) ) != m_itemMap.end() )
169  return false;
170 
171  m_itemMap[zone] = ITEM_MAP_ENTRY();
172 
173  for( auto zitem : m_itemList.Add( zone ) )
174  m_itemMap[zone].Link(zitem);
175 
176  break;
177  }
178 
179  default:
180  return false;
181  }
182 
183  return true;
184 }
185 
186 
188 {
189 #ifdef CONNECTIVITY_DEBUG
190  printf("Search start\n");
191 #endif
192 
193 #ifdef PROFILE
194  PROF_COUNTER garbage_collection( "garbage-collection" );
195 #endif
196  std::vector<CN_ITEM*> garbage;
197  garbage.reserve( 1024 );
198 
199  m_itemList.RemoveInvalidItems( garbage );
200 
201  for( auto item : garbage )
202  delete item;
203 
204 #ifdef PROFILE
205  garbage_collection.Show();
206  PROF_COUNTER search_basic( "search-basic" );
207 #endif
208 
209  std::vector<CN_ITEM*> dirtyItems;
210  std::copy_if( m_itemList.begin(), m_itemList.end(), std::back_inserter( dirtyItems ),
211  [] ( CN_ITEM* aItem ) { return aItem->Dirty(); } );
212 
213  if( m_progressReporter )
214  {
215  m_progressReporter->SetMaxProgress( dirtyItems.size() );
217  }
218 
219  if( m_itemList.IsDirty() )
220  {
221  size_t parallelThreadCount = std::min<size_t>( std::thread::hardware_concurrency(),
222  ( dirtyItems.size() + 7 ) / 8 );
223 
224  std::atomic<size_t> nextItem( 0 );
225  std::vector<std::future<size_t>> returns( parallelThreadCount );
226 
227  auto conn_lambda = [&nextItem, &dirtyItems]
228  ( CN_LIST* aItemList, PROGRESS_REPORTER* aReporter) -> size_t
229  {
230  for( size_t i = nextItem++; i < dirtyItems.size(); i = nextItem++ )
231  {
232  CN_VISITOR visitor( dirtyItems[i] );
233  aItemList->FindNearby( dirtyItems[i], visitor );
234 
235  if( aReporter )
236  aReporter->AdvanceProgress();
237  }
238 
239  return 1;
240  };
241 
242  if( parallelThreadCount <= 1 )
243  conn_lambda( &m_itemList, m_progressReporter );
244  else
245  {
246  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
247  returns[ii] = std::async( std::launch::async, conn_lambda,
249 
250  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
251  {
252  // Here we balance returns with a 100ms timeout to allow UI updating
253  std::future_status status;
254  do
255  {
256  if( m_progressReporter )
258 
259  status = returns[ii].wait_for( std::chrono::milliseconds( 100 ) );
260  } while( status != std::future_status::ready );
261  }
262  }
263 
264  if( m_progressReporter )
266  }
267 
268 #ifdef PROFILE
269  search_basic.Show();
270 #endif
271 
273 
274 #ifdef CONNECTIVITY_DEBUG
275  printf("Search end\n");
276 #endif
277 
278 }
279 
280 
282 {
284  constexpr KICAD_T no_zones[] = { PCB_TRACE_T, PCB_PAD_T, PCB_VIA_T, PCB_MODULE_T, EOT };
285 
286  if( aMode == CSM_PROPAGATE )
287  return SearchClusters( aMode, no_zones, -1 );
288  else
289  return SearchClusters( aMode, types, -1 );
290 }
291 
292 
294  const KICAD_T aTypes[], int aSingleNet )
295 {
296  bool withinAnyNet = ( aMode != CSM_PROPAGATE );
297 
298  std::deque<CN_ITEM*> Q;
299  CN_ITEM* head = nullptr;
300  CLUSTERS clusters;
301 
302  if( m_itemList.IsDirty() )
304 
305  auto addToSearchList = [&head, withinAnyNet, aSingleNet, aTypes] ( CN_ITEM *aItem )
306  {
307  if( withinAnyNet && aItem->Net() <= 0 )
308  return;
309 
310  if( !aItem->Valid() )
311  return;
312 
313  if( aSingleNet >=0 && aItem->Net() != aSingleNet )
314  return;
315 
316  bool found = false;
317 
318  for( int i = 0; aTypes[i] != EOT; i++ )
319  {
320  if( aItem->Parent()->Type() == aTypes[i] )
321  {
322  found = true;
323  break;
324  }
325  }
326 
327  if( !found )
328  return;
329 
330  aItem->ListClear();
331  aItem->SetVisited( false );
332 
333  if( !head )
334  head = aItem;
335  else
336  head->ListInsert( aItem );
337  };
338 
339  std::for_each( m_itemList.begin(), m_itemList.end(), addToSearchList );
340 
341  while( head )
342  {
343  CN_CLUSTER_PTR cluster ( new CN_CLUSTER() );
344 
345  Q.clear();
346  CN_ITEM* root = head;
347  root->SetVisited ( true );
348 
349  head = root->ListRemove();
350 
351  Q.push_back( root );
352 
353  while( Q.size() )
354  {
355  CN_ITEM* current = Q.front();
356 
357  Q.pop_front();
358  cluster->Add( current );
359 
360  for( auto n : current->ConnectedItems() )
361  {
362  if( withinAnyNet && n->Net() != root->Net() )
363  continue;
364 
365  if( !n->Visited() && n->Valid() )
366  {
367  n->SetVisited( true );
368  Q.push_back( n );
369  head = n->ListRemove();
370  }
371  }
372  }
373 
374  clusters.push_back( cluster );
375  }
376 
377 
378  std::sort( clusters.begin(), clusters.end(), []( CN_CLUSTER_PTR a, CN_CLUSTER_PTR b ) {
379  return a->OriginNet() < b->OriginNet();
380  } );
381 
382 #ifdef CONNECTIVITY_DEBUG
383  printf("Active clusters: %d\n", clusters.size() );
384 
385  for( auto cl : clusters )
386  {
387  printf( "Net %d\n", cl->OriginNet() );
388  cl->Dump();
389  }
390 #endif
391 
392  return clusters;
393 }
394 
395 
397 {
398  for( int i = 0; i<aBoard->GetAreaCount(); i++ )
399  {
400  auto zone = aBoard->GetArea( i );
401  Add( zone );
402  }
403 
404  for( auto tv : aBoard->Tracks() )
405  Add( tv );
406 
407  for( auto mod : aBoard->Modules() )
408  {
409  for( auto pad : mod->Pads() )
410  Add( pad );
411  }
412 
413  /*wxLogTrace( "CN", "zones : %lu, pads : %lu vias : %lu tracks : %lu\n",
414  m_zoneList.Size(), m_padList.Size(),
415  m_viaList.Size(), m_trackList.Size() );*/
416 }
417 
418 
419 void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
420 {
421  for( auto item : aItems )
422  {
423  switch( item->Type() )
424  {
425  case PCB_TRACE_T:
426  case PCB_VIA_T:
427  case PCB_PAD_T:
428  Add( item );
429  break;
430 
431  case PCB_MODULE_T:
432  {
433  for( auto pad : static_cast<MODULE*>( item )->Pads() )
434  {
435  Add( pad );
436  }
437 
438  break;
439  }
440 
441  default:
442  break;
443  }
444  }
445 }
446 
447 
449 {
450  for( const auto& cluster : m_connClusters )
451  {
452  if( cluster->IsConflicting() )
453  {
454  wxLogTrace( "CN", "Conflicting nets in cluster %p\n", cluster.get() );
455  }
456  else if( cluster->IsOrphaned() )
457  {
458  wxLogTrace( "CN", "Skipping orphaned cluster %p [net: %s]\n", cluster.get(),
459  (const char*) cluster->OriginNetName().c_str() );
460  }
461  else if( cluster->HasValidNet() )
462  {
463  // normal cluster: just propagate from the pads
464  int n_changed = 0;
465 
466  for( auto item : *cluster )
467  {
468  if( item->CanChangeNet() )
469  {
470  if( item->Valid() && item->Parent()->GetNetCode() != cluster->OriginNet() )
471  {
472  MarkNetAsDirty( item->Parent()->GetNetCode() );
473  MarkNetAsDirty( cluster->OriginNet() );
474 
475  if( aCommit )
476  aCommit->Modify( item->Parent() );
477 
478  item->Parent()->SetNetCode( cluster->OriginNet() );
479  n_changed++;
480  }
481  }
482  }
483 
484  if( n_changed )
485  {
486  wxLogTrace( "CN", "Cluster %p : net : %d %s\n", cluster.get(),
487  cluster->OriginNet(), (const char*) cluster->OriginNetName().c_str() );
488  }
489  else
490  wxLogTrace( "CN", "Cluster %p : nothing to propagate\n", cluster.get() );
491  }
492  else
493  {
494  wxLogTrace( "CN", "Cluster %p : connected to unused net\n", cluster.get() );
495  }
496  }
497 }
498 
499 
501 {
503  propagateConnections( aCommit );
504 }
505 
506 
507 void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands )
508 {
509  if( aZone->GetFilledPolysList().IsEmpty() )
510  return;
511 
512  aIslands.clear();
513 
514  Remove( aZone );
515  Add( aZone );
516 
518 
519  for( const auto& cluster : m_connClusters )
520  {
521  if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
522  {
523  for( auto z : *cluster )
524  {
525  if( z->Parent() == aZone )
526  {
527  aIslands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
528  }
529  }
530  }
531  }
532 
533  wxLogTrace( "CN", "Found %u isolated islands\n", (unsigned)aIslands.size() );
534 }
535 
536 void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
537 {
538  for ( auto& z : aZones )
539  Remove( z.m_zone );
540 
541  for ( auto& z : aZones )
542  {
543  if( !z.m_zone->GetFilledPolysList().IsEmpty() )
544  Add( z.m_zone );
545  }
546 
548 
549  for ( auto& zone : aZones )
550  {
551  if( zone.m_zone->GetFilledPolysList().IsEmpty() )
552  continue;
553 
554  for( const auto& cluster : m_connClusters )
555  {
556  if( cluster->Contains( zone.m_zone ) && cluster->IsOrphaned() )
557  {
558  for( auto z : *cluster )
559  {
560  if( z->Parent() == zone.m_zone )
561  {
562  zone.m_islands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
563  }
564  }
565  }
566  }
567  }
568 }
569 
570 
572 {
574  return m_ratsnestClusters;
575 }
576 
577 
579 {
580  if( aNet < 0 )
581  return;
582 
583  if( (int) m_dirtyNets.size() <= aNet )
584  {
585  int lastNet = m_dirtyNets.size() - 1;
586 
587  if( lastNet < 0 )
588  lastNet = 0;
589 
590  m_dirtyNets.resize( aNet + 1 );
591 
592  for( int i = lastNet; i < aNet + 1; i++ )
593  m_dirtyNets[i] = true;
594  }
595 
596  m_dirtyNets[aNet] = true;
597 }
598 
599 
601 {
602  if( aZone->Net() != aItem->Net() && !aItem->CanChangeNet() )
603  return;
604 
605  if( !aZone->BBox().Intersects( aItem->BBox() ) )
606  return;
607 
608  auto zoneItem = static_cast<CN_ZONE*> ( aZone );
609 
610  for( int i = 0; i < aItem->AnchorCount(); ++i )
611  {
612  if( zoneItem->ContainsPoint( aItem->GetAnchor( i ) ) )
613  {
614  zoneItem->Connect( aItem );
615  aItem->Connect( zoneItem );
616  return;
617  }
618  }
619 }
620 
622 {
623  const auto refParent = static_cast<const ZONE_CONTAINER*>( aZoneA->Parent() );
624  const auto testedParent = static_cast<const ZONE_CONTAINER*>( aZoneB->Parent() );
625 
626  if( testedParent->Type () != PCB_ZONE_AREA_T )
627  return;
628 
629  if( aZoneB == aZoneA || refParent == testedParent )
630  return;
631 
632  if( aZoneB->Net() != aZoneA->Net() )
633  return; // we only test zones belonging to the same net
634 
635  const auto& outline = refParent->GetFilledPolysList().COutline( aZoneA->SubpolyIndex() );
636 
637  for( int i = 0; i < outline.PointCount(); i++ )
638  {
639  if( aZoneB->ContainsPoint( outline.CPoint( i ) ) )
640  {
641  aZoneA->Connect( aZoneB );
642  aZoneB->Connect( aZoneA );
643  return;
644  }
645  }
646 
647  const auto& outline2 = testedParent->GetFilledPolysList().COutline( aZoneB->SubpolyIndex() );
648 
649  for( int i = 0; i < outline2.PointCount(); i++ )
650  {
651  if( aZoneA->ContainsPoint( outline2.CPoint( i ) ) )
652  {
653  aZoneA->Connect( aZoneB );
654  aZoneB->Connect( aZoneA );
655  return;
656  }
657  }
658 }
659 
660 
661 bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
662 {
663  const auto parentA = aCandidate->Parent();
664  const auto parentB = m_item->Parent();
665 
666  if( !aCandidate->Valid() || !m_item->Valid() )
667  return true;
668 
669  if( parentA == parentB )
670  return true;
671 
672  if( !( parentA->GetLayerSet() & parentB->GetLayerSet() ).any() )
673  return true;
674 
675  // If both m_item and aCandidate are marked dirty, they will both be searched
676  // Since we are reciprocal in our connection, we arbitrarily pick one of the connections
677  // to conduct the expensive search
678  if( aCandidate->Dirty() && aCandidate < m_item )
679  return true;
680 
681  // We should handle zone-zone connection separately
682  if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
683  {
684  checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ),
685  static_cast<CN_ZONE*>( aCandidate ) );
686  return true;
687  }
688 
689  if( parentA->Type() == PCB_ZONE_AREA_T )
690  {
691  checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item );
692  return true;
693  }
694 
695  if( parentB->Type() == PCB_ZONE_AREA_T )
696  {
697  checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate );
698  return true;
699  }
700 
701  // Items do not necessarily have reciprocity as we only check for anchors
702  // therefore, we check HitTest both directions A->B & B->A
703  for( int i = 0; i < aCandidate->AnchorCount(); ++i )
704  {
705  if( parentB->HitTest( wxPoint( aCandidate->GetAnchor( i ) ) ) )
706  {
707  m_item->Connect( aCandidate );
708  aCandidate->Connect( m_item );
709  return true;
710  }
711  }
712 
713  for( int i = 0; i < m_item->AnchorCount(); ++i )
714  {
715  if( parentA->HitTest( wxPoint( m_item->GetAnchor( i ) ) ) )
716  {
717  m_item->Connect( aCandidate );
718  aCandidate->Connect( m_item );
719  return true;
720  }
721  }
722 
723  return true;
724 };
725 
726 
728 {
729  m_ratsnestClusters.clear();
730  m_connClusters.clear();
731  m_itemMap.clear();
732  m_itemList.Clear();
733 
734 }
735 
736 
737 void CN_CONNECTIVITY_ALGO::ForEachItem( const std::function<void( CN_ITEM& )>& aFunc )
738 {
739  for( auto item : m_itemList )
740  aFunc( *item );
741 }
742 
743 
744 void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc )
745 {
746  ForEachItem( [aFunc] ( CN_ITEM& item ) {
747  for( const auto& anchor : item.Anchors() )
748  aFunc( *anchor );
749  }
750  );
751 }
752 
753 
755 {
756  m_progressReporter = aReporter;
757 }
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:60
void ListInsert(T *item)
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:101
void ForEachAnchor(const std::function< void(CN_ANCHOR &)> &aFunc)
const BOX2I & BBox()
void SetVisited(bool aVisited)
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)
CN_ANCHORS & Anchors()
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:44
std::unordered_map< const BOARD_CONNECTED_ITEM *, ITEM_MAP_ENTRY > m_itemMap
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)
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:235
class MODULE, a footprint
Definition: typeinfo.h:89
void markItemNetAsDirty(const BOARD_ITEM *aItem)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:948
MODULES & Modules()
Definition: class_board.h:226
void ForEachItem(const std::function< void(CN_ITEM &)> &aFunc)
a few functions useful in geometry calculations.
bool ContainsPoint(const VECTOR2I p) const
virtual const VECTOR2I GetAnchor(int n) const
void FindIsolatedCopperIslands(ZONE_CONTAINER *aZone, std::vector< int > &aIslands)
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:160
Struct CN_VISTOR.
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:103
bool KeepRefreshing(bool aWait=false)
Update the UI dialog.
std::shared_ptr< CN_CLUSTER > CN_CLUSTER_PTR
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:913
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:217
virtual bool IsOnCopperLayer() const
const BOX2I & BBox()
bool Valid() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:553
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
PROGRESS_REPORTER * m_progressReporter