KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_enums.cpp
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) 2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <api/api_enums.h>
21#include <import_export.h>
22#include <api/common/types/enums.pb.h>
23#include <api/board/board_types.pb.h>
24#include <api/schematic/schematic_types.pb.h>
25
26#include <core/typeinfo.h>
28#include <layer_ids.h>
29#include <stroke_params.h>
30
31using namespace kiapi;
32using namespace kiapi::common;
33
34template<>
35KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
36{
37 switch( aValue )
38 {
39 case types::KiCadObjectType::KOT_PCB_FOOTPRINT: return PCB_FOOTPRINT_T;
40 case types::KiCadObjectType::KOT_PCB_PAD: return PCB_PAD_T;
41 case types::KiCadObjectType::KOT_PCB_SHAPE: return PCB_SHAPE_T;
42 case types::KiCadObjectType::KOT_PCB_REFERENCE_IMAGE: return PCB_REFERENCE_IMAGE_T;
43 case types::KiCadObjectType::KOT_PCB_FIELD: return PCB_FIELD_T;
44 case types::KiCadObjectType::KOT_PCB_GENERATOR: return PCB_GENERATOR_T;
45 case types::KiCadObjectType::KOT_PCB_TEXT: return PCB_TEXT_T;
46 case types::KiCadObjectType::KOT_PCB_TEXTBOX: return PCB_TEXTBOX_T;
47 case types::KiCadObjectType::KOT_PCB_TABLE: return PCB_TABLE_T;
48 case types::KiCadObjectType::KOT_PCB_TABLECELL: return PCB_TABLECELL_T;
49 case types::KiCadObjectType::KOT_PCB_TRACE: return PCB_TRACE_T;
50 case types::KiCadObjectType::KOT_PCB_VIA: return PCB_VIA_T;
51 case types::KiCadObjectType::KOT_PCB_ARC: return PCB_ARC_T;
52 case types::KiCadObjectType::KOT_PCB_MARKER: return PCB_MARKER_T;
53 case types::KiCadObjectType::KOT_PCB_DIMENSION: return PCB_DIMENSION_T;
54 case types::KiCadObjectType::KOT_PCB_ZONE: return PCB_ZONE_T;
55 case types::KiCadObjectType::KOT_PCB_GROUP: return PCB_GROUP_T;
56 case types::KiCadObjectType::KOT_SCH_MARKER: return SCH_MARKER_T;
57 case types::KiCadObjectType::KOT_SCH_JUNCTION: return SCH_JUNCTION_T;
58 case types::KiCadObjectType::KOT_SCH_NO_CONNECT: return SCH_NO_CONNECT_T;
59 case types::KiCadObjectType::KOT_SCH_BUS_WIRE_ENTRY: return SCH_BUS_WIRE_ENTRY_T;
60 case types::KiCadObjectType::KOT_SCH_BUS_BUS_ENTRY: return SCH_BUS_BUS_ENTRY_T;
61 case types::KiCadObjectType::KOT_SCH_LINE: return SCH_LINE_T;
62 case types::KiCadObjectType::KOT_SCH_SHAPE: return SCH_SHAPE_T;
63 case types::KiCadObjectType::KOT_SCH_BITMAP: return SCH_BITMAP_T;
64 case types::KiCadObjectType::KOT_SCH_TEXTBOX: return SCH_TEXTBOX_T;
65 case types::KiCadObjectType::KOT_SCH_TEXT: return SCH_TEXT_T;
66 case types::KiCadObjectType::KOT_SCH_TABLE: return SCH_TABLE_T;
67 case types::KiCadObjectType::KOT_SCH_TABLECELL: return SCH_TABLECELL_T;
68 case types::KiCadObjectType::KOT_SCH_LABEL: return SCH_LABEL_T;
69 case types::KiCadObjectType::KOT_SCH_GLOBAL_LABEL: return SCH_GLOBAL_LABEL_T;
70 case types::KiCadObjectType::KOT_SCH_HIER_LABEL: return SCH_HIER_LABEL_T;
71 case types::KiCadObjectType::KOT_SCH_DIRECTIVE_LABEL: return SCH_DIRECTIVE_LABEL_T;
72 case types::KiCadObjectType::KOT_SCH_FIELD: return SCH_FIELD_T;
73 case types::KiCadObjectType::KOT_SCH_SYMBOL: return SCH_SYMBOL_T;
74 case types::KiCadObjectType::KOT_SCH_SHEET_PIN: return SCH_SHEET_PIN_T;
75 case types::KiCadObjectType::KOT_SCH_SHEET: return SCH_SHEET_T;
76 case types::KiCadObjectType::KOT_SCH_PIN: return SCH_PIN_T;
77 case types::KiCadObjectType::KOT_LIB_SYMBOL: return LIB_SYMBOL_T;
78 case types::KiCadObjectType::KOT_WSG_LINE: return WSG_LINE_T;
79 case types::KiCadObjectType::KOT_WSG_RECT: return WSG_RECT_T;
80 case types::KiCadObjectType::KOT_WSG_POLY: return WSG_POLY_T;
81 case types::KiCadObjectType::KOT_WSG_TEXT: return WSG_TEXT_T;
82 case types::KiCadObjectType::KOT_WSG_BITMAP: return WSG_BITMAP_T;
83 case types::KiCadObjectType::KOT_WSG_PAGE: return WSG_PAGE_T;
84
85 case types::KiCadObjectType::KOT_UNKNOWN: return TYPE_NOT_INIT;
86 default:
87 wxCHECK_MSG( false, TYPE_NOT_INIT,
88 "Unhandled case in FromProtoEnum<types::KiCadObjectType>" );
89 }
90}
91
92
93template<>
94types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
95{
96 switch( aValue )
97 {
98 case PCB_FOOTPRINT_T: return types::KiCadObjectType::KOT_PCB_FOOTPRINT;
99 case PCB_PAD_T: return types::KiCadObjectType::KOT_PCB_PAD;
100 case PCB_SHAPE_T: return types::KiCadObjectType::KOT_PCB_SHAPE;
101 case PCB_REFERENCE_IMAGE_T: return types::KiCadObjectType::KOT_PCB_REFERENCE_IMAGE;
102 case PCB_FIELD_T: return types::KiCadObjectType::KOT_PCB_FIELD;
103 case PCB_GENERATOR_T: return types::KiCadObjectType::KOT_PCB_GENERATOR;
104 case PCB_TEXT_T: return types::KiCadObjectType::KOT_PCB_TEXT;
105 case PCB_TEXTBOX_T: return types::KiCadObjectType::KOT_PCB_TEXTBOX;
106 case PCB_TABLE_T: return types::KiCadObjectType::KOT_PCB_TABLE;
107 case PCB_TABLECELL_T: return types::KiCadObjectType::KOT_PCB_TABLECELL;
108 case PCB_TRACE_T: return types::KiCadObjectType::KOT_PCB_TRACE;
109 case PCB_VIA_T: return types::KiCadObjectType::KOT_PCB_VIA;
110 case PCB_ARC_T: return types::KiCadObjectType::KOT_PCB_ARC;
111 case PCB_MARKER_T: return types::KiCadObjectType::KOT_PCB_MARKER;
112 case PCB_DIMENSION_T: return types::KiCadObjectType::KOT_PCB_DIMENSION;
113 case PCB_ZONE_T: return types::KiCadObjectType::KOT_PCB_ZONE;
114 case PCB_GROUP_T: return types::KiCadObjectType::KOT_PCB_GROUP;
115 case SCH_MARKER_T: return types::KiCadObjectType::KOT_SCH_MARKER;
116 case SCH_JUNCTION_T: return types::KiCadObjectType::KOT_SCH_JUNCTION;
117 case SCH_NO_CONNECT_T: return types::KiCadObjectType::KOT_SCH_NO_CONNECT;
118 case SCH_BUS_WIRE_ENTRY_T: return types::KiCadObjectType::KOT_SCH_BUS_WIRE_ENTRY;
119 case SCH_BUS_BUS_ENTRY_T: return types::KiCadObjectType::KOT_SCH_BUS_BUS_ENTRY;
120 case SCH_LINE_T: return types::KiCadObjectType::KOT_SCH_LINE;
121 case SCH_SHAPE_T: return types::KiCadObjectType::KOT_SCH_SHAPE;
122 case SCH_BITMAP_T: return types::KiCadObjectType::KOT_SCH_BITMAP;
123 case SCH_TEXTBOX_T: return types::KiCadObjectType::KOT_SCH_TEXTBOX;
124 case SCH_TEXT_T: return types::KiCadObjectType::KOT_SCH_TEXT;
125 case SCH_TABLE_T: return types::KiCadObjectType::KOT_SCH_TABLE;
126 case SCH_TABLECELL_T: return types::KiCadObjectType::KOT_SCH_TABLECELL;
127 case SCH_LABEL_T: return types::KiCadObjectType::KOT_SCH_LABEL;
128 case SCH_GLOBAL_LABEL_T: return types::KiCadObjectType::KOT_SCH_GLOBAL_LABEL;
129 case SCH_HIER_LABEL_T: return types::KiCadObjectType::KOT_SCH_HIER_LABEL;
130 case SCH_DIRECTIVE_LABEL_T: return types::KiCadObjectType::KOT_SCH_DIRECTIVE_LABEL;
131 case SCH_FIELD_T: return types::KiCadObjectType::KOT_SCH_FIELD;
132 case SCH_SYMBOL_T: return types::KiCadObjectType::KOT_SCH_SYMBOL;
133 case SCH_SHEET_PIN_T: return types::KiCadObjectType::KOT_SCH_SHEET_PIN;
134 case SCH_SHEET_T: return types::KiCadObjectType::KOT_SCH_SHEET;
135 case SCH_PIN_T: return types::KiCadObjectType::KOT_SCH_PIN;
136 case LIB_SYMBOL_T: return types::KiCadObjectType::KOT_LIB_SYMBOL;
137 case WSG_LINE_T: return types::KiCadObjectType::KOT_WSG_LINE;
138 case WSG_RECT_T: return types::KiCadObjectType::KOT_WSG_RECT;
139 case WSG_POLY_T: return types::KiCadObjectType::KOT_WSG_POLY;
140 case WSG_TEXT_T: return types::KiCadObjectType::KOT_WSG_TEXT;
141 case WSG_BITMAP_T: return types::KiCadObjectType::KOT_WSG_BITMAP;
142 case WSG_PAGE_T: return types::KiCadObjectType::KOT_WSG_PAGE;
143 default:
144 wxCHECK_MSG( false, types::KiCadObjectType::KOT_UNKNOWN,
145 "Unhandled case in ToProtoEnum<KICAD_T>");
146 }
147}
148
149
150template<>
151PCB_LAYER_ID FromProtoEnum( board::types::BoardLayer aValue )
152{
153 switch( aValue )
154 {
155 case board::types::BoardLayer::BL_UNDEFINED: return UNDEFINED_LAYER;
156 case board::types::BoardLayer::BL_UNSELECTED: return UNSELECTED_LAYER;
157 case board::types::BoardLayer::BL_F_Cu: return F_Cu;
158 case board::types::BoardLayer::BL_In1_Cu: return In1_Cu;
159 case board::types::BoardLayer::BL_In2_Cu: return In2_Cu;
160 case board::types::BoardLayer::BL_In3_Cu: return In3_Cu;
161 case board::types::BoardLayer::BL_In4_Cu: return In4_Cu;
162 case board::types::BoardLayer::BL_In5_Cu: return In5_Cu;
163 case board::types::BoardLayer::BL_In6_Cu: return In6_Cu;
164 case board::types::BoardLayer::BL_In7_Cu: return In7_Cu;
165 case board::types::BoardLayer::BL_In8_Cu: return In8_Cu;
166 case board::types::BoardLayer::BL_In9_Cu: return In9_Cu;
167 case board::types::BoardLayer::BL_In10_Cu: return In10_Cu;
168 case board::types::BoardLayer::BL_In11_Cu: return In11_Cu;
169 case board::types::BoardLayer::BL_In12_Cu: return In12_Cu;
170 case board::types::BoardLayer::BL_In13_Cu: return In13_Cu;
171 case board::types::BoardLayer::BL_In14_Cu: return In14_Cu;
172 case board::types::BoardLayer::BL_In15_Cu: return In15_Cu;
173 case board::types::BoardLayer::BL_In16_Cu: return In16_Cu;
174 case board::types::BoardLayer::BL_In17_Cu: return In17_Cu;
175 case board::types::BoardLayer::BL_In18_Cu: return In18_Cu;
176 case board::types::BoardLayer::BL_In19_Cu: return In19_Cu;
177 case board::types::BoardLayer::BL_In20_Cu: return In20_Cu;
178 case board::types::BoardLayer::BL_In21_Cu: return In21_Cu;
179 case board::types::BoardLayer::BL_In22_Cu: return In22_Cu;
180 case board::types::BoardLayer::BL_In23_Cu: return In23_Cu;
181 case board::types::BoardLayer::BL_In24_Cu: return In24_Cu;
182 case board::types::BoardLayer::BL_In25_Cu: return In25_Cu;
183 case board::types::BoardLayer::BL_In26_Cu: return In26_Cu;
184 case board::types::BoardLayer::BL_In27_Cu: return In27_Cu;
185 case board::types::BoardLayer::BL_In28_Cu: return In28_Cu;
186 case board::types::BoardLayer::BL_In29_Cu: return In29_Cu;
187 case board::types::BoardLayer::BL_In30_Cu: return In30_Cu;
188 case board::types::BoardLayer::BL_B_Cu: return B_Cu;
189 case board::types::BoardLayer::BL_B_Adhes: return B_Adhes;
190 case board::types::BoardLayer::BL_F_Adhes: return F_Adhes;
191 case board::types::BoardLayer::BL_B_Paste: return B_Paste;
192 case board::types::BoardLayer::BL_F_Paste: return F_Paste;
193 case board::types::BoardLayer::BL_B_SilkS: return B_SilkS;
194 case board::types::BoardLayer::BL_F_SilkS: return F_SilkS;
195 case board::types::BoardLayer::BL_B_Mask: return B_Mask;
196 case board::types::BoardLayer::BL_F_Mask: return F_Mask;
197 case board::types::BoardLayer::BL_Dwgs_User: return Dwgs_User;
198 case board::types::BoardLayer::BL_Cmts_User: return Cmts_User;
199 case board::types::BoardLayer::BL_Eco1_User: return Eco1_User;
200 case board::types::BoardLayer::BL_Eco2_User: return Eco2_User;
201 case board::types::BoardLayer::BL_Edge_Cuts: return Edge_Cuts;
202 case board::types::BoardLayer::BL_Margin: return Margin;
203 case board::types::BoardLayer::BL_B_CrtYd: return B_CrtYd;
204 case board::types::BoardLayer::BL_F_CrtYd: return F_CrtYd;
205 case board::types::BoardLayer::BL_B_Fab: return B_Fab;
206 case board::types::BoardLayer::BL_F_Fab: return F_Fab;
207 case board::types::BoardLayer::BL_User_1: return User_1;
208 case board::types::BoardLayer::BL_User_2: return User_2;
209 case board::types::BoardLayer::BL_User_3: return User_3;
210 case board::types::BoardLayer::BL_User_4: return User_4;
211 case board::types::BoardLayer::BL_User_5: return User_5;
212 case board::types::BoardLayer::BL_User_6: return User_6;
213 case board::types::BoardLayer::BL_User_7: return User_7;
214 case board::types::BoardLayer::BL_User_8: return User_8;
215 case board::types::BoardLayer::BL_User_9: return User_9;
216
217 case board::types::BoardLayer::BL_UNKNOWN: return UNDEFINED_LAYER;
218 default:
219 wxCHECK_MSG( false, UNDEFINED_LAYER,
220 "Unhandled case in FromProtoEnum<board::types::BoardLayer>" );
221 }
222}
223
224
225template<>
226board::types::BoardLayer ToProtoEnum( PCB_LAYER_ID aValue )
227{
228 switch( aValue )
229 {
230 case UNDEFINED_LAYER: return board::types::BoardLayer::BL_UNDEFINED;
231 case UNSELECTED_LAYER: return board::types::BoardLayer::BL_UNSELECTED;
232 case F_Cu: return board::types::BoardLayer::BL_F_Cu;
233 case In1_Cu: return board::types::BoardLayer::BL_In1_Cu;
234 case In2_Cu: return board::types::BoardLayer::BL_In2_Cu;
235 case In3_Cu: return board::types::BoardLayer::BL_In3_Cu;
236 case In4_Cu: return board::types::BoardLayer::BL_In4_Cu;
237 case In5_Cu: return board::types::BoardLayer::BL_In5_Cu;
238 case In6_Cu: return board::types::BoardLayer::BL_In6_Cu;
239 case In7_Cu: return board::types::BoardLayer::BL_In7_Cu;
240 case In8_Cu: return board::types::BoardLayer::BL_In8_Cu;
241 case In9_Cu: return board::types::BoardLayer::BL_In9_Cu;
242 case In10_Cu: return board::types::BoardLayer::BL_In10_Cu;
243 case In11_Cu: return board::types::BoardLayer::BL_In11_Cu;
244 case In12_Cu: return board::types::BoardLayer::BL_In12_Cu;
245 case In13_Cu: return board::types::BoardLayer::BL_In13_Cu;
246 case In14_Cu: return board::types::BoardLayer::BL_In14_Cu;
247 case In15_Cu: return board::types::BoardLayer::BL_In15_Cu;
248 case In16_Cu: return board::types::BoardLayer::BL_In16_Cu;
249 case In17_Cu: return board::types::BoardLayer::BL_In17_Cu;
250 case In18_Cu: return board::types::BoardLayer::BL_In18_Cu;
251 case In19_Cu: return board::types::BoardLayer::BL_In19_Cu;
252 case In20_Cu: return board::types::BoardLayer::BL_In20_Cu;
253 case In21_Cu: return board::types::BoardLayer::BL_In21_Cu;
254 case In22_Cu: return board::types::BoardLayer::BL_In22_Cu;
255 case In23_Cu: return board::types::BoardLayer::BL_In23_Cu;
256 case In24_Cu: return board::types::BoardLayer::BL_In24_Cu;
257 case In25_Cu: return board::types::BoardLayer::BL_In25_Cu;
258 case In26_Cu: return board::types::BoardLayer::BL_In26_Cu;
259 case In27_Cu: return board::types::BoardLayer::BL_In27_Cu;
260 case In28_Cu: return board::types::BoardLayer::BL_In28_Cu;
261 case In29_Cu: return board::types::BoardLayer::BL_In29_Cu;
262 case In30_Cu: return board::types::BoardLayer::BL_In30_Cu;
263 case B_Cu: return board::types::BoardLayer::BL_B_Cu;
264 case B_Adhes: return board::types::BoardLayer::BL_B_Adhes;
265 case F_Adhes: return board::types::BoardLayer::BL_F_Adhes;
266 case B_Paste: return board::types::BoardLayer::BL_B_Paste;
267 case F_Paste: return board::types::BoardLayer::BL_F_Paste;
268 case B_SilkS: return board::types::BoardLayer::BL_B_SilkS;
269 case F_SilkS: return board::types::BoardLayer::BL_F_SilkS;
270 case B_Mask: return board::types::BoardLayer::BL_B_Mask;
271 case F_Mask: return board::types::BoardLayer::BL_F_Mask;
272 case Dwgs_User: return board::types::BoardLayer::BL_Dwgs_User;
273 case Cmts_User: return board::types::BoardLayer::BL_Cmts_User;
274 case Eco1_User: return board::types::BoardLayer::BL_Eco1_User;
275 case Eco2_User: return board::types::BoardLayer::BL_Eco2_User;
276 case Edge_Cuts: return board::types::BoardLayer::BL_Edge_Cuts;
277 case Margin: return board::types::BoardLayer::BL_Margin;
278 case B_CrtYd: return board::types::BoardLayer::BL_B_CrtYd;
279 case F_CrtYd: return board::types::BoardLayer::BL_F_CrtYd;
280 case B_Fab: return board::types::BoardLayer::BL_B_Fab;
281 case F_Fab: return board::types::BoardLayer::BL_F_Fab;
282 case User_1: return board::types::BoardLayer::BL_User_1;
283 case User_2: return board::types::BoardLayer::BL_User_2;
284 case User_3: return board::types::BoardLayer::BL_User_3;
285 case User_4: return board::types::BoardLayer::BL_User_4;
286 case User_5: return board::types::BoardLayer::BL_User_5;
287 case User_6: return board::types::BoardLayer::BL_User_6;
288 case User_7: return board::types::BoardLayer::BL_User_7;
289 case User_8: return board::types::BoardLayer::BL_User_8;
290 case User_9: return board::types::BoardLayer::BL_User_9;
291 default:
292 wxCHECK_MSG( false, board::types::BoardLayer::BL_UNKNOWN,
293 "Unhandled case in ToProtoEnum<PCB_LAYER_ID>");
294 }
295}
296
297
298template<>
299SCH_LAYER_ID FromProtoEnum( schematic::types::SchematicLayer aValue )
300{
301 switch( aValue )
302 {
303
304 default:
305 wxCHECK_MSG( false, SCH_LAYER_ID_START,
306 "Unhandled case in FromProtoEnum<schematic::types::SchematicLayer>" );
307 }
308}
309
310
311template<>
312schematic::types::SchematicLayer ToProtoEnum( SCH_LAYER_ID aValue )
313{
314 switch( aValue )
315 {
316
317 default:
318 wxCHECK_MSG( false, schematic::types::SchematicLayer::SL_UNKNOWN,
319 "Unhandled case in ToProtoEnum<SCH_LAYER_ID>");
320 }
321}
322
323
324template<>
325GR_TEXT_H_ALIGN_T FromProtoEnum( types::HorizontalAlignment aValue )
326{
327 switch( aValue )
328 {
329 case types::HorizontalAlignment::HA_LEFT: return GR_TEXT_H_ALIGN_LEFT;
330 case types::HorizontalAlignment::HA_CENTER: return GR_TEXT_H_ALIGN_CENTER;
331 case types::HorizontalAlignment::HA_RIGHT: return GR_TEXT_H_ALIGN_RIGHT;
332 case types::HorizontalAlignment::HA_INDETERMINATE: return GR_TEXT_H_ALIGN_INDETERMINATE;
333
334 case types::HorizontalAlignment::HA_UNKNOWN: return GR_TEXT_H_ALIGN_CENTER;
335 default:
336 wxCHECK_MSG( false, GR_TEXT_H_ALIGN_CENTER,
337 "Unhandled case in FromProtoEnum<types::HorizontalAlignment>" );
338 }
339}
340
341
342template<>
343types::HorizontalAlignment ToProtoEnum( GR_TEXT_H_ALIGN_T aValue )
344{
345 switch( aValue )
346 {
347 case GR_TEXT_H_ALIGN_LEFT: return types::HorizontalAlignment::HA_LEFT;
348 case GR_TEXT_H_ALIGN_CENTER: return types::HorizontalAlignment::HA_CENTER;
349 case GR_TEXT_H_ALIGN_RIGHT: return types::HorizontalAlignment::HA_RIGHT;
350 case GR_TEXT_H_ALIGN_INDETERMINATE: return types::HorizontalAlignment::HA_INDETERMINATE;
351 default:
352 wxCHECK_MSG( false, types::HorizontalAlignment::HA_UNKNOWN,
353 "Unhandled case in ToProtoEnum<GR_TEXT_H_ALIGN_T>");
354 }
355}
356
357
358template<>
359GR_TEXT_V_ALIGN_T FromProtoEnum( types::VerticalAlignment aValue )
360{
361 switch( aValue )
362 {
363 case types::VerticalAlignment::VA_TOP: return GR_TEXT_V_ALIGN_TOP;
364 case types::VerticalAlignment::VA_CENTER: return GR_TEXT_V_ALIGN_CENTER;
365 case types::VerticalAlignment::VA_BOTTOM: return GR_TEXT_V_ALIGN_BOTTOM;
366 case types::VerticalAlignment::VA_INDETERMINATE: return GR_TEXT_V_ALIGN_INDETERMINATE;
367
368 case types::VerticalAlignment::VA_UNKNOWN: return GR_TEXT_V_ALIGN_CENTER;
369 default:
370 wxCHECK_MSG( false, GR_TEXT_V_ALIGN_CENTER,
371 "Unhandled case in FromProtoEnum<types::VerticalAlignment>" );
372 }
373}
374
375
376template<>
377types::VerticalAlignment ToProtoEnum( GR_TEXT_V_ALIGN_T aValue )
378{
379 switch( aValue )
380 {
381 case GR_TEXT_V_ALIGN_TOP: return types::VerticalAlignment::VA_TOP;
382 case GR_TEXT_V_ALIGN_CENTER: return types::VerticalAlignment::VA_CENTER;
383 case GR_TEXT_V_ALIGN_BOTTOM: return types::VerticalAlignment::VA_BOTTOM;
384 case GR_TEXT_V_ALIGN_INDETERMINATE: return types::VerticalAlignment::VA_INDETERMINATE;
385 default:
386 wxCHECK_MSG( false, types::VerticalAlignment::VA_UNKNOWN,
387 "Unhandled case in ToProtoEnum<GR_TEXT_V_ALIGN_T>");
388 }
389}
390
391
392template<>
393LINE_STYLE FromProtoEnum( types::StrokeLineStyle aValue )
394{
395 switch( aValue )
396 {
397 case types::StrokeLineStyle::SLS_DEFAULT: return LINE_STYLE::DEFAULT;
398 case types::StrokeLineStyle::SLS_SOLID: return LINE_STYLE::SOLID;
399 case types::StrokeLineStyle::SLS_DASH: return LINE_STYLE::DASH;
400 case types::StrokeLineStyle::SLS_DOT: return LINE_STYLE::DOT;
401 case types::StrokeLineStyle::SLS_DASHDOT: return LINE_STYLE::DASHDOT;
402 case types::StrokeLineStyle::SLS_DASHDOTDOT: return LINE_STYLE::DASHDOTDOT;
403 case types::StrokeLineStyle::SLS_UNKNOWN:
404 default:
405 wxCHECK_MSG( false, LINE_STYLE::DEFAULT,
406 "Unhandled case in FromProtoEnum<types::StrokeLineStyle>" );
407 }
408}
409
410
411template<>
412types::StrokeLineStyle ToProtoEnum( LINE_STYLE aValue )
413{
414 switch( aValue )
415 {
416 case LINE_STYLE::DEFAULT: return types::StrokeLineStyle::SLS_DEFAULT;
417 case LINE_STYLE::SOLID: return types::StrokeLineStyle::SLS_SOLID;
418 case LINE_STYLE::DASH: return types::StrokeLineStyle::SLS_DASH;
419 case LINE_STYLE::DOT: return types::StrokeLineStyle::SLS_DOT;
420 case LINE_STYLE::DASHDOT: return types::StrokeLineStyle::SLS_DASHDOT;
421 case LINE_STYLE::DASHDOTDOT: return types::StrokeLineStyle::SLS_DASHDOTDOT;
422 default:
423 wxCHECK_MSG( false, types::StrokeLineStyle::SLS_UNKNOWN,
424 "Unhandled case in ToProtoEnum<LINE_STYLE>");
425 }
426}
types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
Definition: api_enums.cpp:94
KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
Definition: api_enums.cpp:35
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:352
@ SCH_LAYER_ID_START
Definition: layer_ids.h:353
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ In22_Cu
Definition: layer_ids.h:87
@ In11_Cu
Definition: layer_ids.h:76
@ In29_Cu
Definition: layer_ids.h:94
@ In30_Cu
Definition: layer_ids.h:95
@ User_8
Definition: layer_ids.h:131
@ F_CrtYd
Definition: layer_ids.h:116
@ In17_Cu
Definition: layer_ids.h:82
@ B_Adhes
Definition: layer_ids.h:103
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ F_Paste
Definition: layer_ids.h:104
@ In9_Cu
Definition: layer_ids.h:74
@ Cmts_User
Definition: layer_ids.h:108
@ User_6
Definition: layer_ids.h:129
@ User_7
Definition: layer_ids.h:130
@ In19_Cu
Definition: layer_ids.h:84
@ In7_Cu
Definition: layer_ids.h:72
@ In28_Cu
Definition: layer_ids.h:93
@ In26_Cu
Definition: layer_ids.h:91
@ F_Adhes
Definition: layer_ids.h:102
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ User_5
Definition: layer_ids.h:128
@ Eco1_User
Definition: layer_ids.h:109
@ F_Mask
Definition: layer_ids.h:97
@ In21_Cu
Definition: layer_ids.h:86
@ In23_Cu
Definition: layer_ids.h:88
@ B_Paste
Definition: layer_ids.h:105
@ In15_Cu
Definition: layer_ids.h:80
@ In2_Cu
Definition: layer_ids.h:67
@ User_9
Definition: layer_ids.h:132
@ UNSELECTED_LAYER
Definition: layer_ids.h:62
@ F_Fab
Definition: layer_ids.h:119
@ In10_Cu
Definition: layer_ids.h:75
@ Margin
Definition: layer_ids.h:113
@ F_SilkS
Definition: layer_ids.h:100
@ In4_Cu
Definition: layer_ids.h:69
@ B_CrtYd
Definition: layer_ids.h:115
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ Eco2_User
Definition: layer_ids.h:110
@ In16_Cu
Definition: layer_ids.h:81
@ In24_Cu
Definition: layer_ids.h:89
@ In1_Cu
Definition: layer_ids.h:66
@ User_3
Definition: layer_ids.h:126
@ User_1
Definition: layer_ids.h:124
@ B_SilkS
Definition: layer_ids.h:101
@ In13_Cu
Definition: layer_ids.h:78
@ User_4
Definition: layer_ids.h:127
@ In8_Cu
Definition: layer_ids.h:73
@ In14_Cu
Definition: layer_ids.h:79
@ User_2
Definition: layer_ids.h:125
@ In12_Cu
Definition: layer_ids.h:77
@ In27_Cu
Definition: layer_ids.h:92
@ In6_Cu
Definition: layer_ids.h:71
@ In5_Cu
Definition: layer_ids.h:70
@ In3_Cu
Definition: layer_ids.h:68
@ In20_Cu
Definition: layer_ids.h:85
@ F_Cu
Definition: layer_ids.h:64
@ In18_Cu
Definition: layer_ids.h:83
@ In25_Cu
Definition: layer_ids.h:90
@ B_Fab
Definition: layer_ids.h:118
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:47
GR_TEXT_H_ALIGN_T
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_H_ALIGN_RIGHT
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_H_ALIGN_INDETERMINATE
GR_TEXT_V_ALIGN_T
@ GR_TEXT_V_ALIGN_BOTTOM
@ GR_TEXT_V_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_TOP
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_TABLE_T
Definition: typeinfo.h:165
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ SCH_LINE_T
Definition: typeinfo.h:163
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:160
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition: typeinfo.h:91
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ TYPE_NOT_INIT
Definition: typeinfo.h:81
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ SCH_TABLECELL_T
Definition: typeinfo.h:166
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:107
@ SCH_FIELD_T
Definition: typeinfo.h:150
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:171
@ SCH_LABEL_T
Definition: typeinfo.h:167
@ SCH_SHEET_T
Definition: typeinfo.h:174
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition: typeinfo.h:89
@ SCH_MARKER_T
Definition: typeinfo.h:158
@ SCH_SHAPE_T
Definition: typeinfo.h:149
@ WSG_POLY_T
Definition: typeinfo.h:217
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:169
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:99
@ WSG_LINE_T
Definition: typeinfo.h:215
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:162
@ WSG_TEXT_T
Definition: typeinfo.h:218
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition: typeinfo.h:95
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:173
@ SCH_TEXT_T
Definition: typeinfo.h:151
@ WSG_PAGE_T
Definition: typeinfo.h:220
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ WSG_RECT_T
Definition: typeinfo.h:216
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_BITMAP_T
Definition: typeinfo.h:164
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:100
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition: typeinfo.h:94
@ SCH_TEXTBOX_T
Definition: typeinfo.h:152
@ WSG_BITMAP_T
Definition: typeinfo.h:219
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
@ SCH_PIN_T
Definition: typeinfo.h:153