KiCad PCB EDA Suite
netlist_object_list.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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
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 #include <netlist_object.h>
27 #include <class_library.h>
28 #include <sch_junction.h>
29 #include <sch_component.h>
30 #include <sch_line.h>
31 #include <sch_text.h>
32 #include <sch_sheet.h>
33 #include <algorithm>
34 
35 #define IS_WIRE false
36 #define IS_BUS true
37 
38 //#define NETLIST_DEBUG
39 
41 {
42  Clear();
43 }
44 
45 
47 {
48  NETLIST_OBJECTS::iterator iter;
49 
50  for( iter = begin(); iter != end(); iter++ )
51  {
52  NETLIST_OBJECT* item = *iter;
53  delete item;
54  }
55 
56  clear();
57 }
58 
59 
61 {
62  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsbyNetcode );
63 }
64 
65 
67 {
68  sort( this->begin(), this->end(), NETLIST_OBJECT_LIST::sortItemsBySheet );
69 }
70 
71 
73 {
74  SCH_SHEET_PATH* sheet;
75 
76  // Fill list with connected items from the flattened sheet list
77  for( unsigned i = 0; i < aSheets.size(); i++ )
78  {
79  sheet = &aSheets[i];
80 
81  for( auto item : sheet->LastScreen()->Items() )
82  item->GetNetListItem( *this, sheet );
83  }
84 
85  if( size() == 0 )
86  return false;
87 
88  // Sort objects by Sheet
90 
91  sheet = &(GetItem( 0 )->m_SheetPath);
93 
94  for( unsigned ii = 0, istart = 0; ii < size(); ii++ )
95  {
96  NETLIST_OBJECT* net_item = GetItem( ii );
97 
98  if( net_item->m_SheetPath != *sheet ) // Sheet change
99  {
100  sheet = &(net_item->m_SheetPath);
101  istart = ii;
102  }
103 
104  switch( net_item->m_Type )
105  {
107  wxMessageBox( wxT( "BuildNetListInfo() error" ) );
108  break;
109 
110  case NETLIST_ITEM::PIN:
114  if( net_item->GetNet() != 0 )
115  break;
116 
117  // Intentionally fall through if there is no net assigned
118 
120  // Test connections point to point type without bus.
121  if( net_item->GetNet() == 0 )
122  {
123  net_item->SetNet( m_lastNetCode );
124  m_lastNetCode++;
125  }
126 
127  pointToPointConnect( net_item, IS_WIRE, istart );
128  break;
129 
131  // Control of the junction outside BUS.
132  if( net_item->GetNet() == 0 )
133  {
134  net_item->SetNet( m_lastNetCode );
135  m_lastNetCode++;
136  }
137 
138  segmentToPointConnect( net_item, IS_WIRE, istart );
139 
140  // Control of the junction, on BUS.
141  if( net_item->m_BusNetCode == 0 )
142  {
143  net_item->m_BusNetCode = m_lastBusNetCode;
145  }
146 
147  segmentToPointConnect( net_item, IS_BUS, istart );
148  break;
149 
150  case NETLIST_ITEM::LABEL:
153  // Test connections type junction without bus.
154  if( net_item->GetNet() == 0 )
155  {
156  net_item->SetNet( m_lastNetCode );
157  m_lastNetCode++;
158  }
159 
160  segmentToPointConnect( net_item, IS_WIRE, istart );
161  break;
162 
164  if( net_item->m_BusNetCode != 0 )
165  break;
166 
167  // Intentionally fall through if there is no bus assigned
168 
169  case NETLIST_ITEM::BUS:
170  // Control type connections point to point mode bus
171  if( net_item->m_BusNetCode == 0 )
172  {
173  net_item->m_BusNetCode = m_lastBusNetCode;
175  }
176 
177  pointToPointConnect( net_item, IS_BUS, istart );
178  break;
179 
183  // Control connections similar has on BUS
184  if( net_item->GetNet() == 0 )
185  {
186  net_item->m_BusNetCode = m_lastBusNetCode;
188  }
189 
190  segmentToPointConnect( net_item, IS_BUS, istart );
191  break;
192  }
193  }
194 
195 #if defined(NETLIST_DEBUG) && defined(DEBUG)
196  std::cout << "\n\nafter sheet local\n\n";
197  DumpNetTable();
198 #endif
199 
200  // Updating the Bus Labels Netcode connected by Bus
202 
203  // Group objects by label.
204  for( unsigned ii = 0; ii < size(); ii++ )
205  {
206  switch( GetItem( ii )->m_Type )
207  {
208  case NETLIST_ITEM::PIN:
212  case NETLIST_ITEM::BUS:
214  break;
215 
216  case NETLIST_ITEM::LABEL:
221  labelConnect( GetItem( ii ) );
222  break;
223 
227  break;
228 
230  break;
231  }
232  }
233 
234 #if defined(NETLIST_DEBUG) && defined(DEBUG)
235  std::cout << "\n\nafter sheet global\n\n";
236  DumpNetTable();
237 #endif
238 
239  // Connection between hierarchy sheets
240  for( unsigned ii = 0; ii < size(); ii++ )
241  {
244  sheetLabelConnect( GetItem( ii ) );
245  }
246 
247  // Sort objects by NetCode
249 
250 #if defined(NETLIST_DEBUG) && defined(DEBUG)
251  std::cout << "\n\nafter qsort()\n";
252  DumpNetTable();
253 #endif
254 
255  // Compress numbers of Netcode having consecutive values.
256  int NetCode = 0;
257  m_lastNetCode = 0;
258 
259  for( unsigned ii = 0; ii < size(); ii++ )
260  {
261  if( GetItem( ii )->GetNet() != m_lastNetCode )
262  {
263  NetCode++;
264  m_lastNetCode = GetItem( ii )->GetNet();
265  }
266 
267  GetItem( ii )->SetNet( NetCode );
268  }
269 
270  // Set the minimal connection info:
272 
273  // find the best label object to give the best net name to each net
275 
276  return true;
277 }
278 
279 // Helper function to give a priority to sort labels:
280 // NETLIST_ITEM::PINLABEL, NETLIST_ITEM::GLOBBUSLABELMEMBER and NETLIST_ITEM::GLOBLABEL are global labels
281 // and the priority is high
282 static int getPriority( const NETLIST_OBJECT* Objet )
283 {
284  switch( Objet->m_Type )
285  {
286  case NETLIST_ITEM::PIN:
287  return 1;
288  case NETLIST_ITEM::LABEL:
289  return 2;
291  return 3;
293  return 4;
295  return 5;
297  return 6;
298  default:
299  break;
300  }
301 
302  return 0;
303 }
304 
305 
306 /* function evalLabelsPriority used by findBestNetNameForEachNet()
307  * evalLabelsPriority calculates the priority of alabel1 and aLabel2
308  * return true if alabel1 has a higher priority than aLabel2
309  */
310 static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1, const NETLIST_OBJECT* aLabel2 )
311 {
312  // Global labels have the highest prioriy.
313  // For local labels: names are prefixed by their sheetpath
314  // use name defined in the more top level hierarchical sheet
315  // Note: the final net name uses human sheetpath name, not timestamp sheetpath name
316  // They are equivalent, but not for human readers.
317  if( ! aLabel1->IsLabelGlobal() && ! aLabel2->IsLabelGlobal() )
318  {
319  if( aLabel1->m_SheetPath.size() != aLabel2->m_SheetPath.size() )
320  return aLabel1->m_SheetPath.size() < aLabel2->m_SheetPath.size();
321  }
322 
323  int priority1 = getPriority( aLabel1 );
324  int priority2 = getPriority( aLabel2 );
325 
326  if( priority1 != priority2 )
327  return priority1 > priority2;
328 
329  // Objects have here the same priority, therefore they have the same type.
330  // for global labels, we select the best candidate by alphabetic order
331  // because they have no sheetpath as prefix name
332  // for other labels, we select them before by sheet deep order
333  // because the actual name is /sheetpath/label
334  // and for a given path length, by alphabetic order
335  if( aLabel1->IsLabelGlobal() )
336  return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
337 
338  // Sheet paths have here the same length: use alphabetic label name order
339  // For labels on sheets having an equivalent deep in hierarchy, use
340  // alphabetic label name order:
341  if( aLabel1->m_Label.Cmp( aLabel2->m_Label ) != 0 )
342  return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
343 
344  // For identical labels having the same priority: choose the
345  // alphabetic label full name order
346  return aLabel1->m_SheetPath.PathHumanReadable().Cmp(
347  aLabel2->m_SheetPath.PathHumanReadable() ) < 0;
348 }
349 
350 
352 {
353  // Important note: NETLIST_ITEM::SHEETLABEL items of sheet items should *NOT* be considered,
354  // because they live in a sheet but their names are actually used in the subsheet.
355  // Moreover, in the parent sheet, the name of NETLIST_ITEM::SHEETLABEL can be not unique,
356  // ( for instance when 2 different sheets share the same schematic in complex hierarchies
357  // and 2 identical NETLIST_ITEM::SHEETLABEL labels can be connected to 2 different nets
358 
359  int netcode = 0; // current netcode for tested items
360  unsigned idxstart = 0; // index of the first item of this net
361  NETLIST_OBJECT* item;
362  NETLIST_OBJECT* candidate;
363 
364  // Pass 1: find the best name for labelled nets:
365  candidate = NULL;
366  for( unsigned ii = 0; ii <= size(); ii++ )
367  {
368  if( ii == size() ) // last item already tested
369  item = NULL;
370  else
371  item = GetItem( ii );
372 
373  if( !item || netcode != item->GetNet() ) // End of net found
374  {
375  if( candidate ) // One or more labels exists, find the best
376  {
377  for (unsigned jj = idxstart; jj < ii; jj++ )
378  GetItem( jj )->SetNetNameCandidate( candidate );
379  }
380 
381  if( item == NULL ) // End of list
382  break;
383 
384  // Prepare next net analysis:
385  netcode = item->GetNet();
386  candidate = NULL;
387  idxstart = ii;
388  }
389 
390  switch( item->m_Type )
391  {
393  case NETLIST_ITEM::LABEL:
397  // A candidate is found: select the better between the previous and this one
398  if( candidate == NULL )
399  candidate = item;
400  else
401  {
402  if( evalLabelsPriority( item, candidate ) )
403  // item has a higher priority than candidate so update the best candidate
404  candidate = item;
405  }
406  break;
407 
408  default:
409  break;
410  }
411  }
412 
413  // Pass 2: find the best name for not labelled nets:
414  // The "default" net name is Net-<<Ref cmp>_Pad<num pad>>
415  // (see NETLIST_OBJECT::GetShortNetName())
416  // therefore the "best" is the short net name alphabetically classed first
417  // (to avoid net names changes when the net is not modified,
418  // even if components are moved or deleted and undelete or replaced, as long
419  // the reference is kept)
420 
421  // Build a list of items with no net names
422  NETLIST_OBJECTS list; // no ownership of elements being pointed at
423 
424  for( unsigned ii = 0; ii < size(); ii++ )
425  {
426  item = GetItem( ii );
427 
428  if( !item->HasNetNameCandidate() )
429  list.push_back( item );
430  }
431 
432  if( list.size() == 0 )
433  return;
434 
435  idxstart = 0;
436  candidate = NULL;
437  netcode = list[0]->GetNet();
438 
439  for( unsigned ii = 0; ii <= list.size(); ii++ )
440  {
441  if( ii < list.size() )
442  item = list[ii];
443  else
444  item = NULL;
445 
446  if( !item || netcode != item->GetNet() ) // End of net found
447  {
448  if( candidate )
449  {
450  for (unsigned jj = idxstart; jj < ii; jj++ )
451  {
452  NETLIST_OBJECT* obj = list[jj];
453  obj->SetNetNameCandidate( candidate );
454  }
455  }
456 
457  if( !item )
458  break;
459 
460  netcode = item->GetNet();
461  candidate = NULL;
462  idxstart = ii;
463  }
464 
465  // Examine all pins of the net to find the best candidate,
466  // i.e. the first net name candidate, by alphabetic order
467  // the net names are built by GetShortNetName
468  // (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
469  // Not named nets do not have usually a lot of members.
470  // Many have only 2 members(a pad and a non connection symbol)
471  if( item->m_Type == NETLIST_ITEM::PIN )
472  {
473  // A candidate is found, however components which are not in
474  // netlist are not candidate because some have their reference
475  // changed each time the netlist is built (power components)
476  // and anyway obviously they are not a good candidate
477  SCH_COMPONENT* link = item->GetComponentParent();
478 
479  if( link && link->IsInNetlist() )
480  {
481  // select the better between the previous and this one
482  item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName
483 
484  if( candidate == NULL )
485  candidate = item;
486  else
487  {
488  if( item->GetShortNetName().Cmp( candidate->GetShortNetName() ) < 0 )
489  candidate = item;
490  }
491  }
492  }
493  }
494 }
495 
496 
498 {
499  if( SheetLabel->GetNet() == 0 )
500  return;
501 
502  for( unsigned ii = 0; ii < size(); ii++ )
503  {
504  NETLIST_OBJECT* ObjetNet = GetItem( ii );
505 
506  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
507  continue; //use SheetInclude, not the sheet!!
508 
509  if( ( ObjetNet->m_Type != NETLIST_ITEM::HIERLABEL )
510  && ( ObjetNet->m_Type != NETLIST_ITEM::HIERBUSLABELMEMBER ) )
511  continue;
512 
513  if( ObjetNet->GetNet() == SheetLabel->GetNet() )
514  continue; //already connected.
515 
516  if( ObjetNet->m_Label != SheetLabel->m_Label )
517  continue; //different names.
518 
519  // Propagate Netcode having all the objects of the same Netcode.
520  if( ObjetNet->GetNet() )
521  propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
522  else
523  ObjetNet->SetNet( SheetLabel->GetNet() );
524  }
525 }
526 
527 
529 {
530  // Propagate the net code between all bus label member objects connected by they name.
531  // If the net code is not yet existing, a new one is created
532  // Search is done in the entire list
533  for( unsigned ii = 0; ii < size(); ii++ )
534  {
535  NETLIST_OBJECT* Label = GetItem( ii );
536 
537  if( Label->IsLabelBusMemberType() )
538  {
539  if( Label->GetNet() == 0 )
540  {
541  // Not yet existiing net code: create a new one.
542  Label->SetNet( m_lastNetCode );
543  m_lastNetCode++;
544  }
545 
546  for( unsigned jj = ii + 1; jj < size(); jj++ )
547  {
548  NETLIST_OBJECT* LabelInTst = GetItem( jj );
549 
550  if( LabelInTst->IsLabelBusMemberType() )
551  {
552  if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
553  continue;
554 
555  if( LabelInTst->m_Member != Label->m_Member )
556  continue;
557 
558  if( LabelInTst->GetNet() == 0 )
559  // Append this object to the current net
560  LabelInTst->SetNet( Label->GetNet() );
561  else
562  // Merge the 2 net codes, they are connected.
563  propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
564  }
565  }
566  }
567  }
568 }
569 
570 
571 void NETLIST_OBJECT_LIST::propagateNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus )
572 {
573  if( aOldNetCode == aNewNetCode )
574  return;
575 
576  if( aIsBus == false ) // Propagate NetCode
577  {
578  for( unsigned jj = 0; jj < size(); jj++ )
579  {
580  NETLIST_OBJECT* object = GetItem( jj );
581 
582  if( object->GetNet() == aOldNetCode )
583  object->SetNet( aNewNetCode );
584  }
585  }
586  else // Propagate BusNetCode
587  {
588  for( unsigned jj = 0; jj < size(); jj++ )
589  {
590  NETLIST_OBJECT* object = GetItem( jj );
591 
592  if( object->m_BusNetCode == aOldNetCode )
593  object->m_BusNetCode = aNewNetCode;
594  }
595  }
596 }
597 
598 
599 void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus, int start )
600 {
601  int netCode;
602 
603  if( aIsBus == false ) // Objects other than BUS and BUSLABELS
604  {
605  netCode = aRef->GetNet();
606 
607  for( unsigned i = start; i < size(); i++ )
608  {
609  NETLIST_OBJECT* item = GetItem( i );
610 
611  if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
612  continue;
613 
614  switch( item->m_Type )
615  {
617  case NETLIST_ITEM::PIN:
618  case NETLIST_ITEM::LABEL:
625  if( aRef->m_Start == item->m_Start
626  || aRef->m_Start == item->m_End
627  || aRef->m_End == item->m_Start
628  || aRef->m_End == item->m_End )
629  {
630  if( item->GetNet() == 0 )
631  item->SetNet( netCode );
632  else
633  propagateNetCode( item->GetNet(), netCode, IS_WIRE );
634  }
635  break;
636 
637  case NETLIST_ITEM::BUS:
643  break;
644  }
645  }
646  }
647  else // Object type BUS, BUSLABELS, and junctions.
648  {
649  netCode = aRef->m_BusNetCode;
650 
651  for( unsigned i = start; i < size(); i++ )
652  {
653  NETLIST_OBJECT* item = GetItem( i );
654 
655  if( item->m_SheetPath != aRef->m_SheetPath )
656  continue;
657 
658  switch( item->m_Type )
659  {
662  case NETLIST_ITEM::PIN:
663  case NETLIST_ITEM::LABEL:
669  break;
670 
671  case NETLIST_ITEM::BUS:
677  if( aRef->m_Start == item->m_Start
678  || aRef->m_Start == item->m_End
679  || aRef->m_End == item->m_Start
680  || aRef->m_End == item->m_End )
681  {
682  if( item->m_BusNetCode == 0 )
683  item->m_BusNetCode = netCode;
684  else
685  propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
686  }
687  break;
688  }
689  }
690  }
691 }
692 
693 
695  bool aIsBus, int aIdxStart )
696 {
697  for( unsigned i = aIdxStart; i < size(); i++ )
698  {
699  NETLIST_OBJECT* segment = GetItem( i );
700 
701  // if different sheets, obviously no physical connection between elements.
702  if( segment->m_SheetPath != aJonction->m_SheetPath )
703  continue;
704 
705  if( aIsBus == IS_WIRE )
706  {
707  if( segment->m_Type != NETLIST_ITEM::SEGMENT )
708  continue;
709  }
710  else
711  {
712  if( segment->m_Type != NETLIST_ITEM::BUS )
713  continue;
714  }
715 
716  if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
717  {
718  // Propagation Netcode has all the objects of the same Netcode.
719  if( aIsBus == IS_WIRE )
720  {
721  if( segment->GetNet() )
722  propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
723  else
724  segment->SetNet( aJonction->GetNet() );
725  }
726  else
727  {
728  if( segment->m_BusNetCode )
729  propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
730  else
731  segment->m_BusNetCode = aJonction->m_BusNetCode;
732  }
733  }
734  }
735 }
736 
737 
739 {
740  if( aLabelRef->GetNet() == 0 )
741  return;
742 
743  for( unsigned i = 0; i < size(); i++ )
744  {
745  NETLIST_OBJECT* item = GetItem( i );
746 
747  if( item->GetNet() == aLabelRef->GetNet() )
748  continue;
749 
750  if( item->m_SheetPath != aLabelRef->m_SheetPath )
751  {
754  continue;
755 
756  if( ( item->m_Type == NETLIST_ITEM::GLOBLABEL
758  && item->m_Type != aLabelRef->m_Type )
759  //global labels only connect other global labels.
760  continue;
761  }
762 
763  // NETLIST_ITEM::HIERLABEL are used to connect sheets.
764  // NETLIST_ITEM::LABEL are local to a sheet
765  // NETLIST_ITEM::GLOBLABEL are global.
766  // NETLIST_ITEM::PINLABEL is a kind of global label (generated by a power pin invisible)
767  if( item->IsLabelType() )
768  {
769  if( item->m_Label != aLabelRef->m_Label )
770  continue;
771 
772  if( item->GetNet() )
773  propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
774  else
775  item->SetNet( aLabelRef->GetNet() );
776  }
777  }
778 }
779 
780 
782 {
783  NETLIST_OBJECT* NetItemRef;
784  unsigned NetStart, NetEnd;
785  NET_CONNECTION StateFlag;
786 
787  NetStart = NetEnd = 0;
788  StateFlag = NET_CONNECTION::UNCONNECTED;
789  for( unsigned ii = 0; ii < size(); ii++ )
790  {
791  NetItemRef = GetItem( ii );
792  if( NetItemRef->m_Type == NETLIST_ITEM::NOCONNECT
793  && StateFlag != NET_CONNECTION::PAD_CONNECT )
795 
796  // Analysis of current net.
797  unsigned idxtoTest = ii + 1;
798 
799  if( ( idxtoTest >= size() )
800  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
801  {
802  // Net analysis to update m_ConnectionType
803  NetEnd = idxtoTest;
804 
805  /* set m_ConnectionType member to StateFlag for all items of
806  * this net: */
807  for( unsigned kk = NetStart; kk < NetEnd; kk++ )
808  GetItem( kk )->m_ConnectionType = StateFlag;
809 
810  if( idxtoTest >= size() )
811  return;
812 
813  // Start Analysis next Net
814  StateFlag = NET_CONNECTION::UNCONNECTED;
815  NetStart = idxtoTest;
816  continue;
817  }
818 
819  /* test the current item: if this is a pin and if the reference item
820  * is also a pin, then 2 pins are connected, so set StateFlag to
821  * PAD_CONNECT (can be already done) Of course, if the current
822  * item is a no connect symbol, set StateFlag to
823  * NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
824  * StateFlag is already set to PAD_CONNECT this state is kept (the
825  * no connect symbol was surely an error and an ERC will report this)
826  */
827  for( ; ; idxtoTest++ )
828  {
829  if( ( idxtoTest >= size() )
830  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
831  break;
832 
833  switch( GetItem( idxtoTest )->m_Type )
834  {
836  wxMessageBox( wxT( "BuildNetListBase() error" ) );
837  break;
838 
840  case NETLIST_ITEM::LABEL:
845  case NETLIST_ITEM::BUS:
851  break;
852 
853  case NETLIST_ITEM::PIN:
854  if( NetItemRef->m_Type == NETLIST_ITEM::PIN )
855  StateFlag = NET_CONNECTION::PAD_CONNECT;
856 
857  break;
858 
860  if( StateFlag != NET_CONNECTION::PAD_CONNECT )
862 
863  break;
864  }
865  }
866  }
867 }
SCH_SHEET_LIST.
void setUnconnectedFlag()
Set the m_FlagOfConnection member of items in list depending on the connection type: UNCONNECTED,...
SCH_COMPONENT * GetComponentParent() const
For Pins (NET_PINS):
void connectBusLabels()
Function connectBusLabels Propagate the net code (and create it, if not yet existing) between all bus...
static bool evalLabelsPriority(const NETLIST_OBJECT *aLabel1, const NETLIST_OBJECT *aLabel2)
SCH_SHEET_PATH m_SheetPathInclude
int GetNet() const
std::vector< NETLIST_OBJECT * > NETLIST_OBJECTS
Type NETLIST_OBJECTS is a container referring to (not owning) NETLIST_OBJECTs, which are connected it...
bool BuildNetListInfo(SCH_SHEET_LIST &aSheets)
Function BuildNetListInfo the master function of tgis class.
bool IsInNetlist() const
bool IsPointOnSegment(const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint)
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
Definition: trigo.cpp:42
#define IS_BUS
SCH_SHEET_PATH m_SheetPath
void findBestNetNameForEachNet()
Function findBestNetNameForEachNet fill the .m_NetNameCandidate member of each item of aNetItemBuffer...
bool IsLabelType() const
Function IsLabelType.
NET_CONNECTION
void labelConnect(NETLIST_OBJECT *aLabelRef)
void Clear()
Delete all objects in list and clear list.
void sheetLabelConnect(NETLIST_OBJECT *aSheetLabel)
Propagate net codes from a parent sheet to an include sheet, from a pin sheet connection.
bool IsLabelBusMemberType() const
Function IsLabelBusMemberType.
bool IsLabelGlobal() const
Function IsLabelGlobal.
void segmentToPointConnect(NETLIST_OBJECT *aJonction, bool aIsBus, int aIdxStart)
Search connections between a junction and segments Propagate the junction net code to objects connect...
static bool sortItemsBySheet(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
#define NULL
size_t size() const
Forwarded method from std::vector.
static bool sortItemsbyNetcode(const NETLIST_OBJECT *Objet1, const NETLIST_OBJECT *Objet2)
void propagateNetCode(int aOldNetCode, int aNewNetCode, bool aIsBus)
#define IS_WIRE
SCH_SHEET_PATH.
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
SCH_SCREEN * LastScreen()
Function LastScreen.
wxString GetShortNetName() const
Function GetShortNetName.
void SetNet(int aNetCode)
EE_RTREE & Items()
Definition: sch_screen.h:127
void SetNetNameCandidate(NETLIST_OBJECT *aCandidate)
Set m_netNameCandidate to a connected item which will be used to calcule the net name of the item Obv...
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:99
void pointToPointConnect(NETLIST_OBJECT *aRef, bool aIsBus, int start)
bool HasNetNameCandidate()
Definition for part library class.
NET_CONNECTION m_ConnectionType
wxString PathHumanReadable() const
Function PathHumanReadable returns the sheet path in a human readable form, i.e.
Definition of the NETLIST_OBJECT class.
NETLIST_ITEM m_Type
static int getPriority(const NETLIST_OBJECT *Objet)