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  // (i.e. shorter timestamp path because paths are /<timestamp1>/<timestamp2>/...
316  // and timestamp = 8 letters.
317  // Note: the final net name uses human sheetpath name, not timestamp sheetpath name
318  // They are equivalent, but not for human readers.
319  if( ! aLabel1->IsLabelGlobal() && ! aLabel2->IsLabelGlobal() )
320  {
321  if( aLabel1->m_SheetPath.Path().Length() != aLabel2->m_SheetPath.Path().Length() )
322  return aLabel1->m_SheetPath.Path().Length() < aLabel2->m_SheetPath.Path().Length();
323  }
324 
325  int priority1 = getPriority( aLabel1 );
326  int priority2 = getPriority( aLabel2 );
327 
328  if( priority1 != priority2 )
329  return priority1 > priority2;
330 
331  // Objects have here the same priority, therefore they have the same type.
332  // for global labels, we select the best candidate by alphabetic order
333  // because they have no sheetpath as prefix name
334  // for other labels, we select them before by sheet deep order
335  // because the actual name is /sheetpath/label
336  // and for a given path length, by alphabetic order
337  if( aLabel1->IsLabelGlobal() )
338  return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
339 
340  // Sheet paths have here the same length: use alphabetic label name order
341  // For labels on sheets having an equivalent deep in hierarchy, use
342  // alphabetic label name order:
343  if( aLabel1->m_Label.Cmp( aLabel2->m_Label ) != 0 )
344  return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
345 
346  // For identical labels having the same priority: choose the
347  // alphabetic label full name order
348  return aLabel1->m_SheetPath.PathHumanReadable().Cmp(
349  aLabel2->m_SheetPath.PathHumanReadable() ) < 0;
350 }
351 
352 
354 {
355  // Important note: NETLIST_ITEM::SHEETLABEL items of sheet items should *NOT* be considered,
356  // because they live in a sheet but their names are actually used in the subsheet.
357  // Moreover, in the parent sheet, the name of NETLIST_ITEM::SHEETLABEL can be not unique,
358  // ( for instance when 2 different sheets share the same schematic in complex hierarchies
359  // and 2 identical NETLIST_ITEM::SHEETLABEL labels can be connected to 2 different nets
360 
361  int netcode = 0; // current netcode for tested items
362  unsigned idxstart = 0; // index of the first item of this net
363  NETLIST_OBJECT* item;
364  NETLIST_OBJECT* candidate;
365 
366  // Pass 1: find the best name for labelled nets:
367  candidate = NULL;
368  for( unsigned ii = 0; ii <= size(); ii++ )
369  {
370  if( ii == size() ) // last item already tested
371  item = NULL;
372  else
373  item = GetItem( ii );
374 
375  if( !item || netcode != item->GetNet() ) // End of net found
376  {
377  if( candidate ) // One or more labels exists, find the best
378  {
379  for (unsigned jj = idxstart; jj < ii; jj++ )
380  GetItem( jj )->SetNetNameCandidate( candidate );
381  }
382 
383  if( item == NULL ) // End of list
384  break;
385 
386  // Prepare next net analysis:
387  netcode = item->GetNet();
388  candidate = NULL;
389  idxstart = ii;
390  }
391 
392  switch( item->m_Type )
393  {
395  case NETLIST_ITEM::LABEL:
399  // A candidate is found: select the better between the previous and this one
400  if( candidate == NULL )
401  candidate = item;
402  else
403  {
404  if( evalLabelsPriority( item, candidate ) )
405  // item has a higher priority than candidate so update the best candidate
406  candidate = item;
407  }
408  break;
409 
410  default:
411  break;
412  }
413  }
414 
415  // Pass 2: find the best name for not labelled nets:
416  // The "default" net name is Net-<<Ref cmp>_Pad<num pad>>
417  // (see NETLIST_OBJECT::GetShortNetName())
418  // therefore the "best" is the short net name alphabetically classed first
419  // (to avoid net names changes when the net is not modified,
420  // even if components are moved or deleted and undelete or replaced, as long
421  // the reference is kept)
422 
423  // Build a list of items with no net names
424  NETLIST_OBJECTS list; // no ownership of elements being pointed at
425 
426  for( unsigned ii = 0; ii < size(); ii++ )
427  {
428  item = GetItem( ii );
429 
430  if( !item->HasNetNameCandidate() )
431  list.push_back( item );
432  }
433 
434  if( list.size() == 0 )
435  return;
436 
437  idxstart = 0;
438  candidate = NULL;
439  netcode = list[0]->GetNet();
440 
441  for( unsigned ii = 0; ii <= list.size(); ii++ )
442  {
443  if( ii < list.size() )
444  item = list[ii];
445  else
446  item = NULL;
447 
448  if( !item || netcode != item->GetNet() ) // End of net found
449  {
450  if( candidate )
451  {
452  for (unsigned jj = idxstart; jj < ii; jj++ )
453  {
454  NETLIST_OBJECT* obj = list[jj];
455  obj->SetNetNameCandidate( candidate );
456  }
457  }
458 
459  if( !item )
460  break;
461 
462  netcode = item->GetNet();
463  candidate = NULL;
464  idxstart = ii;
465  }
466 
467  // Examine all pins of the net to find the best candidate,
468  // i.e. the first net name candidate, by alphabetic order
469  // the net names are built by GetShortNetName
470  // (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
471  // Not named nets do not have usually a lot of members.
472  // Many have only 2 members(a pad and a non connection symbol)
473  if( item->m_Type == NETLIST_ITEM::PIN )
474  {
475  // A candidate is found, however components which are not in
476  // netlist are not candidate because some have their reference
477  // changed each time the netlist is built (power components)
478  // and anyway obviously they are not a good candidate
479  SCH_COMPONENT* link = item->GetComponentParent();
480 
481  if( link && link->IsInNetlist() )
482  {
483  // select the better between the previous and this one
484  item->SetNetNameCandidate( item ); // Needed to calculate GetShortNetName
485 
486  if( candidate == NULL )
487  candidate = item;
488  else
489  {
490  if( item->GetShortNetName().Cmp( candidate->GetShortNetName() ) < 0 )
491  candidate = item;
492  }
493  }
494  }
495  }
496 }
497 
498 
500 {
501  if( SheetLabel->GetNet() == 0 )
502  return;
503 
504  for( unsigned ii = 0; ii < size(); ii++ )
505  {
506  NETLIST_OBJECT* ObjetNet = GetItem( ii );
507 
508  if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
509  continue; //use SheetInclude, not the sheet!!
510 
511  if( ( ObjetNet->m_Type != NETLIST_ITEM::HIERLABEL )
512  && ( ObjetNet->m_Type != NETLIST_ITEM::HIERBUSLABELMEMBER ) )
513  continue;
514 
515  if( ObjetNet->GetNet() == SheetLabel->GetNet() )
516  continue; //already connected.
517 
518  if( ObjetNet->m_Label != SheetLabel->m_Label )
519  continue; //different names.
520 
521  // Propagate Netcode having all the objects of the same Netcode.
522  if( ObjetNet->GetNet() )
523  propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
524  else
525  ObjetNet->SetNet( SheetLabel->GetNet() );
526  }
527 }
528 
529 
531 {
532  // Propagate the net code between all bus label member objects connected by they name.
533  // If the net code is not yet existing, a new one is created
534  // Search is done in the entire list
535  for( unsigned ii = 0; ii < size(); ii++ )
536  {
537  NETLIST_OBJECT* Label = GetItem( ii );
538 
539  if( Label->IsLabelBusMemberType() )
540  {
541  if( Label->GetNet() == 0 )
542  {
543  // Not yet existiing net code: create a new one.
544  Label->SetNet( m_lastNetCode );
545  m_lastNetCode++;
546  }
547 
548  for( unsigned jj = ii + 1; jj < size(); jj++ )
549  {
550  NETLIST_OBJECT* LabelInTst = GetItem( jj );
551 
552  if( LabelInTst->IsLabelBusMemberType() )
553  {
554  if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
555  continue;
556 
557  if( LabelInTst->m_Member != Label->m_Member )
558  continue;
559 
560  if( LabelInTst->GetNet() == 0 )
561  // Append this object to the current net
562  LabelInTst->SetNet( Label->GetNet() );
563  else
564  // Merge the 2 net codes, they are connected.
565  propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
566  }
567  }
568  }
569  }
570 }
571 
572 
573 void NETLIST_OBJECT_LIST::propagateNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus )
574 {
575  if( aOldNetCode == aNewNetCode )
576  return;
577 
578  if( aIsBus == false ) // Propagate NetCode
579  {
580  for( unsigned jj = 0; jj < size(); jj++ )
581  {
582  NETLIST_OBJECT* object = GetItem( jj );
583 
584  if( object->GetNet() == aOldNetCode )
585  object->SetNet( aNewNetCode );
586  }
587  }
588  else // Propagate BusNetCode
589  {
590  for( unsigned jj = 0; jj < size(); jj++ )
591  {
592  NETLIST_OBJECT* object = GetItem( jj );
593 
594  if( object->m_BusNetCode == aOldNetCode )
595  object->m_BusNetCode = aNewNetCode;
596  }
597  }
598 }
599 
600 
601 void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus, int start )
602 {
603  int netCode;
604 
605  if( aIsBus == false ) // Objects other than BUS and BUSLABELS
606  {
607  netCode = aRef->GetNet();
608 
609  for( unsigned i = start; i < size(); i++ )
610  {
611  NETLIST_OBJECT* item = GetItem( i );
612 
613  if( item->m_SheetPath != aRef->m_SheetPath ) //used to be > (why?)
614  continue;
615 
616  switch( item->m_Type )
617  {
619  case NETLIST_ITEM::PIN:
620  case NETLIST_ITEM::LABEL:
627  if( aRef->m_Start == item->m_Start
628  || aRef->m_Start == item->m_End
629  || aRef->m_End == item->m_Start
630  || aRef->m_End == item->m_End )
631  {
632  if( item->GetNet() == 0 )
633  item->SetNet( netCode );
634  else
635  propagateNetCode( item->GetNet(), netCode, IS_WIRE );
636  }
637  break;
638 
639  case NETLIST_ITEM::BUS:
645  break;
646  }
647  }
648  }
649  else // Object type BUS, BUSLABELS, and junctions.
650  {
651  netCode = aRef->m_BusNetCode;
652 
653  for( unsigned i = start; i < size(); i++ )
654  {
655  NETLIST_OBJECT* item = GetItem( i );
656 
657  if( item->m_SheetPath != aRef->m_SheetPath )
658  continue;
659 
660  switch( item->m_Type )
661  {
664  case NETLIST_ITEM::PIN:
665  case NETLIST_ITEM::LABEL:
671  break;
672 
673  case NETLIST_ITEM::BUS:
679  if( aRef->m_Start == item->m_Start
680  || aRef->m_Start == item->m_End
681  || aRef->m_End == item->m_Start
682  || aRef->m_End == item->m_End )
683  {
684  if( item->m_BusNetCode == 0 )
685  item->m_BusNetCode = netCode;
686  else
687  propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
688  }
689  break;
690  }
691  }
692  }
693 }
694 
695 
697  bool aIsBus, int aIdxStart )
698 {
699  for( unsigned i = aIdxStart; i < size(); i++ )
700  {
701  NETLIST_OBJECT* segment = GetItem( i );
702 
703  // if different sheets, obviously no physical connection between elements.
704  if( segment->m_SheetPath != aJonction->m_SheetPath )
705  continue;
706 
707  if( aIsBus == IS_WIRE )
708  {
709  if( segment->m_Type != NETLIST_ITEM::SEGMENT )
710  continue;
711  }
712  else
713  {
714  if( segment->m_Type != NETLIST_ITEM::BUS )
715  continue;
716  }
717 
718  if( IsPointOnSegment( segment->m_Start, segment->m_End, aJonction->m_Start ) )
719  {
720  // Propagation Netcode has all the objects of the same Netcode.
721  if( aIsBus == IS_WIRE )
722  {
723  if( segment->GetNet() )
724  propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
725  else
726  segment->SetNet( aJonction->GetNet() );
727  }
728  else
729  {
730  if( segment->m_BusNetCode )
731  propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
732  else
733  segment->m_BusNetCode = aJonction->m_BusNetCode;
734  }
735  }
736  }
737 }
738 
739 
741 {
742  if( aLabelRef->GetNet() == 0 )
743  return;
744 
745  for( unsigned i = 0; i < size(); i++ )
746  {
747  NETLIST_OBJECT* item = GetItem( i );
748 
749  if( item->GetNet() == aLabelRef->GetNet() )
750  continue;
751 
752  if( item->m_SheetPath != aLabelRef->m_SheetPath )
753  {
756  continue;
757 
758  if( ( item->m_Type == NETLIST_ITEM::GLOBLABEL
760  && item->m_Type != aLabelRef->m_Type )
761  //global labels only connect other global labels.
762  continue;
763  }
764 
765  // NETLIST_ITEM::HIERLABEL are used to connect sheets.
766  // NETLIST_ITEM::LABEL are local to a sheet
767  // NETLIST_ITEM::GLOBLABEL are global.
768  // NETLIST_ITEM::PINLABEL is a kind of global label (generated by a power pin invisible)
769  if( item->IsLabelType() )
770  {
771  if( item->m_Label != aLabelRef->m_Label )
772  continue;
773 
774  if( item->GetNet() )
775  propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
776  else
777  item->SetNet( aLabelRef->GetNet() );
778  }
779  }
780 }
781 
782 
784 {
785  NETLIST_OBJECT* NetItemRef;
786  unsigned NetStart, NetEnd;
787  NET_CONNECTION StateFlag;
788 
789  NetStart = NetEnd = 0;
790  StateFlag = NET_CONNECTION::UNCONNECTED;
791  for( unsigned ii = 0; ii < size(); ii++ )
792  {
793  NetItemRef = GetItem( ii );
794  if( NetItemRef->m_Type == NETLIST_ITEM::NOCONNECT
795  && StateFlag != NET_CONNECTION::PAD_CONNECT )
797 
798  // Analysis of current net.
799  unsigned idxtoTest = ii + 1;
800 
801  if( ( idxtoTest >= size() )
802  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
803  {
804  // Net analysis to update m_ConnectionType
805  NetEnd = idxtoTest;
806 
807  /* set m_ConnectionType member to StateFlag for all items of
808  * this net: */
809  for( unsigned kk = NetStart; kk < NetEnd; kk++ )
810  GetItem( kk )->m_ConnectionType = StateFlag;
811 
812  if( idxtoTest >= size() )
813  return;
814 
815  // Start Analysis next Net
816  StateFlag = NET_CONNECTION::UNCONNECTED;
817  NetStart = idxtoTest;
818  continue;
819  }
820 
821  /* test the current item: if this is a pin and if the reference item
822  * is also a pin, then 2 pins are connected, so set StateFlag to
823  * PAD_CONNECT (can be already done) Of course, if the current
824  * item is a no connect symbol, set StateFlag to
825  * NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
826  * StateFlag is already set to PAD_CONNECT this state is kept (the
827  * no connect symbol was surely an error and an ERC will report this)
828  */
829  for( ; ; idxtoTest++ )
830  {
831  if( ( idxtoTest >= size() )
832  || ( NetItemRef->GetNet() != GetItem( idxtoTest )->GetNet() ) )
833  break;
834 
835  switch( GetItem( idxtoTest )->m_Type )
836  {
838  wxMessageBox( wxT( "BuildNetListBase() error" ) );
839  break;
840 
842  case NETLIST_ITEM::LABEL:
847  case NETLIST_ITEM::BUS:
853  break;
854 
855  case NETLIST_ITEM::PIN:
856  if( NetItemRef->m_Type == NETLIST_ITEM::PIN )
857  StateFlag = NET_CONNECTION::PAD_CONNECT;
858 
859  break;
860 
862  if( StateFlag != NET_CONNECTION::PAD_CONNECT )
864 
865  break;
866  }
867  }
868  }
869 }
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)
Function IsPointOnSegment.
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
wxString Path() const
Function Path the path uses the time stamps which do not changes even when editing sheet parameters a...
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.
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:89
void pointToPointConnect(NETLIST_OBJECT *aRef, bool aIsBus, int start)
wxString GetShortNetName(bool adoptTimestamp=false) const
Function GetShortNetName.
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)