KiCad PCB EDA Suite
Loading...
Searching...
No Matches
backannotate.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) 2019 Alexander Shuklin <[email protected]>
5 * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
26#ifndef BACKANNOTATE_H
27#define BACKANNOTATE_H
28
29#include <deque>
30#include <map>
31#include <memory>
32#include <sch_reference_list.h>
33#include <template_fieldnames.h>
34#include <wx/string.h>
35
36// Forward declarations
37class REPORTER;
38class SCH_SHEET_LIST;
39class SCH_EDIT_FRAME;
40class SCH_COMMIT;
41
56{
57public:
62 {
63 PCB_FP_DATA( const wxString& aRef, const wxString& aFootprint, const wxString& aValue,
64 bool aDNP, bool aExcludeFromBOM,
65 const std::map<wxString, wxString>& aPinMap,
66 const std::map<wxString, wxString>& aFieldsMap ) :
67 m_ref( aRef ),
68 m_footprint( aFootprint ),
69 m_value( aValue ),
70 m_DNP( aDNP ),
71 m_excludeFromBOM( aExcludeFromBOM ),
72 m_pinMap( aPinMap ),
73 m_fieldsMap( aFieldsMap )
74 {}
75
76 wxString m_ref;
77 wxString m_footprint;
78 wxString m_value;
79 bool m_DNP;
81 std::map<wxString, wxString> m_pinMap;
82 std::map<wxString, wxString> m_fieldsMap;
83 };
84
86 using PCB_FOOTPRINTS_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>>;
87
88 using CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>;
89
90 BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter, bool aRelinkFootprints,
91 bool aProcessFootprints, bool aProcessValues, bool aProcessReferences,
92 bool aProcessNetNames, bool aProcessAttributes, bool aProcessOtherFields,
93 bool aDryRun );
95
102 bool FetchNetlistFromPCB( std::string& aNetlist );
103
104 void PushNewLinksToPCB();
105
112 bool BackAnnotateSymbols( const std::string& aNetlist );
113
114private:
121 void getPcbModulesFromString( const std::string& aPayload );
122
124 void getChangeList();
125
132
136 void applyChangelist();
137
138 void processNetNameChange( SCH_COMMIT* aCommit, const wxString& aRef, SCH_PIN* aPin,
139 const SCH_CONNECTION* aConnection, const wxString& aOldName,
140 const wxString& aNewName );
141
143
152
156 std::deque<CHANGELIST_ITEM> m_changelist;
158
159 int m_changesCount; // Number of user-level changes
160};
161
162#endif
Back annotation algorithm class used to receive, check, and apply a NETLIST from Pcbnew.
Definition: backannotate.h:56
bool BackAnnotateSymbols(const std::string &aNetlist)
Run back annotation algorithm.
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs
Definition: backannotate.h:155
std::deque< CHANGELIST_ITEM > m_changelist
Definition: backannotate.h:156
std::map< wxString, std::shared_ptr< PCB_FP_DATA > > PCB_FOOTPRINTS_MAP
Definition: backannotate.h:86
bool m_processReferences
Definition: backannotate.h:147
bool m_processFootprints
Definition: backannotate.h:145
bool m_processOtherFields
Definition: backannotate.h:150
void getPcbModulesFromString(const std::string &aPayload)
Parse netlist sent over KiWay express mail interface and fill m_pcbModules.
SCH_EDIT_FRAME * m_frame
Definition: backannotate.h:157
bool m_processValues
Definition: backannotate.h:146
void checkForUnusedSymbols()
Check if some symbols are not represented in PCB footprints and vice versa.
SCH_REFERENCE_LIST m_refs
Definition: backannotate.h:154
bool FetchNetlistFromPCB(std::string &aNetlist)
Get netlist from the Pcbnew.
PCB_FOOTPRINTS_MAP m_pcbFootprints
Definition: backannotate.h:153
std::pair< SCH_REFERENCE, std::shared_ptr< PCB_FP_DATA > > CHANGELIST_ITEM
Definition: backannotate.h:88
void processNetNameChange(SCH_COMMIT *aCommit, const wxString &aRef, SCH_PIN *aPin, const SCH_CONNECTION *aConnection, const wxString &aOldName, const wxString &aNewName)
REPORTER & m_reporter
Definition: backannotate.h:142
bool m_processAttributes
Definition: backannotate.h:149
bool m_processNetNames
Definition: backannotate.h:148
bool m_matchByReference
Definition: backannotate.h:144
void getChangeList()
void PushNewLinksToPCB()
void applyChangelist()
Apply changelist to the schematic.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Schematic editor (Eeschema) main window.
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
std::map< wxString, SCH_REFERENCE_LIST > SCH_MULTI_UNIT_REFERENCE_MAP
Container to map reference designators for multi-unit parts.
Container for Pcbnew footprint data.Map to hold NETLIST footprints data.
Definition: backannotate.h:62
std::map< wxString, wxString > m_pinMap
Definition: backannotate.h:81
std::map< wxString, wxString > m_fieldsMap
Definition: backannotate.h:82
PCB_FP_DATA(const wxString &aRef, const wxString &aFootprint, const wxString &aValue, bool aDNP, bool aExcludeFromBOM, const std::map< wxString, wxString > &aPinMap, const std::map< wxString, wxString > &aFieldsMap)
Definition: backannotate.h:63