KiCad PCB EDA Suite
connectivity_data.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) 2017 CERN
5  * Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifdef PROFILE
27 #include <profile.h>
28 #endif
29 
30 #include <thread>
31 #include <algorithm>
32 #include <future>
33 
37 
38 #include <ratsnest/ratsnest_data.h>
39 
41 {
42  m_connAlgo.reset( new CN_CONNECTIVITY_ALGO );
43  m_progressReporter = nullptr;
44  m_fromToCache.reset( new FROM_TO_CACHE );
45 }
46 
47 
48 CONNECTIVITY_DATA::CONNECTIVITY_DATA( const std::vector<BOARD_ITEM*>& aItems, bool aSkipRatsnest )
49  : m_skipRatsnest( aSkipRatsnest )
50 {
51  Build( aItems );
52  m_progressReporter = nullptr;
53  m_fromToCache.reset( new FROM_TO_CACHE );
54 }
55 
56 
58 {
59  Clear();
60 }
61 
62 
64 {
65  m_connAlgo->Add( aItem );
66  return true;
67 }
68 
69 
71 {
72  m_connAlgo->Remove( aItem );
73  return true;
74 }
75 
76 
78 {
79  m_connAlgo->Remove( aItem );
80  m_connAlgo->Add( aItem );
81  return true;
82 }
83 
84 
86 {
87  m_connAlgo.reset( new CN_CONNECTIVITY_ALGO );
88  m_connAlgo->Build( aBoard, aReporter );
89 
90  m_netclassMap.clear();
91 
92  for( NETINFO_ITEM* net : aBoard->GetNetInfo() )
93  if( net->GetNetClass()->GetName() != NETCLASS::Default )
94  m_netclassMap[net->GetNet()] = net->GetNetClass()->GetName();
95 
97 }
98 
99 
100 void CONNECTIVITY_DATA::Build( const std::vector<BOARD_ITEM*>& aItems )
101 {
102  m_connAlgo.reset( new CN_CONNECTIVITY_ALGO );
103  m_connAlgo->Build( aItems );
104 
106 }
107 
108 
109 void CONNECTIVITY_DATA::Move( const VECTOR2I& aDelta )
110 {
111  m_connAlgo->ForEachAnchor( [&aDelta] ( CN_ANCHOR& anchor ) { anchor.Move( aDelta ); } );
112 }
113 
114 
116 {
117  #ifdef PROFILE
118  PROF_COUNTER rnUpdate( "update-ratsnest" );
119  #endif
120  std::vector<RN_NET*> dirty_nets;
121 
122  // Start with net 1 as net 0 is reserved for not-connected
123  // Nets without nodes are also ignored
124  std::copy_if( m_nets.begin() + 1, m_nets.end(), std::back_inserter( dirty_nets ),
125  [] ( RN_NET* aNet ) { return aNet->IsDirty() && aNet->GetNodeCount() > 0; } );
126 
127  // We don't want to spin up a new thread for fewer than 8 nets (overhead costs)
128  size_t parallelThreadCount = std::min<size_t>( std::thread::hardware_concurrency(),
129  ( dirty_nets.size() + 7 ) / 8 );
130 
131  std::atomic<size_t> nextNet( 0 );
132  std::vector<std::future<size_t>> returns( parallelThreadCount );
133 
134  auto update_lambda = [&nextNet, &dirty_nets]() -> size_t
135  {
136  for( size_t i = nextNet++; i < dirty_nets.size(); i = nextNet++ )
137  dirty_nets[i]->Update();
138 
139  return 1;
140  };
141 
142  if( parallelThreadCount == 1 )
143  update_lambda();
144  else
145  {
146  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
147  returns[ii] = std::async( std::launch::async, update_lambda );
148 
149  // Finalize the ratsnest threads
150  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
151  returns[ii].wait();
152  }
153 
154  #ifdef PROFILE
155  rnUpdate.Show();
156  #endif /* PROFILE */
157 }
158 
159 
160 void CONNECTIVITY_DATA::addRatsnestCluster( const std::shared_ptr<CN_CLUSTER>& aCluster )
161 {
162  auto rnNet = m_nets[ aCluster->OriginNet() ];
163 
164  rnNet->AddCluster( aCluster );
165 }
166 
167 
169 {
170  m_connAlgo->PropagateNets( aCommit );
171 
172  int lastNet = m_connAlgo->NetCount();
173 
174  if( lastNet >= (int) m_nets.size() )
175  {
176  unsigned int prevSize = m_nets.size();
177  m_nets.resize( lastNet + 1 );
178 
179  for( unsigned int i = prevSize; i < m_nets.size(); i++ )
180  m_nets[i] = new RN_NET;
181  }
182 
183  auto clusters = m_connAlgo->GetClusters();
184 
185  int dirtyNets = 0;
186 
187  for( int net = 0; net < lastNet; net++ )
188  {
189  if( m_connAlgo->IsNetDirty( net ) )
190  {
191  m_nets[net]->Clear();
192  dirtyNets++;
193  }
194  }
195 
196  for( const auto& c : clusters )
197  {
198  int net = c->OriginNet();
199 
200  // Don't add intentionally-kept zone islands to the ratsnest
201  if( c->IsOrphaned() && c->Size() == 1 )
202  {
203  if( dynamic_cast<CN_ZONE_LAYER*>( *c->begin() ) )
204  continue;
205  }
206 
207  if( m_connAlgo->IsNetDirty( net ) )
208  {
209  addRatsnestCluster( c );
210  }
211  }
212 
213  m_connAlgo->ClearDirtyFlags();
214 
215  if( !m_skipRatsnest )
216  updateRatsnest();
217 }
218 
219 
220 void CONNECTIVITY_DATA::BlockRatsnestItems( const std::vector<BOARD_ITEM*>& aItems )
221 {
222  std::vector<BOARD_CONNECTED_ITEM*> citems;
223 
224  for( auto item : aItems )
225  {
226  if( item->Type() == PCB_MODULE_T )
227  {
228  for( auto pad : static_cast<MODULE*>(item)->Pads() )
229  citems.push_back( pad );
230  }
231  else
232  {
233  if( auto citem = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
234  citems.push_back( citem );
235  }
236  }
237 
238  for( const auto& item : citems )
239  {
240  if ( m_connAlgo->ItemExists( item ) )
241  {
242  auto& entry = m_connAlgo->ItemEntry( item );
243 
244  for( const auto& cnItem : entry.GetItems() )
245  {
246  for( auto anchor : cnItem->Anchors() )
247  anchor->SetNoLine( true );
248  }
249  }
250  }
251 }
252 
253 
255 {
256  return m_connAlgo->NetCount();
257 }
258 
259 
261  std::vector<int>& aIslands )
262 {
263  // TODO(JE) ZONES
264 #if 0
265  m_connAlgo->FindIsolatedCopperIslands( aZone, aIslands );
266 #endif
267 }
268 
269 void CONNECTIVITY_DATA::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones )
270 {
271  m_connAlgo->FindIsolatedCopperIslands( aZones );
272 }
273 
274 
275 void CONNECTIVITY_DATA::ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>& aItems,
276  const CONNECTIVITY_DATA* aDynamicData )
277 {
278  if( !aDynamicData )
279  return;
280 
281  m_dynamicRatsnest.clear();
282 
283  // This gets connections between the stationary board and the
284  // moving selection
285  for( unsigned int nc = 1; nc < aDynamicData->m_nets.size(); nc++ )
286  {
287  auto dynNet = aDynamicData->m_nets[nc];
288 
289  if( dynNet->GetNodeCount() != 0 )
290  {
291  auto ourNet = m_nets[nc];
292  CN_ANCHOR_PTR nodeA, nodeB;
293 
294  if( ourNet->NearestBicoloredPair( *dynNet, nodeA, nodeB ) )
295  {
296  RN_DYNAMIC_LINE l;
297  l.a = nodeA->Pos();
298  l.b = nodeB->Pos();
299  l.netCode = nc;
300 
301  m_dynamicRatsnest.push_back( l );
302  }
303  }
304  }
305 
306  // This gets the ratsnest for internal connections in the moving set
307  const auto& edges = GetRatsnestForItems( aItems );
308 
309  for( const auto& edge : edges )
310  {
311  const auto& nodeA = edge.GetSourceNode();
312  const auto& nodeB = edge.GetTargetNode();
313  RN_DYNAMIC_LINE l;
314 
315  // Use the parents' positions
316  l.a = nodeA->Parent()->GetPosition();
317  l.b = nodeB->Parent()->GetPosition();
318  l.netCode = 0;
319  m_dynamicRatsnest.push_back( l );
320  }
321 }
322 
323 
325 {
326  m_connAlgo->ForEachAnchor( []( CN_ANCHOR& anchor )
327  {
328  anchor.SetNoLine( false );
329  } );
331 }
332 
333 
335 {
336  m_dynamicRatsnest.clear();
337 }
338 
339 
341 {
342  m_connAlgo->PropagateNets();
343 }
344 
346  std::vector<KICAD_T> aTypes ) const
347 {
348  CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY &entry = m_connAlgo->ItemEntry( aItem );
349 
350  auto matchType = [&]( KICAD_T aItemType )
351  {
352  if( aTypes.empty() )
353  return true;
354 
355  return std::count( aTypes.begin(), aTypes.end(), aItemType ) > 0;
356  };
357 
358  for( CN_ITEM* citem : entry.GetItems() )
359  {
360  for( CN_ITEM* connected : citem->ConnectedItems() )
361  {
362  if( connected->Valid()
363  && connected->Layers().Overlaps( aLayer )
364  && connected->Net() == aItem->GetNetCode()
365  && matchType( connected->Parent()->Type() ) )
366  {
367  return true;
368  }
369  }
370  }
371 
372  return false;
373 }
374 
375 
377 {
378  unsigned int unconnected = 0;
379 
380  for( auto net : m_nets )
381  {
382  if( !net )
383  continue;
384 
385  const auto& edges = net->GetUnconnected();
386 
387  if( edges.empty() )
388  continue;
389 
390  unconnected += edges.size();
391  }
392 
393  return unconnected;
394 }
395 
396 
398 {
399  for( auto net : m_nets )
400  delete net;
401 
402  m_nets.clear();
403 }
404 
405 
406 const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
407  const BOARD_CONNECTED_ITEM* aItem,
408  const KICAD_T aTypes[],
409  bool aIgnoreNetcodes ) const
410 {
411  std::vector<BOARD_CONNECTED_ITEM*> rv;
412  const auto clusters = m_connAlgo->SearchClusters(
413  aIgnoreNetcodes ?
416  aIgnoreNetcodes ? -1 : aItem->GetNetCode() );
417 
418  for( auto cl : clusters )
419  {
420  if( cl->Contains( aItem ) )
421  {
422  for( const auto item : *cl )
423  {
424  if( item->Valid() )
425  rv.push_back( item->Parent() );
426  }
427  }
428  }
429 
430  return rv;
431 }
432 
433 
434 const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetCode,
435  const KICAD_T aTypes[] ) const
436 {
437  std::vector<BOARD_CONNECTED_ITEM*> items;
438  items.reserve( 32 );
439 
440  std::bitset<MAX_STRUCT_TYPE_ID> type_bits;
441 
442  for( unsigned int i = 0; aTypes[i] != EOT; ++i )
443  {
444  wxASSERT( aTypes[i] < MAX_STRUCT_TYPE_ID );
445  type_bits.set( aTypes[i] );
446  }
447 
448  m_connAlgo->ForEachItem( [&]( CN_ITEM& aItem ) {
449  if( aItem.Valid() && ( aItem.Net() == aNetCode ) && type_bits[aItem.Parent()->Type()] )
450  items.push_back( aItem.Parent() );
451  } );
452 
453  std::sort( items.begin(), items.end() );
454  items.erase( std::unique( items.begin(), items.end() ), items.end() );
455  return items;
456 }
457 
458 
459 bool CONNECTIVITY_DATA::CheckConnectivity( std::vector<CN_DISJOINT_NET_ENTRY>& aReport )
460 {
462 
463  for( auto net : m_nets )
464  {
465  if( net )
466  {
467  for( const auto& edge : net->GetEdges() )
468  {
470  ent.net = edge.GetSourceNode()->Parent()->GetNetCode();
471  ent.a = edge.GetSourceNode()->Parent();
472  ent.b = edge.GetTargetNode()->Parent();
473  ent.anchorA = edge.GetSourceNode()->Pos();
474  ent.anchorB = edge.GetTargetNode()->Pos();
475  aReport.push_back( ent );
476  }
477  }
478  }
479 
480  return aReport.empty();
481 }
482 
483 
484 const std::vector<TRACK*> CONNECTIVITY_DATA::GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem )
485 const
486 {
487  auto& entry = m_connAlgo->ItemEntry( aItem );
488 
489  std::set<TRACK*> tracks;
490  std::vector<TRACK*> rv;
491 
492  for( auto citem : entry.GetItems() )
493  {
494  for( auto connected : citem->ConnectedItems() )
495  {
496  if( connected->Valid() &&
497  ( connected->Parent()->Type() == PCB_TRACE_T ||
498  connected->Parent()->Type() == PCB_VIA_T ||
499  connected->Parent()->Type() == PCB_ARC_T ) )
500  tracks.insert( static_cast<TRACK*> ( connected->Parent() ) );
501  }
502  }
503 
504  std::copy( tracks.begin(), tracks.end(), std::back_inserter( rv ) );
505  return rv;
506 }
507 
508 
510  std::set<D_PAD*>* pads ) const
511 {
512  for( auto citem : m_connAlgo->ItemEntry( aItem ).GetItems() )
513  {
514  for( auto connected : citem->ConnectedItems() )
515  {
516  if( connected->Valid() && connected->Parent()->Type() == PCB_PAD_T )
517  pads->insert( static_cast<D_PAD*> ( connected->Parent() ) );
518  }
519  }
520 }
521 
522 
523 const std::vector<D_PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
524 const
525 {
526  std::set<D_PAD*> pads;
527  std::vector<D_PAD*> rv;
528 
529  GetConnectedPads( aItem, &pads );
530 
531  std::copy( pads.begin(), pads.end(), std::back_inserter( rv ) );
532  return rv;
533 }
534 
535 
536 unsigned int CONNECTIVITY_DATA::GetNodeCount( int aNet ) const
537 {
538  int sum = 0;
539 
540  if( aNet < 0 ) // Node count for all nets
541  {
542  for( const RN_NET* net : m_nets )
543  sum += net->GetNodeCount();
544  }
545  else if( aNet < (int) m_nets.size() )
546  {
547  sum = m_nets[aNet]->GetNodeCount();
548  }
549 
550  return sum;
551 }
552 
553 
554 unsigned int CONNECTIVITY_DATA::GetPadCount( int aNet ) const
555 {
556  int n = 0;
557 
558  for( CN_ITEM* pad : m_connAlgo->ItemList() )
559  {
560  if( !pad->Valid() || pad->Parent()->Type() != PCB_PAD_T)
561  continue;
562 
563  D_PAD* dpad = static_cast<D_PAD*>( pad->Parent() );
564 
565  if( aNet < 0 || aNet == dpad->GetNetCode() )
566  n++;
567  }
568 
569  return n;
570 }
571 
572 
573 void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges) const
574 {
575  for( const RN_NET* rnNet : m_nets )
576  {
577  if( rnNet )
578  {
579  for( const CN_EDGE& edge : rnNet->GetEdges() )
580  aEdges.push_back( edge );
581  }
582  }
583 }
584 
585 
587 {
588  auto items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
589 
590  // Not in the connectivity system. This is a bug!
591  if( items.empty() )
592  {
593  wxFAIL_MSG( "track not in connectivity system" );
594  return false;
595  }
596 
597  CN_ITEM* citem = items.front();
598 
599  if( !citem->Valid() )
600  return false;
601 
602  for( const std::shared_ptr<CN_ANCHOR>& anchor : citem->Anchors() )
603  {
604  if( anchor->IsDangling() )
605  {
606  if( aPos )
607  *aPos = static_cast<wxPoint>( anchor->Pos() );
608 
609  return true;
610  }
611  }
612 
613  return false;
614 }
615 
616 
617 const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
618  const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] )
619 {
620  auto& entry = m_connAlgo->ItemEntry( aItem );
621  std::vector<BOARD_CONNECTED_ITEM* > rv;
622 
623  for( auto cnItem : entry.GetItems() )
624  {
625  for( auto anchor : cnItem->Anchors() )
626  {
627  if( anchor->Pos() == aAnchor )
628  {
629  for( int i = 0; aTypes[i] > 0; i++ )
630  {
631  if( cnItem->Valid() && cnItem->Parent()->Type() == aTypes[i] )
632  {
633  rv.push_back( cnItem->Parent() );
634  break;
635  }
636  }
637  }
638  }
639  }
640 
641  return rv;
642 }
643 
644 
646 {
647  if ( aNet < 0 || aNet >= (int) m_nets.size() )
648  {
649  return nullptr;
650  }
651 
652  return m_nets[ aNet ];
653 }
654 
655 
657 {
658  if (aItem->Type() == PCB_MODULE_T)
659  {
660  for ( auto pad : static_cast<MODULE*>( aItem )->Pads() )
661  {
662  m_connAlgo->MarkNetAsDirty( pad->GetNetCode() );
663  }
664  }
665  if (aItem->IsConnected() )
666  {
667  m_connAlgo->MarkNetAsDirty( static_cast<BOARD_CONNECTED_ITEM*>( aItem )->GetNetCode() );
668  }
669 }
670 
671 
673 {
674  m_progressReporter = aReporter;
675  m_connAlgo->SetProgressReporter( m_progressReporter );
676 }
677 
678 
679 const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<BOARD_ITEM*> aItems )
680 {
681  std::set<int> nets;
682  std::vector<CN_EDGE> edges;
683  std::set<BOARD_CONNECTED_ITEM*> item_set;
684 
685  for( auto item : aItems )
686  {
687  if( item->Type() == PCB_MODULE_T )
688  {
689  auto component = static_cast<MODULE*>( item );
690 
691  for( auto pad : component->Pads() )
692  {
693  nets.insert( pad->GetNetCode() );
694  item_set.insert( pad );
695  }
696  }
697  else if( auto conn_item = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
698  {
699  item_set.insert( conn_item );
700  nets.insert( conn_item->GetNetCode() );
701  }
702  }
703 
704  for( const auto& netcode : nets )
705  {
706  const auto& net = GetRatsnestForNet( netcode );
707 
708  for( const auto& edge : net->GetEdges() )
709  {
710  auto srcNode = edge.GetSourceNode();
711  auto dstNode = edge.GetTargetNode();
712 
713  auto srcParent = srcNode->Parent();
714  auto dstParent = dstNode->Parent();
715 
716  bool srcFound = ( item_set.find(srcParent) != item_set.end() );
717  bool dstFound = ( item_set.find(dstParent) != item_set.end() );
718 
719  if ( srcFound && dstFound )
720  edges.push_back( edge );
721  }
722  }
723 
724  return edges;
725 }
726 
727 
728 const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForComponent( MODULE* aComponent, bool aSkipInternalConnections )
729 {
730  std::set<int> nets;
731  std::set<const D_PAD*> pads;
732  std::vector<CN_EDGE> edges;
733 
734  for( auto pad : aComponent->Pads() )
735  {
736  nets.insert( pad->GetNetCode() );
737  pads.insert( pad );
738  }
739 
740  for( const auto& netcode : nets )
741  {
742  const auto& net = GetRatsnestForNet( netcode );
743 
744  for( const auto& edge : net->GetEdges() )
745  {
746  auto srcNode = edge.GetSourceNode();
747  auto dstNode = edge.GetTargetNode();
748 
749  auto srcParent = static_cast<const D_PAD*>( srcNode->Parent() );
750  auto dstParent = static_cast<const D_PAD*>( dstNode->Parent() );
751 
752  bool srcFound = ( pads.find(srcParent) != pads.end() );
753  bool dstFound = ( pads.find(dstParent) != pads.end() );
754 
755  if ( srcFound && dstFound && !aSkipInternalConnections )
756  {
757  edges.push_back( edge );
758  }
759  else if ( srcFound || dstFound )
760  {
761  edges.push_back( edge );
762  }
763  }
764  }
765 
766  return edges;
767 }
768 
769 
const CONNECTED_ITEMS & ConnectedItems() const
const std::vector< TRACK * > GetConnectedTracks(const BOARD_CONNECTED_ITEM *aItem) const
void Clear()
Function Clear() Erases the connectivity database.
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
bool IsConnectedOnLayer(const BOARD_CONNECTED_ITEM *aItem, int aLayer, std::vector< KICAD_T > aTypes={}) const
unsigned int GetNodeCount(int aNet=-1) const
bool TestTrackEndpointDangling(TRACK *aTrack, wxPoint *aPos=nullptr)
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
A progress reporter for use in multi-threaded environments.
std::shared_ptr< CN_CONNECTIVITY_ALGO > m_connAlgo
Class that computes missing connections on a PCB.
PROGRESS_REPORTER * m_progressReporter
const std::list< CN_ITEM * > GetItems() const
std::shared_ptr< CN_CONNECTIVITY_ALGO > GetConnectivityAlgo() const
bool Update(BOARD_ITEM *aItem)
Function Update() Updates the connectivity data for an item.
const std::vector< BOARD_CONNECTED_ITEM * > GetNetItems(int aNetCode, const KICAD_T aTypes[]) const
Function GetNetItems() Returns the list of items that belong to a certain net.
void RecalculateRatsnest(BOARD_COMMIT *aCommit=nullptr)
Function RecalculateRatsnest() Updates the ratsnest for the board.
PADS & Pads()
Definition: class_module.h:182
const std::vector< BOARD_CONNECTED_ITEM * > GetConnectedItems(const BOARD_CONNECTED_ITEM *aItem, const VECTOR2I &aAnchor, KICAD_T aTypes[])
std::shared_ptr< FROM_TO_CACHE > m_fromToCache
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
const NETINFO_LIST & GetNetInfo() const
Definition: class_board.h:721
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
BOARD_CONNECTED_ITEM * Parent() const
void FindIsolatedCopperIslands(ZONE_CONTAINER *aZone, std::vector< int > &aIslands)
Function FindIsolatedCopperIslands() Searches for copper islands in zone aZone that are not connected...
CN_ANCHORS & Anchors()
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:44
BOARD_CONNECTED_ITEM * b
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
std::vector< RN_DYNAMIC_LINE > m_dynamicRatsnest
int Net() const
VECTOR2I anchorB
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
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
unsigned int GetPadCount(int aNet=-1) const
class MODULE, a footprint
Definition: typeinfo.h:89
void Build(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Function Build() Builds the connectivity database for the board aBoard.
VECTOR2I anchorA
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:80
std::map< int, wxString > m_netclassMap
Map of netcode -> netclass the net is a member of; used for ratsnest painting.
unsigned int GetUnconnectedCount() const
Function GetUnconnectedCount() Returns the number of remaining edges in the ratsnest.
void PropagateNets()
Function PropagateNets() Propagates the net codes from the source pads to the tracks/vias.
const std::vector< D_PAD * > GetConnectedPads(const BOARD_CONNECTED_ITEM *aItem) const
void ClearDynamicRatsnest()
Function ClearDynamicRatsnest() Erases the temporary dynamic ratsnest (i.e.
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
bool Remove(BOARD_ITEM *aItem)
Function Remove() Removes an item from the connectivity data.
void MarkItemNetAsDirty(BOARD_ITEM *aItem)
std::vector< RN_NET * > m_nets
void GetUnconnectedEdges(std::vector< CN_EDGE > &aEdges) const
bool Add(BOARD_ITEM *aItem)
Function Add() Adds an item to the connectivity data.
void BlockRatsnestItems(const std::vector< BOARD_ITEM * > &aItems)
RN_NET * GetRatsnestForNet(int aNet)
Function GetRatsnestForNet() Returns the ratsnest, expressed as a set of graph edges for a given net.
BOARD_CONNECTED_ITEM * a
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
bool CheckConnectivity(std::vector< CN_DISJOINT_NET_ENTRY > &aReport)
void ComputeDynamicRatsnest(const std::vector< BOARD_ITEM * > &aItems, const CONNECTIVITY_DATA *aDynamicData)
Function ComputeDynamicRatsnest() Calculates the temporary dynamic ratsnest (i.e.
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
const std::vector< CN_EDGE > GetRatsnestForComponent(MODULE *aComponent, bool aSkipInternalConnections=false)
std::shared_ptr< CN_ANCHOR > CN_ANCHOR_PTR
int net
void SetNoLine(bool aEnable)
Decides whether this node can be a ratsnest line target.
int GetNetCount() const
Function GetNetCount() Returns the total number of nets in the connectivity database.
virtual bool IsConnected() const
Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
RN_NET Describes ratsnest for a single net.
Definition: ratsnest_data.h:61
void Show(std::ostream &aStream=std::cerr)
Print the elapsed time (in a suitable unit) to a stream.
Definition: profile.h:99
void Move(const VECTOR2I &aPos)
void HideDynamicRatsnest()
Hides the temporary dynamic ratsnest lines.
void addRatsnestCluster(const std::shared_ptr< CN_CLUSTER > &aCluster)
void Move(const VECTOR2I &aDelta)
Moves the connectivity list anchors.
const std::vector< CN_EDGE > GetRatsnestForItems(const std::vector< BOARD_ITEM * > aItems)
bool Valid() const
KICAD_T Type() const
Function Type()
Definition: eda_item.h:181