KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_netlist_updater.h
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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 CERN
6 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
7 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
8 *
9 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, you may find one here:
23 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24 * or you may search the http://www.gnu.org website for the version 2 license,
25 * or you may write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 */
28
29#ifndef BOARD_NETLIST_UPDATER_H
30#define BOARD_NETLIST_UPDATER_H
31
32class BOARD;
33class REPORTER;
34class NETLIST;
35class COMPONENT;
36class FOOTPRINT;
37class PCB_EDIT_FRAME;
38
39#include <board_commit.h>
40
66{
67public:
68 BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBoard );
70
79 bool UpdateNetlist( NETLIST& aNetlist );
80
81 void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; }
82
84 void SetIsDryRun( bool aEnabled ) { m_isDryRun = aEnabled; }
85
86 void SetReplaceFootprints( bool aEnabled ) { m_replaceFootprints = aEnabled; }
87
88 void SetOverrideLocks( bool aOverride ) { m_overrideLocks = aOverride; }
89
90 void SetDeleteUnusedFootprints( bool aEnabled ) { m_deleteUnusedFootprints = aEnabled; }
91
92 void SetLookupByTimestamp( bool aEnabled ) { m_lookupByTimestamp = aEnabled; }
93
94 std::vector<FOOTPRINT*> GetAddedFootprints() const { return m_addedFootprints; }
95
96private:
97 void cacheNetname( PAD* aPad, const wxString& aNetname );
98 wxString getNetname( PAD* aPad );
99
100 void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
101 wxString getPinFunction( PAD* aPad );
102
104
105 FOOTPRINT* addNewFootprint( COMPONENT* aComponent );
106
107 FOOTPRINT* replaceFootprint( NETLIST& aNetlist, FOOTPRINT* aFootprint,
108 COMPONENT* aNewComponent );
109
110 bool updateFootprintParameters( FOOTPRINT* aPcbFootprint, COMPONENT* aNetlistComponent );
111
112 bool updateComponentPadConnections( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
113
114 void updateComponentClass( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
115
117
118 bool updateCopperZoneNets( NETLIST& aNetlist );
119
120 bool testConnectivity( NETLIST& aNetlist, std::map<COMPONENT*, FOOTPRINT*>& aFootprintMap );
121
126
127 std::map<ZONE*, std::vector<PAD*>> m_zoneConnectionsCache;
128 std::map<wxString, wxString> m_oldToNewNets;
129 std::map<PAD*, wxString> m_padNets;
130 std::map<PAD*, wxString> m_padPinFunctions;
131 std::vector<FOOTPRINT*> m_addedFootprints;
132 std::map<wxString, NETINFO_ITEM*> m_addedNets;
133
139
142 int m_newFootprintsCount; // the count of new footprints
143 // either really new or replaced by new fp.
144};
145
146#endif
Update the BOARD with a new netlist.
std::map< PAD *, wxString > m_padNets
void cacheNetname(PAD *aPad, const wxString &aNetname)
void SetReporter(REPORTER *aReporter)
Enable dry run mode (just report, no changes to PCB).
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
wxString getNetname(PAD *aPad)
wxString getPinFunction(PAD *aPad)
std::vector< FOOTPRINT * > m_addedFootprints
void SetIsDryRun(bool aEnabled)
void SetDeleteUnusedFootprints(bool aEnabled)
std::map< wxString, wxString > m_oldToNewNets
void updateComponentClass(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
bool updateFootprintParameters(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
void SetOverrideLocks(bool aOverride)
std::map< wxString, NETINFO_ITEM * > m_addedNets
bool testConnectivity(NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
void SetReplaceFootprints(bool aEnabled)
bool updateCopperZoneNets(NETLIST &aNetlist)
void cachePinFunction(PAD *aPad, const wxString &aPinFunction)
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
std::map< PAD *, wxString > m_padPinFunctions
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
void SetLookupByTimestamp(bool aEnabled)
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
std::vector< FOOTPRINT * > GetAddedFootprints() const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:241
Definition: pad.h:54
The main frame for Pcbnew.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72