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