KiCad PCB EDA Suite
Loading...
Searching...
No Matches
easyedapro_parser.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) 2023 Alex Shvartzkop <[email protected]>
5 * Copyright (C) 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#ifndef EASYEDAPRO_PARSER_H_
26#define EASYEDAPRO_PARSER_H_
27
28#include <cstdint>
29#include <cstring>
30#include <memory>
31#include <vector>
32#include <map>
33#include <optional>
34
35#include <wx/string.h>
36
37#include <nlohmann/json.hpp>
38#include <math/vector2d.h>
39
40
41namespace EASYEDAPRO
42{
43
44static const bool IMPORT_POURED = true;
45static const bool IMPORT_POURED_ECOP = false;
46
47enum class SYMBOL_TYPE
48{
49 NORMAL = 2,
50 POWER_PORT = 18,
51 NETPORT = 19,
52 SHEET_SYMBOL = 20,
53 SHORT = 22,
54};
55
57{
58 NORMAL = 4,
59};
60
62{
63 wxString id;
64 wxString parentId;
65 wxString key;
66 wxString value;
67 bool keyVisible = false;
68 bool valVisible = false;
69 std::optional<VECTOR2D> position;
70 double rotation = 0;
71 wxString fontStyle;
72};
73
75{
76 wxString id;
77 int layer = 0;
78 wxString parentId;
79 int textOrigin = 0;
81 wxString key;
82 wxString value;
83 bool keyVisible = false;
84 bool valVisible = false;
85 wxString fontName;
86 double height = 0;
87 double strokeWidth = 0;
88 double rotation = 0;
89 int inverted = 0;
90};
91
93{
94 wxString id;
95 wxString name;
96
98 double rotation = 0;
99 bool mirror = false;
100
101 nlohmann::json customProps;
102
103 int unk1 = 0;
104 int unk2 = 0;
105};
106
108{
109 wxString id;
110 std::vector<std::vector<double>> geometry;
111 wxString lineStyle;
112
113 int unk1 = 0;
114};
115
117{
118 wxString id;
119
121 double length = 0;
122 double rotation = 0;
123 bool inverted = false;
124};
125
127{
129 wxString version;
130 int maxId = 0;
132};
133
135{
136 int id = 0;
137 wxString name;
138 wxString uuid;
139};
140
142{
143 wxString name;
144 std::vector<PRJ_SHEET> sheets;
145};
146
148{
149 wxString schematic;
150 wxString pcb;
151};
152
154{
155 wxString source;
156 wxString desc;
157 nlohmann::json tags;
158 nlohmann::json custom_tags;
159 wxString title;
160 wxString version;
162};
163
165{
166 wxString source;
167 wxString desc;
168 nlohmann::json tags;
169 nlohmann::json custom_tags;
170 wxString title;
171 wxString version;
173};
174
176{
177 wxString source;
178 wxString description;
179 nlohmann::json tags;
180 nlohmann::json custom_tags;
181 wxString title;
182 wxString version;
183 std::map<wxString, wxString> attributes;
184};
185
186struct BLOB
187{
188 wxString objectId;
189 wxString url;
190};
191
192struct POURED
193{
194 wxString pouredId;
195 wxString parentId;
196 int unki = 0;
197 bool isPoly = false;
198 nlohmann::json polyData;
199};
200
201void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_ATTR& d );
202void from_json( const nlohmann::json& j, EASYEDAPRO::PCB_ATTR& d );
203void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_COMPONENT& d );
204void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_WIRE& d );
205void from_json( const nlohmann::json& j, EASYEDAPRO::SYM_PIN& d );
206void from_json( const nlohmann::json& j, EASYEDAPRO::SYM_HEAD& d );
207void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SHEET& d );
208void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SCHEMATIC& d );
209void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_BOARD& d );
210void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SYMBOL& d );
211void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_FOOTPRINT& d );
212void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_DEVICE& d );
213void from_json( const nlohmann::json& j, EASYEDAPRO::BLOB& d );
214void from_json( const nlohmann::json& j, EASYEDAPRO::POURED& d );
215
216} // namespace EASYEDAPRO
217
218
219#endif // EASYEDAPRO_PARSER_H_
static const bool IMPORT_POURED_ECOP
static const bool IMPORT_POURED
void from_json(const nlohmann::json &j, EASYEDAPRO::SCH_ATTR &d)
nlohmann::json polyData
std::map< wxString, wxString > attributes
std::vector< PRJ_SHEET > sheets
std::optional< VECTOR2D > position
std::vector< std::vector< double > > geometry