KiCad PCB EDA Suite
board_netlist_updater.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2015 CERN
11  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
12  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
13  *
14  * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, you may find one here:
28  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
29  * or you may search the http://www.gnu.org website for the version 2 license,
30  * or you may write to the Free Software Foundation, Inc.,
31  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
32  */
33 
34 
35 #include <common.h> // for PAGE_INFO
36 
37 #include <class_board.h>
38 #include <netinfo.h>
39 #include <class_module.h>
40 #include <class_pad.h>
41 #include <class_zone.h>
42 
43 #include <pcb_netlist.h>
44 #include <connectivity_data.h>
45 #include <reporter.h>
46 
47 #include <board_netlist_updater.h>
48 
49 #include <pcb_edit_frame.h>
50 
51 
53  m_commit( aFrame ),
54  m_board( aBoard )
55 {
57 
58  m_deleteSinglePadNets = true;
60  m_isDryRun = false;
61  m_replaceFootprints = true;
62  m_lookupByTimestamp = false;
63 
64  m_warningCount = 0;
65  m_errorCount = 0;
66 }
67 
68 
70 {
71 }
72 
73 
74 // These functions allow inspection of pad nets during dry runs by keeping a cache of
75 // current pad netnames indexed by pad.
76 
77 void BOARD_NETLIST_UPDATER::cacheNetname( D_PAD* aPad, const wxString& aNetname )
78 {
79  m_padNets[ aPad ] = aNetname;
80 }
81 
83 {
84  if( m_isDryRun && m_padNets.count( aPad ) )
85  return m_padNets[ aPad ];
86  else
87  return aPad->GetNetname();
88 }
89 
90 
92 {
93  wxPoint bestPosition;
94 
95  if( !m_board->IsEmpty() )
96  {
97  // Position new components below any existing board features.
99 
100  if( bbox.GetWidth() || bbox.GetHeight() )
101  {
102  bestPosition.x = bbox.Centre().x;
103  bestPosition.y = bbox.GetBottom() + Millimeter2iu( 10 );
104  }
105  }
106  else
107  {
108  // Position new components in the center of the page when the board is empty.
109  wxSize pageSize = m_board->GetPageSettings().GetSizeIU();
110 
111  bestPosition.x = pageSize.GetWidth() / 2;
112  bestPosition.y = pageSize.GetHeight() / 2;
113  }
114 
115  return bestPosition;
116 }
117 
118 
120 {
121  wxString msg;
122 
123  if( aComponent->GetModule() != NULL )
124  {
125  msg.Printf( _( "Adding new symbol \"%s:%s\" footprint \"%s\".\n" ),
126  GetChars( aComponent->GetReference() ),
127  GetChars( aComponent->GetTimeStamp() ),
128  GetChars( aComponent->GetFPID().Format() ) );
130 
131  msg.Printf( _( "Add symbol %s, footprint: %s.\n" ),
132  GetChars( aComponent->GetReference() ),
133  GetChars( aComponent->GetFPID().Format() ) );
135 
136 
137  if( !m_isDryRun )
138  {
139  // Owned by NETLIST, can only copy it.
140  MODULE* footprint = new MODULE( *aComponent->GetModule() );
141  footprint->SetParent( m_board );
143  footprint->SetTimeStamp( GetNewTimeStamp() );
144 
145  m_addedComponents.push_back( footprint );
146  m_commit.Add( footprint );
147 
148  return footprint;
149  }
150  }
151  else
152  {
153  msg.Printf( _( "Cannot add symbol %s due to missing footprint %s.\n" ),
154  GetChars( aComponent->GetReference() ),
155  GetChars( aComponent->GetFPID().Format() ) );
156 
158 
159  msg.Printf( _( "Cannot add new symbol \"%s:%s\" due to missing "
160  "footprint \"%s\".\n" ),
161  GetChars( aComponent->GetReference() ),
162  GetChars( aComponent->GetTimeStamp() ),
163  GetChars( aComponent->GetFPID().Format() ) );
164 
166  ++m_errorCount;
167  }
168 
169  return NULL;
170 }
171 
172 
173 MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcbComponent, COMPONENT* aNewComponent )
174 {
175  wxString msg;
176 
177  if( !m_replaceFootprints )
178  return NULL;
179 
180  // Test if the footprint has not changed
181  if( aNewComponent->GetFPID().empty() || aPcbComponent->GetFPID() == aNewComponent->GetFPID() )
182  return NULL;
183 
184  if( aNewComponent->GetModule() != NULL )
185  {
186  msg.Printf( _( "Change symbol %s footprint from %s to %s.\n"),
187  GetChars( aPcbComponent->GetReference() ),
188  GetChars( aPcbComponent->GetFPID().Format() ),
189  GetChars( aNewComponent->GetFPID().Format() ) );
190 
192 
193  msg.Printf( _( "Replacing symbol \"%s:%s\" footprint \"%s\" with "
194  "\"%s\".\n" ),
195  GetChars( aPcbComponent->GetReference() ),
196  GetChars( aPcbComponent->GetPath() ),
197  GetChars( aPcbComponent->GetFPID().Format() ),
198  GetChars( aNewComponent->GetFPID().Format() ) );
199 
201 
202  if( !m_isDryRun )
203  {
204  wxASSERT( aPcbComponent != NULL );
205 
206  MODULE* newFootprint = new MODULE( *aNewComponent->GetModule() );
207  newFootprint->SetParent( m_board );
208 
209  if( aNetlist.IsFindByTimeStamp() )
210  newFootprint->SetReference( aPcbComponent->GetReference() );
211  else
212  newFootprint->SetPath( aPcbComponent->GetPath() );
213 
214  aPcbComponent->CopyNetlistSettings( newFootprint, false );
215  m_commit.Remove( aPcbComponent );
216  m_commit.Add( newFootprint );
217 
218  return newFootprint;
219  }
220  }
221  else
222  {
223  msg.Printf( _( "Cannot change symbol %s footprint due to missing "
224  "footprint %s.\n" ),
225  GetChars( aPcbComponent->GetReference() ),
226  GetChars( aNewComponent->GetFPID().Format() ) );
227 
229 
230  msg.Printf( _( "Cannot replace symbol \"%s:%s\" due to missing "
231  "footprint \"%s\".\n" ),
232  GetChars( aPcbComponent->GetReference() ),
233  GetChars( aPcbComponent->GetPath() ),
234  GetChars( aNewComponent->GetFPID().Format() ) );
235 
237 
238  ++m_errorCount;
239  }
240 
241  return NULL;
242 }
243 
244 
246 {
247  wxString msg;
248 
249  if( !aPcbComponent )
250  return false;
251 
252  // Create a copy only if the module has not been added during this update
253  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
254  bool changed = false;
255 
256  // Test for reference designator field change.
257  if( aPcbComponent->GetReference() != aNewComponent->GetReference() )
258  {
259  msg.Printf( _( "Change symbol %s reference to %s.\n" ),
260  GetChars( aPcbComponent->GetReference() ),
261  GetChars( aNewComponent->GetReference() ) );
262 
264 
265  msg.Printf( _( "Changing symbol \"%s:%s\" reference to \"%s\".\n" ),
266  GetChars( aPcbComponent->GetReference() ),
267  GetChars( aPcbComponent->GetPath() ),
268  GetChars( aNewComponent->GetReference() ) );
269 
271 
272  if ( !m_isDryRun )
273  {
274  changed = true;
275  aPcbComponent->SetReference( aNewComponent->GetReference() );
276  }
277  }
278 
279  // Test for value field change.
280  if( aPcbComponent->GetValue() != aNewComponent->GetValue() )
281  {
282  msg.Printf( _( "Change symbol %s value from %s to %s.\n" ),
283  GetChars( aPcbComponent->GetReference() ),
284  GetChars( aPcbComponent->GetValue() ),
285  GetChars( aNewComponent->GetValue() ) );
286 
288 
289  msg.Printf( _( "Changing symbol \"%s:%s\" value from \"%s\" to \"%s\".\n" ),
290  GetChars( aPcbComponent->GetReference() ),
291  GetChars( aPcbComponent->GetPath() ),
292  GetChars( aPcbComponent->GetValue() ),
293  GetChars( aNewComponent->GetValue() ) );
294 
296 
297  if( !m_isDryRun )
298  {
299  changed = true;
300  aPcbComponent->SetValue( aNewComponent->GetValue() );
301  }
302  }
303 
304  // Test for time stamp change.
305  if( aPcbComponent->GetPath() != aNewComponent->GetTimeStamp() )
306  {
307  msg.Printf( _( "Changing symbol path \"%s:%s\" to \"%s\".\n" ),
308  GetChars( aPcbComponent->GetReference() ),
309  GetChars( aPcbComponent->GetPath() ),
310  GetChars( aNewComponent->GetTimeStamp() ) );
311 
313 
314  if( !m_isDryRun )
315  {
316  changed = true;
317  aPcbComponent->SetPath( aNewComponent->GetTimeStamp() );
318  }
319  }
320 
321  if( changed && copy )
322  m_commit.Modified( aPcbComponent, copy );
323  else
324  delete copy;
325 
326  return true;
327 }
328 
329 
331 {
332  wxString msg;
333 
334  // Create a copy only if the module has not been added during this update
335  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
336  bool changed = false;
337 
338  // At this point, the component footprint is updated. Now update the nets.
339  for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
340  {
341  COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
342 
343  if( !net.IsValid() ) // New footprint pad has no net.
344  {
345  if( !pad->GetNetname().IsEmpty() )
346  {
347  msg.Printf( _( "Disconnect symbol %s pin %s.\n" ),
348  GetChars( aPcbComponent->GetReference() ),
349  GetChars( pad->GetName() ) );
351 
352  msg.Printf( _( "Clearing symbol \"%s:%s\" pin \"%s\" net name.\n" ),
353  GetChars( aPcbComponent->GetReference() ),
354  GetChars( aPcbComponent->GetPath() ),
355  GetChars( pad->GetName() ) );
357  }
358 
359  if( !m_isDryRun )
360  {
361  changed = true;
362  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
363  }
364  else
365  cacheNetname( pad, wxEmptyString );
366  }
367  else // New footprint pad has a net.
368  {
369  if( net.GetNetName() != pad->GetNetname() )
370  {
371  const wxString& netName = net.GetNetName();
372  NETINFO_ITEM* netinfo = m_board->FindNet( netName );
373 
374  if( netinfo == nullptr )
375  {
376  // It might be a new net that has not been added to the board yet
377  if( m_addedNets.count( netName ) )
378  netinfo = m_addedNets[ netName ];
379  }
380 
381  if( netinfo == nullptr )
382  {
383  // It is a new net, we have to add it
384  if( !m_isDryRun )
385  {
386  changed = true;
387  netinfo = new NETINFO_ITEM( m_board, netName );
388  m_commit.Add( netinfo );
389  m_addedNets[netName] = netinfo;
390  }
391 
392  msg.Printf( _( "Add net %s.\n" ), GetChars( netName ) );
394  }
395 
396  if( !pad->GetNetname().IsEmpty() )
397  {
398  msg.Printf( _( "Reconnect symbol %s pin %s from net %s to net %s.\n"),
399  GetChars( aPcbComponent->GetReference() ),
400  GetChars( pad->GetName() ),
401  GetChars( pad->GetNetname() ),
402  GetChars( netName ) );
403 
404  } else {
405  msg.Printf( _( "Connect symbol %s pin %s to net %s.\n"),
406  GetChars( aPcbComponent->GetReference() ),
407  GetChars( pad->GetName() ),
408  GetChars( netName ) );
409  }
410 
412 
413  msg.Printf( _( "Changing symbol \"%s:%s\" pin \"%s\" net name from "
414  "\"%s\" to \"%s\".\n" ),
415  GetChars( aPcbComponent->GetReference() ),
416  GetChars( aPcbComponent->GetPath() ),
417  GetChars( pad->GetName() ),
418  GetChars( pad->GetNetname() ),
419  GetChars( netName ) );
421 
422  if( !m_isDryRun )
423  {
424  changed = true;
425  pad->SetNet( netinfo );
426  }
427  else
428  cacheNetname( pad, netName );
429  }
430  }
431  }
432 
433  if( changed && copy )
434  m_commit.Modified( aPcbComponent, copy );
435  else
436  delete copy;
437 
438  return true;
439 }
440 
441 
443 {
444  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
445  {
446  ZONE_CONTAINER* zone = m_board->GetArea( ii );
447 
448  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
449  continue;
450 
451  m_zoneConnectionsCache[ zone ] = m_board->GetConnectivity()->GetConnectedPads( zone );
452  }
453 }
454 
455 
457 {
458  wxString msg;
459  std::set<wxString> netlistNetnames;
460 
461  for( int ii = 0; ii < (int) aNetlist.GetCount(); ii++ )
462  {
463  const COMPONENT* component = aNetlist.GetComponent( ii );
464  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
465  {
466  const COMPONENT_NET& net = component->GetNet( jj );
467  netlistNetnames.insert( net.GetNetName() );
468  }
469  }
470 
471  // Test copper zones to detect "dead" nets (nets without any pad):
472  for( int i = 0; i < m_board->GetAreaCount(); i++ )
473  {
474  ZONE_CONTAINER* zone = m_board->GetArea( i );
475 
476  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
477  continue;
478 
479  if( netlistNetnames.count( zone->GetNetname() ) == 0 )
480  {
481  // Look for a pad in the zone's connected-pad-cache which has been updated to
482  // a new net and use that. While this won't always be the right net, the dead
483  // net is guaranteed to be wrong.
484  wxString updatedNetname = wxEmptyString;
485 
486  for( D_PAD* pad : m_zoneConnectionsCache[ zone ] )
487  {
488  if( getNetname( pad ) != zone->GetNetname() )
489  {
490  updatedNetname = getNetname( pad );
491  break;
492  }
493  }
494 
495  if( !updatedNetname.IsEmpty() )
496  {
497  msg.Printf( _( "Reconnect copper zone from net \"%s\" to net \"%s\"." ),
498  zone->GetNetname(), updatedNetname );
500 
501  msg.Printf( _( "Changing copper zone net name from \"%s\" to \"%s\"." ),
502  zone->GetNetname(), updatedNetname );
504 
505  if( !m_isDryRun )
506  {
507  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
508 
509  if( !netinfo )
510  netinfo = m_addedNets[ updatedNetname ];
511 
512  if( netinfo )
513  {
514  m_commit.Modify( zone );
515  zone->SetNet( netinfo );
516  }
517  }
518  }
519  else
520  {
521  msg.Printf( _( "Copper zone (net \"%s\") has no pads connected." ),
522  zone->GetNetname() );
524  ++m_warningCount;
525  }
526  }
527  }
528 
529  return true;
530 }
531 
532 
534 {
535  wxString msg;
536  MODULE* nextModule;
537  const COMPONENT* component;
538 
539  for( MODULE* module = m_board->m_Modules; module != NULL; module = nextModule )
540  {
541  nextModule = module->Next();
542 
543  if( m_lookupByTimestamp )
544  component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
545  else
546  component = aNetlist.GetComponentByReference( module->GetReference() );
547 
548  if( component == NULL )
549  {
550  if( module->IsLocked() )
551  {
552  msg.Printf( _( "Footprint %s is locked, skipping removal.\n" ),
553  GetChars( module->GetReference() ) );
555  continue;
556  }
557 
558  msg.Printf( _( "Remove footprint %s." ),
559  GetChars( module->GetReference() ) );
561 
562  msg.Printf( _( "Removing unused footprint \"%s:%s\".\n" ),
563  GetChars( module->GetReference() ),
564  GetChars( module->GetPath() ) );
566 
567  if( !m_isDryRun )
568  m_commit.Remove( module );
569  }
570  }
571 
572  return true;
573 }
574 
575 
577 {
578  int count = 0;
579  wxString netname;
580  wxString msg;
581  D_PAD* pad = NULL;
582  D_PAD* previouspad = NULL;
583 
584  // We need the pad list for next tests.
585 
587 
588  std::vector<D_PAD*> padlist = m_board->GetPads();
589 
590  if( m_isDryRun )
591  {
592  // During a dry run changes are only stored in the m_padNets cache, so we must sort
593  // the list ourselves.
594  std::sort( padlist.begin(), padlist.end(),
595  [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } );
596  }
597 
598  for( unsigned kk = 0; kk < padlist.size(); kk++ )
599  {
600  pad = padlist[kk];
601 
602  if( getNetname( pad ).IsEmpty() )
603  continue;
604 
605  if( netname != getNetname( pad ) ) // End of net
606  {
607  if( previouspad && count == 1 )
608  {
609  // First, see if we have a copper zone attached to this pad.
610  // If so, this is not really a single pad net
611 
612  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
613  {
614  ZONE_CONTAINER* zone = m_board->GetArea( ii );
615 
616  if( !zone->IsOnCopperLayer() )
617  continue;
618 
619  if( zone->GetIsKeepout() )
620  continue;
621 
622  if( zone->GetNetname() == getNetname( previouspad ) )
623  {
624  count++;
625  break;
626  }
627  }
628 
629  if( count == 1 ) // Really one pad, and nothing else
630  {
631  msg.Printf( _( "Remove single pad net %s." ),
632  GetChars( getNetname( previouspad ) ) );
634 
635  msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad \"%s\"\n" ),
636  GetChars( getNetname( previouspad ) ),
637  GetChars( previouspad->GetParent()->GetReference() ),
638  GetChars( previouspad->GetName() ) );
640 
641  if( !m_isDryRun )
642  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
643  else
644  cacheNetname( previouspad, wxEmptyString );
645  }
646  }
647 
648  netname = getNetname( pad );
649  count = 1;
650  }
651  else
652  {
653  count++;
654  }
655 
656  previouspad = pad;
657  }
658 
659  // Examine last pad
660  if( pad && count == 1 )
661  {
662  if( !m_isDryRun )
664  else
665  cacheNetname( pad, wxEmptyString );
666  }
667 
668  return true;
669 }
670 
671 
673 {
674  // Verify that board contains all pads in netlist: if it doesn't then footprints are
675  // wrong or missing.
676  // Note that we use references to find the footprints as they're already updated by this
677  // point (whether by-reference or by-timestamp).
678 
679  wxString msg;
680  wxString padname;
681 
682  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
683  {
684  const COMPONENT* component = aNetlist.GetComponent( i );
685  MODULE* footprint = m_board->FindModuleByReference( component->GetReference() );
686 
687  if( footprint == NULL ) // It can be missing in partial designs
688  continue;
689 
690  // Explore all pins/pads in component
691  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
692  {
693  const COMPONENT_NET& net = component->GetNet( jj );
694  padname = net.GetPinName();
695 
696  if( footprint->FindPadByName( padname ) )
697  continue; // OK, pad found
698 
699  // not found: bad footprint, report error
700  msg.Printf( _( "Component %s pad %s not found in footprint %s\n" ),
701  GetChars( component->GetReference() ),
702  GetChars( padname ),
703  GetChars( footprint->GetFPID().Format() ) );
705  ++m_errorCount;
706  }
707  }
708 
709  return true;
710 }
711 
712 
714 {
715  wxString msg;
716  m_errorCount = 0;
717  m_warningCount = 0;
718 
720 
721  if( !m_isDryRun )
722  {
723  m_board->SetStatus( 0 );
724  }
725 
726  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
727  {
728  COMPONENT* component = aNetlist.GetComponent( i );
729  MODULE* footprint = NULL;
730 
731  msg.Printf( _( "Processing component \"%s:%s:%s\".\n" ),
732  GetChars( component->GetReference() ),
733  GetChars( component->GetTimeStamp() ),
734  GetChars( component->GetFPID().Format() ) );
736 
737  if( aNetlist.IsFindByTimeStamp() )
738  footprint = m_board->FindModule( component->GetTimeStamp(), true );
739  else
740  footprint = m_board->FindModule( component->GetReference() );
741 
742  if( footprint ) // An existing footprint.
743  {
744  MODULE* newFootprint = replaceComponent( aNetlist, footprint, component );
745 
746  if( newFootprint )
747  footprint = newFootprint;
748  }
749  else
750  {
751  footprint = addNewComponent( component );
752  }
753 
754  if( footprint )
755  {
756  updateComponentParameters( footprint, component );
757  updateComponentPadConnections( footprint, component );
758  }
759  }
760 
761  updateCopperZoneNets( aNetlist );
762 
764  deleteUnusedComponents( aNetlist );
765 
768 
769  if( !m_isDryRun )
770  {
771  m_commit.Push( _( "Update netlist" ) );
772  m_board->GetConnectivity()->Build( m_board );
773  testConnectivity( aNetlist );
774  }
775 
776  // Update the ratsnest
779 
780  msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
782 
783  if( m_errorCount )
784  {
785  m_reporter->ReportTail( _( "Errors occurred during the netlist update. Unless you "
786  "fix them, your board will not be consistent with the schematics." ),
788 
789  return false;
790  }
791  else
792  {
793  m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
794  }
795 
796  return true;
797 }
798 
799 
800 bool BOARD_NETLIST_UPDATER::UpdateNetlist( const wxString& aNetlistFileName,
801  const wxString& aCmpFileName )
802 {
803  return false;
804 }
const wxString & GetPinName() const
Definition: pcb_netlist.h:61
void BuildListOfNets()
Definition: class_board.h:726
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
MODULE * replaceComponent(NETLIST &aNetlist, MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool empty() const
Definition: lib_id.h:190
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
void cacheNetname(D_PAD *aPad, const wxString &aNetname)
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
MODULE * GetModule(bool aRelease=false)
Definition: pcb_netlist.h:186
Class BOARD to handle a board.
std::map< ZONE_CONTAINER *, std::vector< D_PAD * > > m_zoneConnectionsCache
D_PAD * FindPadByName(const wxString &aPadName) const
Function FindPadByName returns a D_PAD* with a matching name.
MODULE * Next() const
Definition: class_module.h:121
MODULE * GetParent() const
Definition: class_pad.h:162
int GetHeight() const
Definition: eda_rect.h:118
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
Classes to handle copper zones.
BOARD_NETLIST_UPDATER class definition.
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:486
int GetStatus(EDA_ITEM *aItem)
Returns status of an item.
Definition: commit.cpp:120
bool updateComponentPadConnections(MODULE *aPcbComponent, COMPONENT *aNewComponent)
bool IsValid() const
Definition: pcb_netlist.h:65
bool updateCopperZoneNets(NETLIST &aNetlist)
MODULE * FindModule(const wxString &aRefOrTimeStamp, bool aSearchByTimeStamp=false) const
Function FindModule searches for a module matching aRefOrTimeStamp depending on the state of aSearchB...
bool testConnectivity(NETLIST &aNetlist)
bool UpdateNetlist(NETLIST &aNetlist)
Function UpdateNetlist()
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:801
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:602
std::map< wxString, NETINFO_ITEM * > m_addedNets
const wxString & GetReference() const
Definition: pcb_netlist.h:151
Class COMPONENT_NET is used to store the component pin name to net name associations stored in a netl...
Definition: pcb_netlist.h:48
const LIB_ID & GetFPID() const
Definition: class_module.h:191
const wxString & GetValue() const
Definition: pcb_netlist.h:153
timestamp_t GetNewTimeStamp()
Definition: common.cpp:160
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:214
wxString getNetname(D_PAD *aPad)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:109
bool IsEmpty() const
Definition: class_board.h:271
const wxString & GetNetName() const
Definition: pcb_netlist.h:63
bool IsFindByTimeStamp() const
Definition: pcb_netlist.h:313
D_PAD * Next() const
Definition: class_pad.h:160
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxString & GetName() const
Definition: class_pad.h:190
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:468
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1015
const wxString & GetTimeStamp() const
Definition: pcb_netlist.h:170
int GetBottom() const
Definition: eda_rect.h:122
wxPoint Centre() const
Definition: eda_rect.h:60
void SetPosition(const wxPoint &aPos) override
std::map< D_PAD *, wxString > m_padNets
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:550
Pad object description.
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
COMMIT & Modified(EDA_ITEM *aItem, EDA_ITEM *aCopy)
Creates an undo entry for an item that has been already modified.
Definition: commit.h:110
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetNetname() const
Function GetNetname.
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:986
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:458
DLIST< MODULE > m_Modules
Definition: class_board.h:247
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void SetValue(const wxString &aValue)
Function SetValue.
Definition: class_module.h:495
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
The common library.
int GetWidth() const
Definition: eda_rect.h:117
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
void SetStatus(STATUS_FLAGS aStatus)
Definition: base_struct.h:262
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
UTF8 Format() const
Definition: lib_id.cpp:263
COMPONENT * GetComponentByReference(const wxString &aReference)
Function GetComponentByReference returns a COMPONENT by aReference.
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
void CopyNetlistSettings(MODULE *aModule, bool aCopyLocalSettings)
Function CopyNetlistSettings copies the netlist settings to aModule.
DLIST< D_PAD > & PadsList()
Definition: class_module.h:161
std::vector< MODULE * > m_addedComponents
Module description (excepted pads)
static REPORTER & GetInstance()
Definition: reporter.cpp:104
const wxString & GetPath() const
Definition: class_module.h:200
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
bool deleteUnusedComponents(NETLIST &aNetlist)
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:461
unsigned GetNetCount() const
Definition: pcb_netlist.h:137
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:293
void SetPath(const wxString &aPath)
Definition: class_module.h:201
COMPONENT * GetComponentByTimeStamp(const wxString &aTimeStamp)
Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
MODULE * addNewComponent(COMPONENT *aComponent)