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 = false;
45
46enum class SYMBOL_TYPE
47{
48 NORMAL = 2,
49 POWER_PORT = 18,
50 NETPORT = 19,
51 SHEET_SYMBOL = 20,
52 SHORT = 22,
53};
54
56{
57 NORMAL = 4,
58};
59
61{
62 wxString id;
63 wxString parentId;
64 wxString key;
65 wxString value;
66 bool keyVisible = false;
67 bool valVisible = false;
68 std::optional<VECTOR2D> position;
69 double rotation = 0;
70 wxString fontStyle;
71};
72
74{
75 wxString id;
76 int layer = 0;
77 wxString parentId;
78 int textOrigin = 0;
80 wxString key;
81 wxString value;
82 bool keyVisible = false;
83 bool valVisible = false;
84 wxString fontName;
85 double height = 0;
86 double strokeWidth = 0;
87 double rotation = 0;
88 int inverted = 0;
89};
90
92{
93 wxString id;
94 wxString name;
95
97 double rotation = 0;
98 bool mirror = false;
99
100 nlohmann::json customProps;
101
102 int unk1 = 0;
103 int unk2 = 0;
104};
105
107{
108 wxString id;
109 std::vector<std::vector<double>> geometry;
110 wxString lineStyle;
111
112 int unk1 = 0;
113};
114
116{
117 wxString id;
118
120 double length = 0;
121 double rotation = 0;
122 bool inverted = false;
123};
124
126{
128 wxString version;
129 int maxId = 0;
131};
132
134{
135 int id = 0;
136 wxString name;
137 wxString uuid;
138};
139
141{
142 wxString name;
143 std::vector<PRJ_SHEET> sheets;
144};
145
147{
148 wxString schematic;
149 wxString pcb;
150};
151
153{
154 wxString source;
155 wxString desc;
156 nlohmann::json tags;
157 nlohmann::json custom_tags;
158 wxString title;
159 wxString version;
161};
162
164{
165 wxString source;
166 wxString desc;
167 nlohmann::json tags;
168 nlohmann::json custom_tags;
169 wxString title;
170 wxString version;
172};
173
175{
176 wxString source;
177 wxString description;
178 nlohmann::json tags;
179 nlohmann::json custom_tags;
180 wxString title;
181 wxString version;
182 std::map<wxString, wxString> attributes;
183};
184
185struct BLOB
186{
187 wxString objectId;
188 wxString url;
189};
190
191struct POURED
192{
193 wxString pouredId;
194 wxString parentId;
195 int unki = 0;
196 bool isPoly = false;
197 nlohmann::json polyData;
198};
199
200void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_ATTR& d );
201void from_json( const nlohmann::json& j, EASYEDAPRO::PCB_ATTR& d );
202void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_COMPONENT& d );
203void from_json( const nlohmann::json& j, EASYEDAPRO::SCH_WIRE& d );
204void from_json( const nlohmann::json& j, EASYEDAPRO::SYM_PIN& d );
205void from_json( const nlohmann::json& j, EASYEDAPRO::SYM_HEAD& d );
206void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SHEET& d );
207void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SCHEMATIC& d );
208void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_BOARD& d );
209void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_SYMBOL& d );
210void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_FOOTPRINT& d );
211void from_json( const nlohmann::json& j, EASYEDAPRO::PRJ_DEVICE& d );
212void from_json( const nlohmann::json& j, EASYEDAPRO::BLOB& d );
213void from_json( const nlohmann::json& j, EASYEDAPRO::POURED& d );
214
215} // namespace EASYEDAPRO
216
217
218#endif // EASYEDAPRO_PARSER_H_
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