KiCad PCB EDA Suite
connectivity_algo.h
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) 2013-2017 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
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 // #define CONNECTIVITY_DEBUG
27 
28 #ifndef __CONNECTIVITY_ALGO_H
29 #define __CONNECTIVITY_ALGO_H
30 
31 #include <class_board.h>
32 #include <class_pad.h>
33 #include <class_module.h>
34 #include <class_zone.h>
35 
38 
39 #include <memory>
40 #include <algorithm>
41 #include <functional>
42 #include <vector>
43 #include <deque>
44 #include <intrusive_list.h>
45 
46 #include <connectivity_rtree.h>
47 #include <connectivity_data.h>
48 
49 class CN_ITEM;
50 class CN_CONNECTIVITY_ALGO_IMPL;
51 class CN_RATSNEST_NODES;
52 class CN_CLUSTER;
53 class BOARD;
55 class BOARD_ITEM;
56 class ZONE_CONTAINER;
57 class PROGRESS_REPORTER;
58 
59 class CN_ANCHOR
60 {
61 public:
63  {
64  m_item = nullptr;
65  }
66 
67  CN_ANCHOR( const VECTOR2I& aPos, CN_ITEM* aItem )
68  {
69  m_pos = aPos;
70  m_item = aItem;
71  assert( m_item );
72  }
73 
74  bool Valid() const;
75 
76 
77  CN_ITEM* Item() const
78  {
79  return m_item;
80  }
81 
83 
84  const VECTOR2I& Pos() const
85  {
86  return m_pos;
87  }
88 
89  bool IsDirty() const;
90 
92  inline int GetTag() const
93  {
94  return m_tag;
95  }
96 
98  inline void SetTag( int aTag )
99  {
100  m_tag = aTag;
101  }
102 
104  inline void SetNoLine( bool aEnable )
105  {
106  m_noline = aEnable;
107  }
108 
110  inline const bool& GetNoLine() const
111  {
112  return m_noline;
113  }
114 
115  inline void SetCluster( std::shared_ptr<CN_CLUSTER> aCluster )
116  {
117  m_cluster = aCluster;
118  }
119 
120  inline std::shared_ptr<CN_CLUSTER> GetCluster() const
121  {
122  return m_cluster;
123  }
124 
133  bool IsDangling() const;
134 
135  // Tag used for unconnected items.
136  static const int TAG_UNCONNECTED = -1;
137 
138 private:
141 
143  CN_ITEM* m_item = nullptr;
144 
146  int m_tag = -1;
147 
149  bool m_noline = false;
150 
152  std::shared_ptr<CN_CLUSTER> m_cluster;
153 };
154 
155 
156 typedef std::shared_ptr<CN_ANCHOR> CN_ANCHOR_PTR;
157 typedef std::vector<CN_ANCHOR_PTR> CN_ANCHORS;
158 
159 
160 class CN_EDGE
161 {
162 public:
163  CN_EDGE() {};
164  CN_EDGE( CN_ANCHOR_PTR aSource, CN_ANCHOR_PTR aTarget, int aWeight = 0 ) :
165  m_source( aSource ),
166  m_target( aTarget ),
167  m_weight( aWeight ) {}
168 
169  CN_ANCHOR_PTR GetSourceNode() const { return m_source; }
170  CN_ANCHOR_PTR GetTargetNode() const { return m_target; }
171  int GetWeight() const { return m_weight; }
172 
173  void SetSourceNode( const CN_ANCHOR_PTR& aNode ) { m_source = aNode; }
174  void SetTargetNode( const CN_ANCHOR_PTR& aNode ) { m_target = aNode; }
175  void SetWeight( unsigned int weight ) { m_weight = weight; }
176 
177  void SetVisible( bool aVisible )
178  {
179  m_visible = aVisible;
180  }
181 
182  bool IsVisible() const
183  {
184  return m_visible;
185  }
186 
187  const VECTOR2I GetSourcePos() const
188  {
189  return m_source->Pos();
190  }
191 
192  const VECTOR2I GetTargetPos() const
193  {
194  return m_target->Pos();
195  }
196 
197 private:
200  unsigned int m_weight = 0;
201  bool m_visible = true;
202 };
203 
204 
206 {
207 private:
208 
209  bool m_conflicting = false;
210  int m_originNet = 0;
211  CN_ITEM* m_originPad = nullptr;
212  std::vector<CN_ITEM*> m_items;
213 
214 public:
215  CN_CLUSTER();
216  ~CN_CLUSTER();
217 
218  bool HasValidNet() const
219  {
220  return m_originNet >= 0;
221  }
222 
223  int OriginNet() const
224  {
225  return m_originNet;
226  }
227 
228  wxString OriginNetName() const;
229 
230  bool Contains( const CN_ITEM* aItem );
231  bool Contains( const BOARD_CONNECTED_ITEM* aItem );
232  void Dump();
233 
234  int Size() const
235  {
236  return m_items.size();
237  }
238 
239  bool HasNet() const
240  {
241  return m_originNet >= 0;
242  }
243 
244  bool IsOrphaned() const
245  {
246  return m_originPad == nullptr;
247  }
248 
249  bool IsConflicting() const
250  {
251  return m_conflicting;
252  }
253 
254  void Add( CN_ITEM* item );
255 
256  using ITER = decltype(m_items)::iterator;
257 
258  ITER begin() { return m_items.begin(); };
259  ITER end() { return m_items.end(); };
260 };
261 
262 typedef std::shared_ptr<CN_CLUSTER> CN_CLUSTER_PTR;
263 
264 
265 // basic connectivity item
266 class CN_ITEM : public INTRUSIVE_LIST<CN_ITEM>
267 {
268 private:
270 
271  using CONNECTED_ITEMS = std::set<CN_ITEM*>;
272 
275 
277 
279  bool m_visited;
280 
283 
285  bool m_valid;
286 
287 protected:
289  bool m_dirty;
290 
293 
296 
297 public:
298  void Dump();
299 
300  CN_ITEM( BOARD_CONNECTED_ITEM* aParent, bool aCanChangeNet, int aAnchorCount = 2 )
301  {
302  m_parent = aParent;
303  m_canChangeNet = aCanChangeNet;
304  m_visited = false;
305  m_valid = true;
306  m_dirty = true;
307  m_anchors.reserve( 2 );
308  m_layers = LAYER_RANGE( 0, PCB_LAYER_ID_COUNT );
309  }
310 
311  virtual ~CN_ITEM() {};
312 
313  void AddAnchor( const VECTOR2I& aPos )
314  {
315  m_anchors.emplace_back( std::make_unique<CN_ANCHOR>( aPos, this ) );
316  }
317 
319  {
320  return m_anchors;
321  }
322 
323  void SetValid( bool aValid )
324  {
325  m_valid = aValid;
326  }
327 
328  bool Valid() const
329  {
330  return m_valid;
331  }
332 
333  void SetDirty( bool aDirty )
334  {
335  m_dirty = aDirty;
336  }
337 
338  bool Dirty() const
339  {
340  return m_dirty;
341  }
342 
348  void SetLayers( const LAYER_RANGE& aLayers )
349  {
350  m_layers = aLayers;
351  }
352 
358  void SetLayer( int aLayer )
359  {
360  m_layers = LAYER_RANGE( aLayer, aLayer );
361  }
362 
368  const LAYER_RANGE& Layers() const
369  {
370  return m_layers;
371  }
372 
378  virtual int Layer() const
379  {
380  return Layers().Start();
381  }
382 
389  bool LayersOverlap( const CN_ITEM* aOther ) const
390  {
391  return Layers().Overlaps( aOther->Layers() );
392  }
393 
394  const BOX2I& BBox()
395  {
396  if( m_dirty && m_valid )
397  {
398  EDA_RECT box = m_parent->GetBoundingBox();
399  m_bbox = BOX2I( box.GetPosition(), box.GetSize() );
400  }
401  return m_bbox;
402  }
403 
405  {
406  return m_parent;
407  }
408 
410  {
411  return m_connected;
412  }
413 
415  {
416  m_connected.clear();
417  }
418 
419  void SetVisited( bool aVisited )
420  {
421  m_visited = aVisited;
422  }
423 
424  bool Visited() const
425  {
426  return m_visited;
427  }
428 
429  bool CanChangeNet() const
430  {
431  return m_canChangeNet;
432  }
433 
434  bool isConnected( CN_ITEM* aItem ) const
435  {
436  return ( m_connected.find( aItem ) != m_connected.end() );
437  }
438 
439  static void Connect( CN_ITEM* a, CN_ITEM* b )
440  {
441  a->m_connected.insert( b );
442  b->m_connected.insert( a );
443  }
444 
445  void RemoveInvalidRefs();
446 
447  virtual int AnchorCount() const;
448  virtual const VECTOR2I GetAnchor( int n ) const;
449 
450  int Net() const;
451 };
452 
453 typedef std::shared_ptr<CN_ITEM> CN_ITEM_PTR;
454 
455 class CN_ZONE : public CN_ITEM
456 {
457 public:
458  CN_ZONE( ZONE_CONTAINER* aParent, bool aCanChangeNet, int aSubpolyIndex ) :
459  CN_ITEM( aParent, aCanChangeNet ),
460  m_subpolyIndex( aSubpolyIndex )
461  {
462  SHAPE_LINE_CHAIN outline = aParent->GetFilledPolysList().COutline( aSubpolyIndex );
463 
464  outline.SetClosed( true );
465  outline.Simplify();
466 
467  m_cachedPoly.reset( new POLY_GRID_PARTITION( outline, 16 ) );
468  }
469 
470  int SubpolyIndex() const
471  {
472  return m_subpolyIndex;
473  }
474 
475  bool ContainsAnchor( const CN_ANCHOR_PTR anchor ) const
476  {
477  return ContainsPoint( anchor->Pos() );
478  }
479 
480  bool ContainsPoint( const VECTOR2I p ) const
481  {
482  auto zone = static_cast<ZONE_CONTAINER*> ( Parent() );
483  return m_cachedPoly->ContainsPoint( p, zone->GetMinThickness() );
484  }
485 
486  const BOX2I& BBox()
487  {
488  if( m_dirty )
489  m_bbox = m_cachedPoly->BBox();
490 
491  return m_bbox;
492  }
493 
494  virtual int AnchorCount() const override;
495  virtual const VECTOR2I GetAnchor( int n ) const override;
496 
497 private:
498  std::vector<VECTOR2I> m_testOutlinePoints;
499  std::unique_ptr<POLY_GRID_PARTITION> m_cachedPoly;
501 };
502 
503 class CN_LIST
504 {
505 private:
506  bool m_dirty;
508 
510 
511 protected:
512  std::vector<CN_ITEM*> m_items;
513 
514  void addItemtoTree( CN_ITEM* item )
515  {
516  m_index.Insert( item );
517  }
518 
519 public:
521  {
522  m_dirty = false;
523  m_hasInvalid = false;
524  }
525 
526  void Clear()
527  {
528  for( auto item : m_items )
529  delete item;
530 
531  m_items.clear();
532  m_index.RemoveAll();
533  }
534 
535  using ITER = decltype(m_items)::iterator;
536 
537  ITER begin() { return m_items.begin(); };
538  ITER end() { return m_items.end(); };
539 
540  CN_ITEM* operator[] ( int aIndex ) { return m_items[aIndex]; }
541 
542  template <class T>
543  void FindNearby( CN_ITEM *aItem, T aFunc );
544 
545  void SetHasInvalid( bool aInvalid = true )
546  {
547  m_hasInvalid = aInvalid;
548  }
549 
550  void SetDirty( bool aDirty = true )
551  {
552  m_dirty = aDirty;
553  }
554 
555  bool IsDirty() const
556  {
557  return m_dirty;
558  }
559 
560  void RemoveInvalidItems( std::vector<CN_ITEM*>& aGarbage );
561 
563  {
564  for( auto item : m_items )
565  item->SetDirty( false );
566 
567  SetDirty( false );
568  }
569 
571  {
572  for( auto item : m_items )
573  item->SetDirty( true );
574 
575  SetDirty( true );
576  }
577 
578  int Size() const
579  {
580  return m_items.size();
581  }
582 
583  CN_ITEM* Add( D_PAD* pad )
584  {
585  auto item = new CN_ITEM( pad, false, 1 );
586  item->AddAnchor( pad->ShapePos() );
587  item->SetLayers( LAYER_RANGE( F_Cu, B_Cu ) );
588 
589  switch( pad->GetAttribute() )
590  {
591  case PAD_ATTRIB_SMD:
593  case PAD_ATTRIB_CONN:
594  {
595  LSET lmsk = pad->GetLayerSet();
596 
597  for( int i = 0; i <= MAX_CU_LAYERS; i++ )
598  {
599  if( lmsk[i] )
600  {
601  item->SetLayer( i );
602  break;
603  }
604  }
605  break;
606  }
607  default:
608  break;
609  }
610 
611  addItemtoTree( item );
612  m_items.push_back( item );
613  SetDirty();
614  return item;
615  }
616 
617  CN_ITEM* Add( TRACK* track )
618  {
619  auto item = new CN_ITEM( track, true );
620  m_items.push_back( item );
621  item->AddAnchor( track->GetStart() );
622  item->AddAnchor( track->GetEnd() );
623  item->SetLayer( track->GetLayer() );
624  addItemtoTree( item );
625  SetDirty();
626  return item;
627  }
628 
629  CN_ITEM* Add( VIA* via )
630  {
631  auto item = new CN_ITEM( via, true, 1 );
632 
633  m_items.push_back( item );
634  item->AddAnchor( via->GetStart() );
635  item->SetLayers( LAYER_RANGE( F_Cu, B_Cu ) );
636  addItemtoTree( item );
637  SetDirty();
638  return item;
639  }
640 
641  const std::vector<CN_ITEM*> Add( ZONE_CONTAINER* zone )
642  {
643  const auto& polys = zone->GetFilledPolysList();
644 
645  std::vector<CN_ITEM*> rv;
646 
647  for( int j = 0; j < polys.OutlineCount(); j++ )
648  {
649  CN_ZONE* zitem = new CN_ZONE( zone, false, j );
650  const auto& outline = zone->GetFilledPolysList().COutline( j );
651 
652  for( int k = 0; k < outline.PointCount(); k++ )
653  zitem->AddAnchor( outline.CPoint( k ) );
654 
655  m_items.push_back( zitem );
656  zitem->SetLayer( zone->GetLayer() );
657  addItemtoTree( zitem );
658  rv.push_back( zitem );
659  SetDirty();
660  }
661 
662  return rv;
663  }
664 };
665 
666 template <class T>
667 void CN_LIST::FindNearby( CN_ITEM *aItem, T aFunc )
668 {
669  m_index.Query( aItem->BBox(), aItem->Layers(), aFunc );
670 }
671 
673 {
674 public:
676  {
679  CSM_RATSNEST
680  };
681 
682  using CLUSTERS = std::vector<CN_CLUSTER_PTR>;
683 
684 private:
685 
687  {
688 public:
689  ITEM_MAP_ENTRY( CN_ITEM* aItem = nullptr )
690  {
691  if( aItem )
692  m_items.push_back( aItem );
693  }
694 
696  {
697  for( auto item : m_items )
698  {
699  item->SetValid( false );
700  }
701  }
702 
703  void Link( CN_ITEM* aItem )
704  {
705  m_items.push_back( aItem );
706  }
707 
708  const std::list<CN_ITEM*> GetItems() const
709  {
710  return m_items;
711  }
712 
713  std::list<CN_ITEM*> m_items;
714  };
715 
716  std::mutex m_listLock;
718 
719  using ITEM_MAP_PAIR = std::pair <const BOARD_CONNECTED_ITEM*, ITEM_MAP_ENTRY>;
720 
721  std::unordered_map<const BOARD_CONNECTED_ITEM*, ITEM_MAP_ENTRY> m_itemMap;
722 
725  std::vector<bool> m_dirtyNets;
726  PROGRESS_REPORTER* m_progressReporter = nullptr;
727 
728  void searchConnections();
729 
730  void update();
731  void propagateConnections();
732 
733  template <class Container, class BItem>
734  void add( Container& c, BItem brditem )
735  {
736  auto item = c.Add( brditem );
737 
738  m_itemMap[ brditem ] = ITEM_MAP_ENTRY( item );
739  }
740 
741  bool addConnectedItem( BOARD_CONNECTED_ITEM* aItem );
742  bool isDirty() const;
743 
744  void markItemNetAsDirty( const BOARD_ITEM* aItem );
745 
746 public:
747 
750 
751  bool ItemExists( const BOARD_CONNECTED_ITEM* aItem )
752  {
753  return m_itemMap.find( aItem ) != m_itemMap.end();
754  }
755 
757  {
758  return m_itemMap[ aItem ];
759  }
760 
761  bool IsNetDirty( int aNet ) const
762  {
763  if( aNet < 0 )
764  return false;
765 
766  return m_dirtyNets[ aNet ];
767  }
768 
770  {
771  for( auto i = m_dirtyNets.begin(); i != m_dirtyNets.end(); ++i )
772  *i = false;
773  }
774 
775  void GetDirtyClusters( CLUSTERS& aClusters )
776  {
777  for( auto cl : m_ratsnestClusters )
778  {
779  int net = cl->OriginNet();
780 
781  if( net >= 0 && m_dirtyNets[net] )
782  aClusters.push_back( cl );
783  }
784  }
785 
786  int NetCount() const
787  {
788  return m_dirtyNets.size();
789  }
790 
791  void Build( BOARD* aBoard );
792  void Build( const std::vector<BOARD_ITEM*>& aItems );
793 
794  void Clear();
795 
796  bool Remove( BOARD_ITEM* aItem );
797  bool Add( BOARD_ITEM* aItem );
798 
799  const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode, const KICAD_T aTypes[], int aSingleNet );
800  const CLUSTERS SearchClusters( CLUSTER_SEARCH_MODE aMode );
801 
802  void PropagateNets();
803  void FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std::vector<int>& aIslands );
804 
811  void FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLATED_ISLAND_LIST>& aZones );
812 
813  bool CheckConnectivity( std::vector<CN_DISJOINT_NET_ENTRY>& aReport );
814 
815  const CLUSTERS& GetClusters();
816  int GetUnconnectedCount();
817 
818  CN_LIST& ItemList() { return m_itemList; }
819 
820  void ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc );
821  void ForEachItem( const std::function<void( CN_ITEM& )>& aFunc );
822 
823  void MarkNetAsDirty( int aNet );
824  void SetProgressReporter( PROGRESS_REPORTER* aReporter );
825 
826 };
827 
828 bool operator<( const CN_ANCHOR_PTR& a, const CN_ANCHOR_PTR& b );
829 
830 
834 class CN_VISITOR {
835 
836 public:
837 
838  CN_VISITOR( CN_ITEM* aItem, std::mutex* aListLock ) :
839  m_item( aItem ),
840  m_listLock( aListLock )
841  {}
842 
843  bool operator()( CN_ITEM* aCandidate );
844 
845 protected:
846 
847  void checkZoneItemConnection( CN_ZONE* aZone, CN_ITEM* aItem );
848 
849  void checkZoneZoneConnection( CN_ZONE* aZoneA, CN_ZONE* aZoneB );
850 
853 
855  std::mutex* m_listLock;
856 
857 };
858 
859 #endif
bool LayersOverlap(const CN_ITEM *aOther) const
Function LayersOverlap()
std::vector< CN_ITEM * > m_items
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void SetSourceNode(const CN_ANCHOR_PTR &aNode)
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2< VECTOR2I > BOX2I
Definition: box2.h:502
CN_EDGE(CN_ANCHOR_PTR aSource, CN_ANCHOR_PTR aTarget, int aWeight=0)
decltype(m_items)::iterator ITER
BOARD_CONNECTED_ITEM * m_parent
void Link(CN_ITEM *aItem)
void SetHasInvalid(bool aInvalid=true)
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
bool Valid() const
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
CN_ITEM * Add(TRACK *track)
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
const wxSize GetSize() const
Definition: eda_rect.h:101
std::shared_ptr< CN_CLUSTER > m_cluster
Cluster to which the anchor belongs.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
A progress reporter for use in multi-threaded environments.
std::vector< VECTOR2I > m_testOutlinePoints
bool IsDirty() const
Class BOARD to handle a board.
std::vector< CN_ANCHOR_PTR > CN_ANCHORS
void addItemtoTree(CN_ITEM *item)
bool m_valid
valid flag, used to identify garbage items (we use lazy removal)
A lightweight intrusive list container
virtual int Layer() const
Function Layer()
void ClearDirtyFlags()
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
void ClearConnections()
CN_ANCHOR_PTR m_target
std::pair< const BOARD_CONNECTED_ITEM *, ITEM_MAP_ENTRY > ITEM_MAP_PAIR
LAYER_RANGE m_layers
layer range over which the item exists
const BOX2I & BBox()
const bool & GetNoLine() const
Returns true if this node can be a target for ratsnest lines.
void SetVisited(bool aVisited)
std::set< CN_ITEM * > CONNECTED_ITEMS
BOARD_CONNECTED_ITEM * Parent() const
bool HasValidNet() const
bool ContainsAnchor(const CN_ANCHOR_PTR anchor) const
Classes to handle copper zones.
bool IsConflicting() const
CN_ANCHOR_PTR GetTargetNode() const
CN_ITEM * Item() const
static const int TAG_UNCONNECTED
void add(Container &c, BItem brditem)
ITEM_MAP_ENTRY(CN_ITEM *aItem=nullptr)
void SetCluster(std::shared_ptr< CN_CLUSTER > aCluster)
CN_ANCHORS & Anchors()
void Insert(T aItem)
Function Insert() Inserts an item into the tree.
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
std::unordered_map< const BOARD_CONNECTED_ITEM *, ITEM_MAP_ENTRY > m_itemMap
void SetDirty(bool aDirty=true)
void RemoveAll()
Function RemoveAll() Removes all items from the RTree.
const wxPoint & GetEnd() const
Definition: class_track.h:119
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
CN_ITEM * Add(VIA *via)
void MarkAllAsDirty()
bool ContainsPoint(const VECTOR2I p) const
VECTOR2I m_pos
Position of the anchor.
void SetValid(bool aValid)
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
void MarkItemsAsInvalid()
bool IsDangling() const
has meaning only for tracks and vias.
std::mutex * m_listLock
the mutex protecting our connection list
std::vector< CN_ITEM * > m_items
void SetClosed(bool aClosed)
Function SetClosed()
bool m_visited
visited flag for the BFS scan
CN_ITEM * Add(D_PAD *pad)
Class LSET is a set of PCB_LAYER_IDs.
std::list< CN_ITEM * > m_items
ITEM_MAP_ENTRY & ItemEntry(const BOARD_CONNECTED_ITEM *aItem)
bool isConnected(CN_ITEM *aItem) const
int SubpolyIndex() const
bool Valid() const
CN_ANCHOR(const VECTOR2I &aPos, CN_ITEM *aItem)
const wxPoint & GetStart() const
Definition: class_track.h:122
bool IsNetDirty(int aNet) const
bool Visited() const
bool ItemExists(const BOARD_CONNECTED_ITEM *aItem)
bool m_dirty
dirty flag, used to identify recently added item not yet scanned into the connectivity search ...
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:402
decltype(m_items)::iterator ITER
void SetLayers(const LAYER_RANGE &aLayers)
Function SetLayers()
int OriginNet() const
bool IsVisible() const
const std::list< CN_ITEM * > GetItems() const
void SetTargetNode(const CN_ANCHOR_PTR &aNode)
const VECTOR2I GetTargetPos() const
CN_VISITOR(CN_ITEM *aItem, std::mutex *aListLock)
std::shared_ptr< CN_ITEM > CN_ITEM_PTR
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
virtual ~CN_ITEM()
std::shared_ptr< CN_CLUSTER > CN_CLUSTER_PTR
BOX2I m_bbox
bounding box for the item
void SetVisible(bool aVisible)
void SetTag(int aTag)
Sets tag, common identifier for connected nodes.
const std::vector< CN_ITEM * > Add(ZONE_CONTAINER *zone)
const CONNECTED_ITEMS & ConnectedItems() const
bool IsOrphaned() const
bool m_canChangeNet
can the net propagator modify the netcode?
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:62
void Query(const BOX2I &aBounds, const LAYER_RANGE &aRange, Visitor &aVisitor)
Function Query() Executes a function object aVisitor for each item whose bounding box intersects with...
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:540
const wxPoint GetPosition() const
Definition: eda_rect.h:113
Pad object description.
void SetDirty(bool aDirty)
int m_tag
Tag for quick connection resolution.
std::unique_ptr< POLY_GRID_PARTITION > m_cachedPoly
const LAYER_RANGE & Layers() const
Function Layers()
void AddAnchor(const VECTOR2I &aPos)
void FindNearby(CN_ITEM *aItem, T aFunc)
bool operator<(const CN_ANCHOR_PTR &a, const CN_ANCHOR_PTR &b)
BOARD_CONNECTED_ITEM * Parent() const
CN_ZONE(ZONE_CONTAINER *aParent, bool aCanChangeNet, int aSubpolyIndex)
bool HasNet() const
int GetTag() const
Returns tag, common identifier for connected nodes.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
CN_ANCHOR_PTR m_source
CN_ITEM * m_item
Item owning the anchor.
Struct CN_VISTOR.
int GetWeight() const
Class SHAPE_LINE_CHAIN.
void SetLayer(int aLayer)
Function SetLayer()
void SetWeight(unsigned int weight)
size_t i
Definition: json11.cpp:597
int Size() const
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
CN_ITEM(BOARD_CONNECTED_ITEM *aParent, bool aCanChangeNet, int aAnchorCount=2)
static void Connect(CN_ITEM *a, CN_ITEM *b)
void SetNoLine(bool aEnable)
Decides whether this node can be a ratsnest line target.
wxPoint ShapePos() const
Definition: class_pad.cpp:517
void GetDirtyClusters(CLUSTERS &aClusters)
CONNECTED_ITEMS m_connected
list of items physically connected (touching)
bool IsDirty() const
bool CanChangeNet() const
Module description (excepted pads)
CN_ANCHOR_PTR GetSourceNode() const
std::shared_ptr< CN_ANCHOR > CN_ANCHOR_PTR
Class POLY_GRID_PARTITION.
CN_ITEM * m_item
the item we are looking for connections to
std::vector< CN_CLUSTER_PTR > CLUSTERS
std::shared_ptr< CN_CLUSTER > GetCluster() const
const VECTOR2I GetSourcePos() const
bool Dirty() const
Class LAYER_RANGE.
Definition: pns_layerset.h:32
const BOX2I & BBox()
bool m_noline
Whether it the node can be a target for ratsnest lines.
int Size() const
const VECTOR2I & Pos() const
CN_RTREE< CN_ITEM * > m_index
CN_ANCHORS m_anchors