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 The 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;
38class PCB_GROUP;
39
40#include <board_commit.h>
41
67{
68public:
69 BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBoard );
71
80 bool UpdateNetlist( NETLIST& aNetlist );
81
82 void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; }
83
85 void SetIsDryRun( bool aEnabled ) { m_isDryRun = aEnabled; }
86
87 void SetReplaceFootprints( bool aEnabled ) { m_replaceFootprints = aEnabled; }
88
89 void SetTransferGroups( bool aEnabled ) { m_transferGroups = aEnabled; }
90
91 void SetApplyDesignBlockLayouts( bool aEnabled ) { m_applyDesignBlockLayouts = aEnabled; }
92
93 void SetOverrideLocks( bool aOverride ) { m_overrideLocks = aOverride; }
94
95 void SetDeleteUnusedFootprints( bool aEnabled ) { m_deleteUnusedFootprints = aEnabled; }
96
97 void SetLookupByTimestamp( bool aEnabled ) { m_lookupByTimestamp = aEnabled; }
98
99 void SetUpdateFields( bool aEnabled ) { m_updateFields = aEnabled; }
100
101 void SetRemoveExtraFields( bool aEnabled ) { m_removeExtraFields = aEnabled; }
102
103 std::vector<FOOTPRINT*> GetAddedFootprints() const { return m_addedFootprints; }
104
105 std::vector<PCB_GROUP*> GetAddedGroups() const { return m_addedGroups; }
106
114 static void ApplyChainAssignments( BOARD* aBoard, const NETLIST& aNetlist, REPORTER* aReporter,
115 bool aDryRun );
116
117private:
118 void cacheNetname( PAD* aPad, const wxString& aNetname );
119 wxString getNetname( PAD* aPad );
120
121 void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
122 wxString getPinFunction( PAD* aPad );
123
125
126 FOOTPRINT* addNewFootprint( COMPONENT* aComponent );
127 FOOTPRINT* addNewFootprint( COMPONENT* aComponent, const LIB_ID& aFootprintId );
128
129 FOOTPRINT* replaceFootprint( NETLIST& aNetlist, FOOTPRINT* aFootprint,
130 COMPONENT* aNewComponent );
131
132 bool updateFootprintParameters( FOOTPRINT* aFootprint, COMPONENT* aNetlistComponent );
133
134 bool updateFootprintGroup( FOOTPRINT* aPcbFootprint, COMPONENT* aNetlistComponent );
135
136 bool updateComponentPadConnections( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
137
138 bool updateComponentClass( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
139
140 bool updateComponentUnits( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
141
142 void applyComponentVariants( COMPONENT* aComponent,
143 const std::vector<FOOTPRINT*>& aFootprints,
144 const LIB_ID& aBaseFpid );
145
147
148 bool updateCopperZoneNets( NETLIST& aNetlist );
149
150 bool updateGroups( NETLIST& aNetlist );
151
152 bool testConnectivity( NETLIST& aNetlist, std::map<COMPONENT*, FOOTPRINT*>& aFootprintMap );
153
158
159 std::map<ZONE*, std::vector<PAD*>> m_zoneConnectionsCache;
160 std::map<wxString, wxString> m_oldToNewNets;
161 std::map<PAD*, wxString> m_padNets;
162 std::map<PAD*, wxString> m_padPinFunctions;
163 std::vector<FOOTPRINT*> m_addedFootprints;
164 std::vector<PCB_GROUP*> m_addedGroups;
165 std::map<wxString, NETINFO_ITEM*> m_addedNets;
166 std::set<wxString> m_schematicNetNames;
167
171 bool m_transferGroups; // copy component group associations from schematic to PCB
177
180 int m_newFootprintsCount; // the count of new footprints
181 // either really new or replaced by new fp.
182};
183
184#endif
std::map< PAD *, wxString > m_padNets
void SetRemoveExtraFields(bool aEnabled)
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 getPinFunction(PAD *aPad)
std::vector< FOOTPRINT * > m_addedFootprints
bool updateFootprintParameters(FOOTPRINT *aFootprint, COMPONENT *aNetlistComponent)
void SetIsDryRun(bool aEnabled)
void SetDeleteUnusedFootprints(bool aEnabled)
std::map< wxString, wxString > m_oldToNewNets
static void ApplyChainAssignments(BOARD *aBoard, const NETLIST &aNetlist, REPORTER *aReporter, bool aDryRun)
Apply the netlist's chain assignments to every NETINFO_ITEM on the board.
bool updateFootprintGroup(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
void SetOverrideLocks(bool aOverride)
std::map< wxString, NETINFO_ITEM * > m_addedNets
std::vector< PCB_GROUP * > GetAddedGroups() const
void SetApplyDesignBlockLayouts(bool aEnabled)
std::vector< PCB_GROUP * > m_addedGroups
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 updateGroups(NETLIST &aNetlist)
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
bool updateComponentClass(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
std::map< PAD *, wxString > m_padPinFunctions
void applyComponentVariants(COMPONENT *aComponent, const std::vector< FOOTPRINT * > &aFootprints, const LIB_ID &aBaseFpid)
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
void SetLookupByTimestamp(bool aEnabled)
void SetUpdateFields(bool aEnabled)
void SetTransferGroups(bool aEnabled)
bool updateComponentUnits(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
std::set< wxString > m_schematicNetNames
std::vector< FOOTPRINT * > GetAddedFootprints() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
Store all of the related component information found in a netlist.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:65
The main frame for Pcbnew.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:75
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687