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  wxLogTrace( "CN", "Cluster %p : net : %d %s\n", cluster.get(),
486  cluster->OriginNet(), (const char*) cluster->OriginNetName().c_str() );
487  else
488  wxLogTrace( "CN", "Cluster %p : nothing to propagate\n", cluster.get() );
489  }
490  else
491  {
492  wxLogTrace( "CN", "Cluster %p : connected to unused net\n", cluster.get() );
493  }
494  }
495 }
496 
497 
499 {
501  propagateConnections( aCommit );
502 }
503 
504 
505 void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands )
506 {
507  if( aZone->GetFilledPolysList().IsEmpty() )
508  return;
509 
510  aIslands.clear();
511 
512  Remove( aZone );
513  Add( aZone );
514 
516 
517  for( const auto& cluster : m_connClusters )
518  {
519  if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
520  {
521  for( auto z : *cluster )
522  {
523  if( z->Parent() == aZone )
524  {
525  aIslands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
526  }
527  }
528  }
529  }
530 
531  wxLogTrace( "CN", "Found %u isolated islands\n", (unsigned)aIslands.size() );
532 }
533 
534 void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
535 {
536  for ( auto& z : aZones )
537  Remove( z.m_zone );
538 
539  for ( auto& z : aZones )
540  {
541  if( !z.m_zone->GetFilledPolysList().IsEmpty() )
542  Add( z.m_zone );
543  }
544 
546 
547  for ( auto& zone : aZones )
548  {
549  if( zone.m_zone->GetFilledPolysList().IsEmpty() )
550  continue;
551 
552  for( const auto& cluster : m_connClusters )
553  {
554  if( cluster->Contains( zone.m_zone ) && cluster->IsOrphaned() )
555  {
556  for( auto z : *cluster )
557  {
558  if( z->Parent() == zone.m_zone )
559  {
560  zone.m_islands.push_back( static_cast<CN_ZONE*>(z)->SubpolyIndex() );
561  }
562  }
563  }
564  }
565  }
566 }
567 
568 
570 {
572  return m_ratsnestClusters;
573 }
574 
575 
577 {
578  if( aNet < 0 )
579  return;
580 
581  if( (int) m_dirtyNets.size() <= aNet )
582  {
583  int lastNet = m_dirtyNets.size() - 1;
584 
585  if( lastNet < 0 )
586  lastNet = 0;
587 
588  m_dirtyNets.resize( aNet + 1 );
589 
590  for( int i = lastNet; i < aNet + 1; i++ )
591  m_dirtyNets[i] = true;
592  }
593 
594  m_dirtyNets[aNet] = true;
595 }
596 
597 
599 {
600  auto zoneItem = static_cast<CN_ZONE*> ( aZone );
601 
602  if( zoneItem->Net() != aItem->Net() && !aItem->CanChangeNet() )
603  return;
604 
605  if( zoneItem->ContainsPoint( aItem->GetAnchor( 0 ) ) ||
606  ( aItem->Parent()->Type() == PCB_TRACE_T &&
607  zoneItem->ContainsPoint( aItem->GetAnchor( 1 ) ) ) )
608  {
609  zoneItem->Connect( aItem );
610  aItem->Connect( zoneItem );
611  }
612 }
613 
615 {
616  const auto refParent = static_cast<const ZONE_CONTAINER*>( aZoneA->Parent() );
617  const auto testedParent = static_cast<const ZONE_CONTAINER*>( aZoneB->Parent() );
618 
619  if( testedParent->Type () != PCB_ZONE_AREA_T )
620  return;
621 
622  if( aZoneB == aZoneA || refParent == testedParent )
623  return;
624 
625  if( aZoneB->Net() != aZoneA->Net() )
626  return; // we only test zones belonging to the same net
627 
628  const auto& outline = refParent->GetFilledPolysList().COutline( aZoneA->SubpolyIndex() );
629 
630  for( int i = 0; i < outline.PointCount(); i++ )
631  {
632  if( aZoneB->ContainsPoint( outline.CPoint( i ) ) )
633  {
634  aZoneA->Connect( aZoneB );
635  aZoneB->Connect( aZoneA );
636  return;
637  }
638  }
639 
640  const auto& outline2 = testedParent->GetFilledPolysList().COutline( aZoneB->SubpolyIndex() );
641 
642  for( int i = 0; i < outline2.PointCount(); i++ )
643  {
644  if( aZoneA->ContainsPoint( outline2.CPoint( i ) ) )
645  {
646  aZoneA->Connect( aZoneB );
647  aZoneB->Connect( aZoneA );
648  return;
649  }
650  }
651 }
652 
653 
654 bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
655 {
656  const auto parentA = aCandidate->Parent();
657  const auto parentB = m_item->Parent();
658 
659  if( !aCandidate->Valid() || !m_item->Valid() )
660  return true;
661 
662  if( parentA == parentB )
663  return true;
664 
665  if( !( parentA->GetLayerSet() & parentB->GetLayerSet() ).any() )
666  return true;
667 
668  // If both m_item and aCandidate are marked dirty, they will both be searched
669  // Since we are reciprocal in our connection, we arbitrarily pick one of the connections
670  // to conduct the expensive search
671  if( aCandidate->Dirty() && aCandidate < m_item )
672  return true;
673 
674  // We should handle zone-zone connection separately
675  if ( parentA->Type() == PCB_ZONE_AREA_T && parentB->Type() == PCB_ZONE_AREA_T )
676  {
677  checkZoneZoneConnection( static_cast<CN_ZONE*>( m_item ),
678  static_cast<CN_ZONE*>( aCandidate ) );
679  return true;
680  }
681 
682  if( parentA->Type() == PCB_ZONE_AREA_T )
683  {
684  checkZoneItemConnection( static_cast<CN_ZONE*>( aCandidate ), m_item );
685  return true;
686  }
687 
688  if( parentB->Type() == PCB_ZONE_AREA_T )
689  {
690  checkZoneItemConnection( static_cast<CN_ZONE*>( m_item ), aCandidate );
691  return true;
692  }
693 
694  // Items do not necessarily have reciprocity as we only check for anchors
695  // therefore, we check HitTest both directions A->B & B->A
696  // TODO: Check for collision geometry on extended features
697  wxPoint ptA1( aCandidate->GetAnchor( 0 ).x, aCandidate->GetAnchor( 0 ).y );
698  wxPoint ptA2( aCandidate->GetAnchor( 1 ).x, aCandidate->GetAnchor( 1 ).y );
699  wxPoint ptB1( m_item->GetAnchor( 0 ).x, m_item->GetAnchor( 0 ).y );
700  wxPoint ptB2( m_item->GetAnchor( 1 ).x, m_item->GetAnchor( 1 ).y );
701  if( parentA->HitTest( ptB1 ) || parentB->HitTest( ptA1 ) ||
702  ( parentA->Type() == PCB_TRACE_T && parentB->HitTest( ptA2 ) ) ||
703  ( parentB->Type() == PCB_TRACE_T && parentA->HitTest( ptB2 ) ) )
704  {
705  m_item->Connect( aCandidate );
706  aCandidate->Connect( m_item );
707  }
708 
709  return true;
710 };
711 
712 
714 {
715  m_ratsnestClusters.clear();
716  m_connClusters.clear();
717  m_itemMap.clear();
718  m_itemList.Clear();
719 
720 }
721 
722 
723 void CN_CONNECTIVITY_ALGO::ForEachItem( const std::function<void( CN_ITEM& )>& aFunc )
724 {
725  for( auto item : m_itemList )
726  aFunc( *item );
727 }
728 
729 
730 void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc )
731 {
732  ForEachItem( [aFunc] ( CN_ITEM& item ) {
733  for( const auto& anchor : item.Anchors() )
734  aFunc( *anchor );
735  }
736  );
737 }
738 
739 
741 {
742  m_progressReporter = aReporter;
743 }
void RemoveInvalidItems(std::vector< CN_ITEM * > &aGarbage)
const CONNECTED_ITEMS & ConnectedItems() const
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:57
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.
Class 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:100
void ForEachAnchor(const std::function< void(CN_ANCHOR &)> &aFunc)
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:95
const CLUSTERS SearchClusters(CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], int aSingleNet)
class MODULE, a footprint
Definition: typeinfo.h:89
void markItemNetAsDirty(const BOARD_ITEM *aItem)
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:955
MODULES & Modules()
Definition: class_board.h:236
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)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
Struct CN_VISTOR.
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:102
size_t i
Definition: json11.cpp:597
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:96
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:926
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
#define mod(a, n)
Definition: greymap.cpp:24
TRACKS & Tracks()
Definition: class_board.h:227
virtual bool IsOnCopperLayer() const
bool Valid() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:543
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
PROGRESS_REPORTER * m_progressReporter