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>
45 #include <reporter.h>
46 
47 #include <board_netlist_updater.h>
48 
49 #include <pcb_edit_frame.h>
50 
51 
53  m_frame( aFrame ),
54  m_commit( aFrame ),
55  m_board( aBoard )
56 {
58 
59  m_deleteSinglePadNets = true;
61  m_isDryRun = false;
62  m_replaceFootprints = true;
63  m_lookupByTimestamp = false;
64 
65  m_warningCount = 0;
66  m_errorCount = 0;
67 }
68 
69 
71 {
72 }
73 
74 
75 // These functions allow inspection of pad nets during dry runs by keeping a cache of
76 // current pad netnames indexed by pad.
77 
78 void BOARD_NETLIST_UPDATER::cacheNetname( D_PAD* aPad, const wxString& aNetname )
79 {
80  m_padNets[ aPad ] = aNetname;
81 }
82 
84 {
85  if( m_isDryRun && m_padNets.count( aPad ) )
86  return m_padNets[ aPad ];
87  else
88  return aPad->GetNetname();
89 }
90 
91 
93 {
94  wxPoint bestPosition;
95 
96  if( !m_board->IsEmpty() )
97  {
98  // Position new components below any existing board features.
100 
101  if( bbox.GetWidth() || bbox.GetHeight() )
102  {
103  bestPosition.x = bbox.Centre().x;
104  bestPosition.y = bbox.GetBottom() + Millimeter2iu( 10 );
105  }
106  }
107  else
108  {
109  // Position new components in the center of the page when the board is empty.
110  wxSize pageSize = m_board->GetPageSettings().GetSizeIU();
111 
112  bestPosition.x = pageSize.GetWidth() / 2;
113  bestPosition.y = pageSize.GetHeight() / 2;
114  }
115 
116  return bestPosition;
117 }
118 
119 
121 {
122  wxString msg;
123 
124  if( aComponent->GetFPID().empty() )
125  {
126  msg.Printf( _( "Cannot add %s (no footprint assigned)." ),
127  aComponent->GetReference(),
128  aComponent->GetFPID().Format().wx_str() );
130  ++m_errorCount;
131  return nullptr;
132  }
133 
134  MODULE* footprint = m_frame->LoadFootprint( aComponent->GetFPID() );
135 
136  if( footprint == nullptr )
137  {
138  msg.Printf( _( "Cannot add %s (footprint \"%s\" not found)." ),
139  aComponent->GetReference(),
140  aComponent->GetFPID().Format().wx_str() );
142  ++m_errorCount;
143  return nullptr;
144  }
145 
146  msg.Printf( _( "Add %s (footprint \"%s\")." ),
147  aComponent->GetReference(),
148  aComponent->GetFPID().Format().wx_str() );
150 
151  if( !m_isDryRun )
152  {
153  footprint->SetParent( m_board );
155  footprint->SetTimeStamp( GetNewTimeStamp() );
156 
157  m_addedComponents.push_back( footprint );
158  m_commit.Add( footprint );
159 
160  return footprint;
161  }
162 
163  return NULL;
164 }
165 
166 
168  COMPONENT* aNewComponent )
169 {
170  wxString msg;
171 
172  if( aNewComponent->GetFPID().empty() )
173  {
174  msg.Printf( _( "Cannot update %s (no footprint assigned)." ),
175  aNewComponent->GetReference(),
176  aNewComponent->GetFPID().Format().wx_str() );
178  ++m_errorCount;
179  return nullptr;
180  }
181 
182  MODULE* newFootprint = m_frame->LoadFootprint( aNewComponent->GetFPID() );
183 
184  if( newFootprint == nullptr )
185  {
186  msg.Printf( _( "Cannot update %s (footprint \"%s\" not found)." ),
187  aNewComponent->GetReference(),
188  aNewComponent->GetFPID().Format().wx_str() );
190  ++m_errorCount;
191  return nullptr;
192  }
193 
194  msg.Printf( _( "Change %s footprint from \"%s\" to \"%s\"."),
195  aPcbComponent->GetReference(),
196  aPcbComponent->GetFPID().Format().wx_str(),
197  aNewComponent->GetFPID().Format().wx_str() );
199 
200  if( !m_isDryRun )
201  {
202  m_frame->Exchange_Module( aPcbComponent, newFootprint, m_commit, true, true, true );
203  return newFootprint;
204  }
205 
206  return nullptr;
207 }
208 
209 
211  COMPONENT* aNewComponent )
212 {
213  wxString msg;
214 
215  // Create a copy only if the module has not been added during this update
216  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
217  bool changed = false;
218 
219  // Test for reference designator field change.
220  if( aPcbComponent->GetReference() != aNewComponent->GetReference() )
221  {
222  msg.Printf( _( "Change %s reference to %s." ),
223  aPcbComponent->GetReference(),
224  aNewComponent->GetReference() );
226 
227  if ( !m_isDryRun )
228  {
229  changed = true;
230  aPcbComponent->SetReference( aNewComponent->GetReference() );
231  }
232  }
233 
234  // Test for value field change.
235  if( aPcbComponent->GetValue() != aNewComponent->GetValue() )
236  {
237  msg.Printf( _( "Change %s value from %s to %s." ),
238  aPcbComponent->GetReference(),
239  aPcbComponent->GetValue(),
240  aNewComponent->GetValue() );
242 
243  if( !m_isDryRun )
244  {
245  changed = true;
246  aPcbComponent->SetValue( aNewComponent->GetValue() );
247  }
248  }
249 
250  // Test for time stamp change.
251  if( aPcbComponent->GetPath() != aNewComponent->GetTimeStamp() )
252  {
253  msg.Printf( _( "Change symbol path \"%s:%s\" to \"%s\"." ),
254  aPcbComponent->GetReference(),
255  aPcbComponent->GetPath(),
256  aNewComponent->GetTimeStamp() );
258 
259  if( !m_isDryRun )
260  {
261  changed = true;
262  aPcbComponent->SetPath( aNewComponent->GetTimeStamp() );
263  }
264  }
265 
266  if( changed && copy )
267  m_commit.Modified( aPcbComponent, copy );
268  else
269  delete copy;
270 
271  return true;
272 }
273 
274 
276  COMPONENT* aNewComponent )
277 {
278  wxString msg;
279 
280  // Create a copy only if the module has not been added during this update
281  MODULE* copy = m_commit.GetStatus( aPcbComponent ) ? nullptr : (MODULE*) aPcbComponent->Clone();
282  bool changed = false;
283 
284  // At this point, the component footprint is updated. Now update the nets.
285  for( D_PAD* pad = aPcbComponent->PadsList(); pad; pad = pad->Next() )
286  {
287  COMPONENT_NET net = aNewComponent->GetNet( pad->GetName() );
288 
289  if( !net.IsValid() ) // New footprint pad has no net.
290  {
291  if( !pad->GetNetname().IsEmpty() )
292  {
293  msg.Printf( _( "Disconnect %s pin %s." ),
294  aPcbComponent->GetReference(),
295  pad->GetName() );
297  }
298 
299  if( !m_isDryRun )
300  {
301  changed = true;
302  pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
303  }
304  else
305  cacheNetname( pad, wxEmptyString );
306  }
307  else // New footprint pad has a net.
308  {
309  const wxString& netName = net.GetNetName();
310  NETINFO_ITEM* netinfo = m_board->FindNet( netName );
311 
312  if( netinfo && !m_isDryRun )
313  netinfo->SetIsCurrent( true );
314 
315  if( pad->GetNetname() != netName )
316  {
317 
318  if( netinfo == nullptr )
319  {
320  // It might be a new net that has not been added to the board yet
321  if( m_addedNets.count( netName ) )
322  netinfo = m_addedNets[ netName ];
323  }
324 
325  if( netinfo == nullptr )
326  {
327  // It is a new net, we have to add it
328  if( !m_isDryRun )
329  {
330  changed = true;
331  netinfo = new NETINFO_ITEM( m_board, netName );
332  m_commit.Add( netinfo );
333  }
334 
335  m_addedNets[netName] = netinfo;
336  msg.Printf( _( "Add net %s." ), netName );
338  }
339 
340  if( !pad->GetNetname().IsEmpty() )
341  {
342  msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
343  aPcbComponent->GetReference(),
344  pad->GetName(),
345  pad->GetNetname(),
346  netName );
347  }
348  else
349  {
350  msg.Printf( _( "Connect %s pin %s to %s."),
351  aPcbComponent->GetReference(),
352  pad->GetName(),
353  netName );
354  }
356 
357  if( !m_isDryRun )
358  {
359  changed = true;
360  pad->SetNet( netinfo );
361  }
362  else
363  cacheNetname( pad, netName );
364  }
365  }
366  }
367 
368  if( changed && copy )
369  m_commit.Modified( aPcbComponent, copy );
370  else
371  delete copy;
372 
373  return true;
374 }
375 
376 
378 {
379  for( int ii = 0; ii < m_board->GetAreaCount(); ii++ )
380  {
381  ZONE_CONTAINER* zone = m_board->GetArea( ii );
382 
383  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
384  continue;
385 
386  m_zoneConnectionsCache[ zone ] = m_board->GetConnectivity()->GetConnectedPads( zone );
387  }
388 }
389 
390 
392 {
393  wxString msg;
394  std::set<wxString> netlistNetnames;
395 
396  for( int ii = 0; ii < (int) aNetlist.GetCount(); ii++ )
397  {
398  const COMPONENT* component = aNetlist.GetComponent( ii );
399  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
400  {
401  const COMPONENT_NET& net = component->GetNet( jj );
402  netlistNetnames.insert( net.GetNetName() );
403  }
404  }
405 
406  // Test copper zones to detect "dead" nets (nets without any pad):
407  for( int i = 0; i < m_board->GetAreaCount(); i++ )
408  {
409  ZONE_CONTAINER* zone = m_board->GetArea( i );
410 
411  if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
412  continue;
413 
414  if( netlistNetnames.count( zone->GetNetname() ) == 0 )
415  {
416  // Look for a pad in the zone's connected-pad-cache which has been updated to
417  // a new net and use that. While this won't always be the right net, the dead
418  // net is guaranteed to be wrong.
419  wxString updatedNetname = wxEmptyString;
420 
421  for( D_PAD* pad : m_zoneConnectionsCache[ zone ] )
422  {
423  if( getNetname( pad ) != zone->GetNetname() )
424  {
425  updatedNetname = getNetname( pad );
426  break;
427  }
428  }
429 
430  if( !updatedNetname.IsEmpty() )
431  {
432  msg.Printf( _( "Reconnect copper zone from %s to %s." ),
433  zone->GetNetname(),
434  updatedNetname );
436 
437  if( !m_isDryRun )
438  {
439  NETINFO_ITEM* netinfo = m_board->FindNet( updatedNetname );
440 
441  if( !netinfo )
442  netinfo = m_addedNets[ updatedNetname ];
443 
444  if( netinfo )
445  {
446  m_commit.Modify( zone );
447  zone->SetNet( netinfo );
448  }
449  }
450  }
451  else
452  {
453  msg.Printf( _( "Copper zone (%s) has no pads connected." ), zone->GetNetname() );
455  ++m_warningCount;
456  }
457  }
458  }
459 
460  return true;
461 }
462 
463 
465 {
466  wxString msg;
467  MODULE* nextModule;
468  const COMPONENT* component;
469 
470  for( MODULE* module = m_board->m_Modules; module != NULL; module = nextModule )
471  {
472  nextModule = module->Next();
473 
474  if( m_lookupByTimestamp )
475  component = aNetlist.GetComponentByTimeStamp( module->GetPath() );
476  else
477  component = aNetlist.GetComponentByReference( module->GetReference() );
478 
479  if( component == NULL )
480  {
481  if( module->IsLocked() )
482  {
483  msg.Printf( _( "Cannot remove unused footprint %s (locked)." ), module->GetReference() );
485  continue;
486  }
487 
488  msg.Printf( _( "Remove unused footprint %s." ), module->GetReference() );
490 
491  if( !m_isDryRun )
492  m_commit.Remove( module );
493  }
494  }
495 
496  return true;
497 }
498 
499 
501 {
502  int count = 0;
503  wxString netname;
504  wxString msg;
505  D_PAD* previouspad = NULL;
506 
507  // We need the pad list for next tests.
508 
510 
511  std::vector<D_PAD*> padlist = m_board->GetPads();
512 
513  // Sort pads by netlist name
514  std::sort( padlist.begin(), padlist.end(),
515  [ this ]( D_PAD* a, D_PAD* b ) -> bool { return getNetname( a ) < getNetname( b ); } );
516 
517  for( D_PAD* pad : padlist )
518  {
519  if( getNetname( pad ).IsEmpty() )
520  continue;
521 
522  if( netname != getNetname( pad ) ) // End of net
523  {
524  if( previouspad && count == 1 )
525  {
526  // First, see if we have a copper zone attached to this pad.
527  // If so, this is not really a single pad net
528 
529  for( ZONE_CONTAINER* zone : m_board->Zones() )
530  {
531  if( !zone->IsOnCopperLayer() )
532  continue;
533 
534  if( zone->GetIsKeepout() )
535  continue;
536 
537  if( zone->GetNetname() == getNetname( previouspad ) )
538  {
539  count++;
540  break;
541  }
542  }
543 
544  if( count == 1 ) // Really one pad, and nothing else
545  {
546  msg.Printf( _( "Remove single pad net %s." ), getNetname( previouspad ) );
548 
549  if( !m_isDryRun )
550  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
551  else
552  cacheNetname( previouspad, wxEmptyString );
553  }
554  }
555 
556  netname = getNetname( pad );
557  count = 1;
558  }
559  else
560  {
561  count++;
562  }
563 
564  previouspad = pad;
565  }
566 
567  // Examine last pad
568  if( count == 1 )
569  {
570  if( !m_isDryRun )
571  previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
572  else
573  cacheNetname( previouspad, wxEmptyString );
574  }
575 
576  return true;
577 }
578 
579 
581 {
582  // Verify that board contains all pads in netlist: if it doesn't then footprints are
583  // wrong or missing.
584  // Note that we use references to find the footprints as they're already updated by this
585  // point (whether by-reference or by-timestamp).
586 
587  wxString msg;
588  wxString padname;
589 
590  for( int i = 0; i < (int) aNetlist.GetCount(); i++ )
591  {
592  const COMPONENT* component = aNetlist.GetComponent( i );
593  MODULE* footprint = m_board->FindModuleByReference( component->GetReference() );
594 
595  if( footprint == NULL ) // It can be missing in partial designs
596  continue;
597 
598  // Explore all pins/pads in component
599  for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
600  {
601  const COMPONENT_NET& net = component->GetNet( jj );
602  padname = net.GetPinName();
603 
604  if( footprint->FindPadByName( padname ) )
605  continue; // OK, pad found
606 
607  // not found: bad footprint, report error
608  msg.Printf( _( "%s pad %s not found in %s." ),
609  component->GetReference(),
610  padname,
611  footprint->GetFPID().Format().wx_str() );
613  ++m_errorCount;
614  }
615  }
616 
617  return true;
618 }
619 
620 
622 {
623  wxString msg;
624  m_errorCount = 0;
625  m_warningCount = 0;
626  MODULE* lastPreexistingFootprint = m_board->m_Modules.GetLast();
627 
629 
630  if( !m_isDryRun )
631  {
632  m_board->SetStatus( 0 );
633 
634  // Mark all nets (except <no net>) as stale; we'll update those to current that
635  // we find in the netlist
636  for( NETINFO_ITEM* net : m_board->GetNetInfo() )
637  net->SetIsCurrent( net->GetNet() == 0 );
638  }
639 
640  for( unsigned i = 0; i < aNetlist.GetCount(); i++ )
641  {
642  COMPONENT* component = aNetlist.GetComponent( i );
643  int matchCount = 0;
644  MODULE* tmp;
645 
646  msg.Printf( _( "Processing component \"%s:%s:%s\"." ),
647  component->GetReference(),
648  component->GetTimeStamp(),
649  component->GetFPID().Format().wx_str() );
651 
652  for( MODULE* footprint = m_board->m_Modules; footprint; footprint = footprint->Next() )
653  {
654  bool match = false;
655 
656  if( footprint )
657  {
658  if( aNetlist.IsFindByTimeStamp() )
659  match = footprint->GetPath() == component->GetTimeStamp();
660  else
661  match = footprint->GetReference().CmpNoCase( component->GetReference() ) == 0;
662  }
663 
664  if( match )
665  {
666  tmp = footprint;
667 
668  if( m_replaceFootprints && component->GetFPID() != footprint->GetFPID() )
669  tmp = replaceComponent( aNetlist, footprint, component );
670 
671  if( tmp )
672  {
673  updateComponentParameters( tmp, component );
674  updateComponentPadConnections( tmp, component );
675  }
676 
677  matchCount++;
678  }
679 
680  if( footprint == lastPreexistingFootprint )
681  {
682  // No sense going through the newly-created footprints: end of loop
683  break;
684  }
685  }
686 
687  if( matchCount == 0 )
688  {
689  tmp = addNewComponent( component );
690 
691  if( tmp )
692  {
693  updateComponentParameters( tmp, component );
694  updateComponentPadConnections( tmp, component );
695  }
696  }
697  else if( matchCount > 1 )
698  {
699  msg.Printf( _( "Multiple footprints found for \"%s\"." ),
700  component->GetReference() );
702  }
703  }
704 
705  updateCopperZoneNets( aNetlist );
706 
708  deleteUnusedComponents( aNetlist );
709 
712 
713  if( !m_isDryRun )
714  {
715  m_commit.Push( _( "Update netlist" ) );
716  m_board->GetConnectivity()->Build( m_board );
717  testConnectivity( aNetlist );
718  }
719 
720  // Update the ratsnest
723 
724  msg.Printf( _( "Total warnings: %d, errors: %d." ), m_warningCount, m_errorCount );
726 
727  if( m_errorCount )
728  {
729  m_reporter->ReportTail( _( "Errors occurred during the netlist update. Unless you fix them "
730  "your board will not be consistent with the schematics." ),
732  return false;
733  }
734 
735  m_reporter->ReportTail( _( "Netlist update successful!" ), REPORTER::RPT_ACTION );
736  return true;
737 }
738 
739 
740 bool BOARD_NETLIST_UPDATER::UpdateNetlist( const wxString& aNetlistFileName,
741  const wxString& aCmpFileName )
742 {
743  return false;
744 }
const wxString & GetPinName() const
Definition: pcb_netlist.h:61
void BuildListOfNets()
Definition: class_board.h:735
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
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:186
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
void SetIsCurrent(bool isCurrent)
Definition: netinfo.h:249
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:122
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:496
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)
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:810
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:628
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:192
const wxString & GetValue() const
Definition: pcb_netlist.h:153
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
wxString wx_str() const
Definition: utf8.cpp:51
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)
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:170
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
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:111
bool IsEmpty() const
Definition: class_board.h:273
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.
void SetReference(const wxString &aReference)
Function SetReference.
Definition: class_module.h:472
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:1026
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
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:756
std::map< D_PAD *, wxString > m_padNets
const PAGE_INFO & GetPageSettings() const
Definition: class_board.h:554
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
ZONE_CONTAINERS & Zones()
Definition: class_board.h:257
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:997
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
bool updateComponentParameters(MODULE *aPcbComponent, COMPONENT *aNewComponent)
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
DLIST< MODULE > m_Modules
Definition: class_board.h:249
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:505
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:254
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:237
COMPONENT * GetComponentByReference(const wxString &aReference)
Function GetComponentByReference returns a COMPONENT by aReference.
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:139
DLIST< D_PAD > & PadsList()
Definition: class_module.h:162
std::vector< MODULE * > m_addedComponents
Module description (excepted pads)
static REPORTER & GetInstance()
Definition: reporter.cpp:104
const wxString & GetPath() const
Definition: class_module.h:201
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:469
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:297
void SetPath(const wxString &aPath)
Definition: class_module.h:202
COMPONENT * GetComponentByTimeStamp(const wxString &aTimeStamp)
Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.
void Exchange_Module(MODULE *aSrc, MODULE *aDest, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true)
Function Exchange_Module Replaces OldModule by NewModule, using OldModule settings: position...
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
MODULE * addNewComponent(COMPONENT *aComponent)