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