KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_pcb_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 Jon Evans <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <import_export.h>
22#include <api/api_enums.h>
23#include <api/board/board_types.pb.h>
24#include <api/board/board_commands.pb.h>
25#include <wx/wx.h>
27
29#include <padstack.h>
30#include <pcb_dimension.h>
31#include <pcb_track.h>
32#include <zones.h>
33#include <zone_settings.h>
35
36// Adding something new here? Add it to test_api_enums.cpp!
37
38using namespace kiapi::board;
39using namespace kiapi::board::commands;
40
41template<>
42types::PadType ToProtoEnum( PAD_ATTRIB aValue )
43{
44 switch( aValue )
45 {
46 case PAD_ATTRIB::PTH: return types::PadType::PT_PTH;
47 case PAD_ATTRIB::SMD: return types::PadType::PT_SMD;
48 case PAD_ATTRIB::CONN: return types::PadType::PT_EDGE_CONNECTOR;
49 case PAD_ATTRIB::NPTH: return types::PadType::PT_NPTH;
50
51 default:
52 wxCHECK_MSG( false, types::PadType::PT_UNKNOWN,
53 "Unhandled case in ToProtoEnum<PAD_ATTRIB>");
54 }
55}
56
57
58template<>
59PAD_ATTRIB FromProtoEnum( types::PadType aValue )
60{
61 switch( aValue )
62 {
63 case types::PadType::PT_UNKNOWN:
64 case types::PadType::PT_PTH: return PAD_ATTRIB::PTH;
65 case types::PadType::PT_SMD: return PAD_ATTRIB::SMD;
66 case types::PadType::PT_EDGE_CONNECTOR: return PAD_ATTRIB::CONN;
67 case types::PadType::PT_NPTH: return PAD_ATTRIB::NPTH;
68
69 default:
70 wxCHECK_MSG( false, PAD_ATTRIB::PTH,
71 "Unhandled case in FromProtoEnum<types::PadType>" );
72 }
73}
74
75template<>
76types::DrillShape ToProtoEnum( PAD_DRILL_SHAPE aValue )
77{
78 switch( aValue )
79 {
80 case PAD_DRILL_SHAPE::CIRCLE: return types::DrillShape::DS_CIRCLE;
81 case PAD_DRILL_SHAPE::OBLONG: return types::DrillShape::DS_OBLONG;
82 case PAD_DRILL_SHAPE::UNDEFINED: return types::DrillShape::DS_UNDEFINED;
83 default:
84 wxCHECK_MSG( false, types::DrillShape::DS_UNKNOWN,
85 "Unhandled case in ToProtoEnum<PAD_DRILL_SHAPE>");
86 }
87}
88
89template<>
90PAD_DRILL_SHAPE FromProtoEnum( types::DrillShape aValue )
91{
92 switch( aValue )
93 {
94 case types::DrillShape::DS_CIRCLE: return PAD_DRILL_SHAPE::CIRCLE;
95 case types::DrillShape::DS_OBLONG: return PAD_DRILL_SHAPE::OBLONG;
96 case types::DrillShape::DS_UNKNOWN:
97 case types::DrillShape::DS_UNDEFINED: return PAD_DRILL_SHAPE::UNDEFINED;
98 default:
99 wxCHECK_MSG( false, PAD_DRILL_SHAPE::UNDEFINED,
100 "Unhandled case in FromProtoEnum<types::DrillShape>" );
101 }
102}
103
104template<>
105types::PadStackShape ToProtoEnum( PAD_SHAPE aValue )
106{
107 switch( aValue )
108 {
109 case PAD_SHAPE::CIRCLE: return types::PadStackShape::PSS_CIRCLE;
110 case PAD_SHAPE::RECTANGLE: return types::PadStackShape::PSS_RECTANGLE;
111 case PAD_SHAPE::OVAL: return types::PadStackShape::PSS_OVAL;
112 case PAD_SHAPE::TRAPEZOID: return types::PadStackShape::PSS_TRAPEZOID;
113 case PAD_SHAPE::ROUNDRECT: return types::PadStackShape::PSS_ROUNDRECT;
114 case PAD_SHAPE::CHAMFERED_RECT: return types::PadStackShape::PSS_CHAMFEREDRECT;
115 case PAD_SHAPE::CUSTOM: return types::PadStackShape::PSS_CUSTOM;
116
117 default:
118 wxCHECK_MSG( false, types::PadStackShape::PSS_UNKNOWN,
119 "Unhandled case in ToProtoEnum<PAD_SHAPE>");
120 }
121}
122
123
124template<>
125PAD_SHAPE FromProtoEnum( types::PadStackShape aValue )
126{
127 switch( aValue )
128 {
129 case types::PadStackShape::PSS_UNKNOWN:
130 case types::PadStackShape::PSS_CIRCLE: return PAD_SHAPE::CIRCLE;
131 case types::PadStackShape::PSS_RECTANGLE: return PAD_SHAPE::RECTANGLE;
132 case types::PadStackShape::PSS_OVAL: return PAD_SHAPE::OVAL;
133 case types::PadStackShape::PSS_TRAPEZOID: return PAD_SHAPE::TRAPEZOID;
134 case types::PadStackShape::PSS_ROUNDRECT: return PAD_SHAPE::ROUNDRECT;
135 case types::PadStackShape::PSS_CHAMFEREDRECT: return PAD_SHAPE::CHAMFERED_RECT;
136 case types::PadStackShape::PSS_CUSTOM: return PAD_SHAPE::CUSTOM;
137
138 default:
139 wxCHECK_MSG( false, PAD_SHAPE::CIRCLE,
140 "Unhandled case in FromProtoEnum<types::PadStackShape>" );
141 }
142}
143
144
145template<>
146types::PadStackType ToProtoEnum( PADSTACK::MODE aValue )
147{
148 switch( aValue )
149 {
150 case PADSTACK::MODE::NORMAL: return types::PadStackType::PST_NORMAL;
151 case PADSTACK::MODE::FRONT_INNER_BACK: return types::PadStackType::PST_FRONT_INNER_BACK;
152 case PADSTACK::MODE::CUSTOM: return types::PadStackType::PST_CUSTOM;
153
154 default:
155 wxCHECK_MSG( false, types::PadStackType::PST_UNKNOWN,
156 "Unhandled case in ToProtoEnum<PADSTACK::MODE>");
157 }
158}
159
160
161template<>
162PADSTACK::MODE FromProtoEnum( types::PadStackType aValue )
163{
164 switch( aValue )
165 {
166 case types::PadStackType::PST_UNKNOWN:
167 case types::PadStackType::PST_NORMAL: return PADSTACK::MODE::NORMAL;
168 case types::PadStackType::PST_FRONT_INNER_BACK: return PADSTACK::MODE::FRONT_INNER_BACK;
169 case types::PadStackType::PST_CUSTOM: return PADSTACK::MODE::CUSTOM;
170
171 default:
172 wxCHECK_MSG( false, PADSTACK::MODE::NORMAL,
173 "Unhandled case in FromProtoEnum<types::PadStackType>" );
174 }
175}
176
177
178template<>
179types::ViaType ToProtoEnum( VIATYPE aValue )
180{
181 switch( aValue )
182 {
183 case VIATYPE::THROUGH: return types::ViaType::VT_THROUGH;
184 case VIATYPE::BLIND: return types::ViaType::VT_BLIND; // Since V10
185 case VIATYPE::BURIED: return types::ViaType::VT_BURIED;
186 case VIATYPE::MICROVIA: return types::ViaType::VT_MICRO;
187
188 default:
189 wxCHECK_MSG( false, types::ViaType::VT_UNKNOWN,
190 "Unhandled case in ToProtoEnum<VIATYPE>");
191 }
192}
193
194
195template<>
196VIATYPE FromProtoEnum( types::ViaType aValue )
197{
198 switch( aValue )
199 {
200 case types::ViaType::VT_UNKNOWN:
201 case types::ViaType::VT_THROUGH: return VIATYPE::THROUGH;
202 case types::ViaType::VT_BLIND_BURIED: return VIATYPE::BLIND;
203 case types::ViaType::VT_BLIND: return VIATYPE::BLIND; // Since V10
204 case types::ViaType::VT_BURIED: return VIATYPE::BURIED;
205 case types::ViaType::VT_MICRO: return VIATYPE::MICROVIA;
206
207 default:
208 wxCHECK_MSG( false, VIATYPE::THROUGH,
209 "Unhandled case in FromProtoEnum<types::ViaType>" );
210 }
211}
212
213
214template<>
215types::ZoneConnectionStyle ToProtoEnum( ZONE_CONNECTION aValue )
216{
217 switch( aValue )
218 {
219 case ZONE_CONNECTION::INHERITED: return types::ZoneConnectionStyle::ZCS_INHERITED;
220 case ZONE_CONNECTION::NONE: return types::ZoneConnectionStyle::ZCS_NONE;
221 case ZONE_CONNECTION::THERMAL: return types::ZoneConnectionStyle::ZCS_THERMAL;
222 case ZONE_CONNECTION::FULL: return types::ZoneConnectionStyle::ZCS_FULL;
223 case ZONE_CONNECTION::THT_THERMAL: return types::ZoneConnectionStyle::ZCS_PTH_THERMAL;
224
225 default:
226 wxCHECK_MSG( false, types::ZoneConnectionStyle::ZCS_UNKNOWN,
227 "Unhandled case in ToProtoEnum<ZONE_CONNECTION>");
228 }
229}
230
231
232template<>
233ZONE_CONNECTION FromProtoEnum( types::ZoneConnectionStyle aValue )
234{
235 switch( aValue )
236 {
237 case types::ZoneConnectionStyle::ZCS_UNKNOWN: return ZONE_CONNECTION::INHERITED;
238 case types::ZoneConnectionStyle::ZCS_INHERITED: return ZONE_CONNECTION::INHERITED;
239 case types::ZoneConnectionStyle::ZCS_NONE: return ZONE_CONNECTION::NONE;
240 case types::ZoneConnectionStyle::ZCS_THERMAL: return ZONE_CONNECTION::THERMAL;
241 case types::ZoneConnectionStyle::ZCS_FULL: return ZONE_CONNECTION::FULL;
242 case types::ZoneConnectionStyle::ZCS_PTH_THERMAL: return ZONE_CONNECTION::THT_THERMAL;
243
244 default:
245 wxCHECK_MSG( false, ZONE_CONNECTION::INHERITED,
246 "Unhandled case in FromProtoEnum<types::ZoneConnectionStyle>" );
247 }
248}
249
250
251template<>
252types::UnconnectedLayerRemoval ToProtoEnum( PADSTACK::UNCONNECTED_LAYER_MODE aValue )
253{
254 switch( aValue )
255 {
257 return types::UnconnectedLayerRemoval::ULR_KEEP;
258
260 return types::UnconnectedLayerRemoval::ULR_REMOVE;
261
263 return types::UnconnectedLayerRemoval::ULR_REMOVE_EXCEPT_START_AND_END;
264
266 return types::UnconnectedLayerRemoval::ULR_START_END_ONLY;
267
268 default:
269 wxCHECK_MSG( false, types::UnconnectedLayerRemoval::ULR_UNKNOWN,
270 "Unhandled case in ToProtoEnum<PADSTACK::UNCONNECTED_LAYER_MODE>");
271 }
272}
273
274
275template<>
276PADSTACK::UNCONNECTED_LAYER_MODE FromProtoEnum( types::UnconnectedLayerRemoval aValue )
277{
278 switch( aValue )
279 {
280 case types::UnconnectedLayerRemoval::ULR_UNKNOWN:
281 case types::UnconnectedLayerRemoval::ULR_KEEP:
283
284 case types::UnconnectedLayerRemoval::ULR_REMOVE:
286
287 case types::UnconnectedLayerRemoval::ULR_REMOVE_EXCEPT_START_AND_END:
289
290 case types::UnconnectedLayerRemoval::ULR_START_END_ONLY:
292
293 default:
295 "Unhandled case in FromProtoEnum<types::UnconnectedLayerRemoval>");
296 }
297}
298
299
300template<>
301types::IslandRemovalMode ToProtoEnum( ISLAND_REMOVAL_MODE aValue )
302{
303 switch( aValue )
304 {
305 case ISLAND_REMOVAL_MODE::ALWAYS: return types::IslandRemovalMode::IRM_ALWAYS;
306 case ISLAND_REMOVAL_MODE::NEVER: return types::IslandRemovalMode::IRM_NEVER;
307 case ISLAND_REMOVAL_MODE::AREA: return types::IslandRemovalMode::IRM_AREA;
308
309 default:
310 wxCHECK_MSG( false, types::IslandRemovalMode::IRM_UNKNOWN,
311 "Unhandled case in ToProtoEnum<ISLAND_REMOVAL_MODE>");
312 }
313}
314
315
316template<>
317ISLAND_REMOVAL_MODE FromProtoEnum( types::IslandRemovalMode aValue )
318{
319 switch( aValue )
320 {
321 case types::IslandRemovalMode::IRM_UNKNOWN:
322 case types::IslandRemovalMode::IRM_ALWAYS: return ISLAND_REMOVAL_MODE::ALWAYS;
323 case types::IslandRemovalMode::IRM_NEVER: return ISLAND_REMOVAL_MODE::NEVER;
324 case types::IslandRemovalMode::IRM_AREA: return ISLAND_REMOVAL_MODE::AREA;
325
326 default:
327 wxCHECK_MSG( false, ISLAND_REMOVAL_MODE::ALWAYS,
328 "Unhandled case in FromProtoEnum<types::IslandRemovalMode>" );
329 }
330}
331
332
333template<>
334types::ZoneFillMode ToProtoEnum( ZONE_FILL_MODE aValue )
335{
336 switch( aValue )
337 {
338 case ZONE_FILL_MODE::POLYGONS: return types::ZoneFillMode::ZFM_SOLID;
339 case ZONE_FILL_MODE::HATCH_PATTERN: return types::ZoneFillMode::ZFM_HATCHED;
340
341 default:
342 wxCHECK_MSG( false, types::ZoneFillMode::ZFM_UNKNOWN,
343 "Unhandled case in ToProtoEnum<ZONE_FILL_MODE>");
344 }
345}
346
347
348template<>
349ZONE_FILL_MODE FromProtoEnum( types::ZoneFillMode aValue )
350{
351 switch( aValue )
352 {
353 case types::ZoneFillMode::ZFM_UNKNOWN:
354 case types::ZoneFillMode::ZFM_SOLID: return ZONE_FILL_MODE::POLYGONS;
355 case types::ZoneFillMode::ZFM_HATCHED: return ZONE_FILL_MODE::HATCH_PATTERN;
356
357 default:
358 wxCHECK_MSG( false, ZONE_FILL_MODE::POLYGONS,
359 "Unhandled case in FromProtoEnum<types::ZoneFillMode>" );
360 }
361}
362
363
364template<>
365types::ZoneBorderStyle ToProtoEnum( ZONE_BORDER_DISPLAY_STYLE aValue )
366{
367 switch( aValue )
368 {
369 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: return types::ZoneBorderStyle::ZBS_SOLID;
370 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: return types::ZoneBorderStyle::ZBS_DIAGONAL_FULL;
371 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: return types::ZoneBorderStyle::ZBS_DIAGONAL_EDGE;
372 case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER: return types::ZoneBorderStyle::ZBS_INVISIBLE;
373
374 default:
375 wxCHECK_MSG( false, types::ZoneBorderStyle::ZBS_UNKNOWN,
376 "Unhandled case in ToProtoEnum<ZONE_BORDER_DISPLAY_STYLE>");
377 }
378}
379
380
381template<>
382ZONE_BORDER_DISPLAY_STYLE FromProtoEnum( types::ZoneBorderStyle aValue )
383{
384 switch( aValue )
385 {
386 case types::ZoneBorderStyle::ZBS_SOLID: return ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
387 case types::ZoneBorderStyle::ZBS_DIAGONAL_FULL: return ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL;
388 case types::ZoneBorderStyle::ZBS_UNKNOWN:
389 case types::ZoneBorderStyle::ZBS_DIAGONAL_EDGE: return ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
390 case types::ZoneBorderStyle::ZBS_INVISIBLE: return ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER;
391
392 default:
394 "Unhandled case in FromProtoEnum<types::ZoneHatchBorderMode>" );
395 }
396}
397
398
399template<>
400types::PlacementRuleSourceType ToProtoEnum( PLACEMENT_SOURCE_T aValue )
401{
402 switch( aValue )
403 {
405 return types::PlacementRuleSourceType::PRST_SHEET_NAME;
406
408 return types::PlacementRuleSourceType::PRST_COMPONENT_CLASS;
409
411 return types::PlacementRuleSourceType::PRST_GROUP;
412
414 return types::PlacementRuleSourceType::PRST_DESIGN_BLOCK;
415
416 default:
417 wxCHECK_MSG( false, types::PlacementRuleSourceType::PRST_UNKNOWN,
418 "Unhandled case in ToProtoEnum<PLACEMENT_SOURCE_T>");
419 }
420}
421
422
423template<>
424PLACEMENT_SOURCE_T FromProtoEnum( types::PlacementRuleSourceType aValue )
425{
426 switch( aValue )
427 {
428 case types::PlacementRuleSourceType::PRST_UNKNOWN:
429 case types::PlacementRuleSourceType::PRST_SHEET_NAME:
431
432 case types::PlacementRuleSourceType::PRST_COMPONENT_CLASS:
434
435 case types::PlacementRuleSourceType::PRST_GROUP:
437
438 case types::PlacementRuleSourceType::PRST_DESIGN_BLOCK:
440
441 default:
442 wxCHECK_MSG( false, PLACEMENT_SOURCE_T::SHEETNAME,
443 "Unhandled case in FromProtoEnum<types::PlacementRuleSourceType>" );
444 }
445}
446
447
448template<>
449types::TeardropType ToProtoEnum( TEARDROP_TYPE aValue )
450{
451 switch( aValue )
452 {
453 case TEARDROP_TYPE::TD_NONE: return types::TeardropType::TDT_NONE;
454 case TEARDROP_TYPE::TD_UNSPECIFIED: return types::TeardropType::TDT_UNSPECIFIED;
455 case TEARDROP_TYPE::TD_VIAPAD: return types::TeardropType::TDT_VIA_PAD;
456 case TEARDROP_TYPE::TD_TRACKEND: return types::TeardropType::TDT_TRACK_END;
457
458 default:
459 wxCHECK_MSG( false, types::TeardropType::TDT_UNKNOWN,
460 "Unhandled case in ToProtoEnum<TEARDROP_TYPE>");
461 }
462}
463
464
465template<>
466TEARDROP_TYPE FromProtoEnum( types::TeardropType aValue )
467{
468 switch( aValue )
469 {
470 case types::TeardropType::TDT_UNKNOWN:
471 case types::TeardropType::TDT_NONE: return TEARDROP_TYPE::TD_NONE;
472 case types::TeardropType::TDT_UNSPECIFIED: return TEARDROP_TYPE::TD_UNSPECIFIED;
473 case types::TeardropType::TDT_VIA_PAD: return TEARDROP_TYPE::TD_VIAPAD;
474 case types::TeardropType::TDT_TRACK_END: return TEARDROP_TYPE::TD_TRACKEND;
475
476 default:
477 wxCHECK_MSG( false, TEARDROP_TYPE::TD_NONE,
478 "Unhandled case in FromProtoEnum<types::ZoneHatchBorderMode>" );
479 }
480}
481
482
483template<>
484types::DimensionTextBorderStyle ToProtoEnum( DIM_TEXT_BORDER aValue )
485{
486 switch( aValue )
487 {
488 case DIM_TEXT_BORDER::NONE: return types::DimensionTextBorderStyle::DTBS_NONE;
489 case DIM_TEXT_BORDER::RECTANGLE: return types::DimensionTextBorderStyle::DTBS_RECTANGLE;
490 case DIM_TEXT_BORDER::CIRCLE: return types::DimensionTextBorderStyle::DTBS_CIRCLE;
491 case DIM_TEXT_BORDER::ROUNDRECT: return types::DimensionTextBorderStyle::DTBS_ROUNDRECT;
492
493 default:
494 wxCHECK_MSG( false, types::DimensionTextBorderStyle::DTBS_UNKNOWN,
495 "Unhandled case in ToProtoEnum<DIM_TEXT_BORDER>");
496 }
497}
498
499
500template<>
501DIM_TEXT_BORDER FromProtoEnum( types::DimensionTextBorderStyle aValue )
502{
503 switch( aValue )
504 {
505 case types::DimensionTextBorderStyle::DTBS_UNKNOWN:
506 case types::DimensionTextBorderStyle::DTBS_NONE: return DIM_TEXT_BORDER::NONE;
507 case types::DimensionTextBorderStyle::DTBS_RECTANGLE: return DIM_TEXT_BORDER::RECTANGLE;
508 case types::DimensionTextBorderStyle::DTBS_CIRCLE: return DIM_TEXT_BORDER::CIRCLE;
509 case types::DimensionTextBorderStyle::DTBS_ROUNDRECT: return DIM_TEXT_BORDER::ROUNDRECT;
510
511 default:
512 wxCHECK_MSG( false, DIM_TEXT_BORDER::NONE,
513 "Unhandled case in FromProtoEnum<types::DimensionTextBorderStyle>" );
514 }
515}
516
517
518template<>
519types::DimensionUnitFormat ToProtoEnum( DIM_UNITS_FORMAT aValue )
520{
521 switch( aValue )
522 {
523 case DIM_UNITS_FORMAT::NO_SUFFIX: return types::DimensionUnitFormat::DUF_NO_SUFFIX;
524 case DIM_UNITS_FORMAT::BARE_SUFFIX: return types::DimensionUnitFormat::DUF_BARE_SUFFIX;
525 case DIM_UNITS_FORMAT::PAREN_SUFFIX: return types::DimensionUnitFormat::DUF_PAREN_SUFFIX;
526
527 default:
528 wxCHECK_MSG( false, types::DimensionUnitFormat::DUF_UNKNOWN,
529 "Unhandled case in ToProtoEnum<DIM_UNITS_FORMAT>");
530 }
531}
532
533
534template<>
535DIM_UNITS_FORMAT FromProtoEnum( types::DimensionUnitFormat aValue )
536{
537 switch( aValue )
538 {
539 case types::DimensionUnitFormat::DUF_UNKNOWN:
540 case types::DimensionUnitFormat::DUF_NO_SUFFIX: return DIM_UNITS_FORMAT::NO_SUFFIX;
541 case types::DimensionUnitFormat::DUF_BARE_SUFFIX: return DIM_UNITS_FORMAT::BARE_SUFFIX;
542 case types::DimensionUnitFormat::DUF_PAREN_SUFFIX: return DIM_UNITS_FORMAT::PAREN_SUFFIX;
543
544 default:
545 wxCHECK_MSG( false, DIM_UNITS_FORMAT::NO_SUFFIX,
546 "Unhandled case in FromProtoEnum<types::DimensionUnitFormat>" );
547 }
548}
549
550
551template<>
552types::DimensionArrowDirection ToProtoEnum( DIM_ARROW_DIRECTION aValue )
553{
554 switch( aValue )
555 {
556 case DIM_ARROW_DIRECTION::INWARD: return types::DimensionArrowDirection::DAD_INWARD;
557 case DIM_ARROW_DIRECTION::OUTWARD: return types::DimensionArrowDirection::DAD_OUTWARD;
558
559 default:
560 wxCHECK_MSG( false, types::DimensionArrowDirection::DAD_UNKNOWN,
561 "Unhandled case in ToProtoEnum<DIM_ARROW_DIRECTION>");
562 }
563}
564
565
566template<>
567DIM_ARROW_DIRECTION FromProtoEnum( types::DimensionArrowDirection aValue )
568{
569 switch( aValue )
570 {
571 case types::DimensionArrowDirection::DAD_INWARD: return DIM_ARROW_DIRECTION::INWARD;
572 case types::DimensionArrowDirection::DAD_UNKNOWN:
573 case types::DimensionArrowDirection::DAD_OUTWARD: return DIM_ARROW_DIRECTION::OUTWARD;
574
575 default:
576 wxCHECK_MSG( false, DIM_ARROW_DIRECTION::OUTWARD,
577 "Unhandled case in FromProtoEnum<types::DimensionArrowDirection>" );
578 }
579}
580
581
582template<>
583types::DimensionPrecision ToProtoEnum( DIM_PRECISION aValue )
584{
585 switch( aValue )
586 {
587 case DIM_PRECISION::X: return types::DimensionPrecision::DP_FIXED_0;
588 case DIM_PRECISION::X_X: return types::DimensionPrecision::DP_FIXED_1;
589 case DIM_PRECISION::X_XX: return types::DimensionPrecision::DP_FIXED_2;
590 case DIM_PRECISION::X_XXX: return types::DimensionPrecision::DP_FIXED_3;
591 case DIM_PRECISION::X_XXXX: return types::DimensionPrecision::DP_FIXED_4;
592 case DIM_PRECISION::X_XXXXX: return types::DimensionPrecision::DP_FIXED_5;
593 case DIM_PRECISION::V_VV: return types::DimensionPrecision::DP_SCALED_IN_2;
594 case DIM_PRECISION::V_VVV: return types::DimensionPrecision::DP_SCALED_IN_3;
595 case DIM_PRECISION::V_VVVV: return types::DimensionPrecision::DP_SCALED_IN_4;
596 case DIM_PRECISION::V_VVVVV: return types::DimensionPrecision::DP_SCALED_IN_5;
597
598 default:
599 wxCHECK_MSG( false, types::DimensionPrecision::DP_UNKNOWN,
600 "Unhandled case in ToProtoEnum<DIM_PRECISION>");
601 }
602}
603
604
605template<>
606DIM_PRECISION FromProtoEnum( types::DimensionPrecision aValue )
607{
608 switch( aValue )
609 {
610 case types::DimensionPrecision::DP_FIXED_0: return DIM_PRECISION::X;
611 case types::DimensionPrecision::DP_FIXED_1: return DIM_PRECISION::X_X;
612 case types::DimensionPrecision::DP_FIXED_2: return DIM_PRECISION::X_XX;
613 case types::DimensionPrecision::DP_FIXED_3: return DIM_PRECISION::X_XXX;
614 case types::DimensionPrecision::DP_FIXED_4: return DIM_PRECISION::X_XXXX;
615 case types::DimensionPrecision::DP_FIXED_5: return DIM_PRECISION::X_XXXXX;
616 case types::DimensionPrecision::DP_UNKNOWN:
617 case types::DimensionPrecision::DP_SCALED_IN_2: return DIM_PRECISION::V_VV;
618 case types::DimensionPrecision::DP_SCALED_IN_3: return DIM_PRECISION::V_VVV;
619 case types::DimensionPrecision::DP_SCALED_IN_4: return DIM_PRECISION::V_VVVV;
620 case types::DimensionPrecision::DP_SCALED_IN_5: return DIM_PRECISION::V_VVVVV;
621
622 default:
623 wxCHECK_MSG( false, DIM_PRECISION::V_VV,
624 "Unhandled case in FromProtoEnum<types::DimensionPrecision>" );
625 }
626}
627
628
629template<>
630types::DimensionTextPosition ToProtoEnum( DIM_TEXT_POSITION aValue )
631{
632 switch( aValue )
633 {
634 case DIM_TEXT_POSITION::OUTSIDE: return types::DimensionTextPosition::DTP_OUTSIDE;
635 case DIM_TEXT_POSITION::INLINE: return types::DimensionTextPosition::DTP_INLINE;
636 case DIM_TEXT_POSITION::MANUAL: return types::DimensionTextPosition::DTP_MANUAL;
637
638 default:
639 wxCHECK_MSG( false, types::DimensionTextPosition::DTP_UNKNOWN,
640 "Unhandled case in ToProtoEnum<DIM_TEXT_POSITION>");
641 }
642}
643
644
645template<>
646DIM_TEXT_POSITION FromProtoEnum( types::DimensionTextPosition aValue )
647{
648 switch( aValue )
649 {
650 case types::DimensionTextPosition::DTP_UNKNOWN:
651 case types::DimensionTextPosition::DTP_OUTSIDE: return DIM_TEXT_POSITION::OUTSIDE;
652 case types::DimensionTextPosition::DTP_INLINE: return DIM_TEXT_POSITION::INLINE;
653 case types::DimensionTextPosition::DTP_MANUAL: return DIM_TEXT_POSITION::MANUAL;
654
655 default:
656 wxCHECK_MSG( false, DIM_TEXT_POSITION::OUTSIDE,
657 "Unhandled case in FromProtoEnum<types::DimensionTextPosition>" );
658 }
659}
660
661
662template<>
663types::DimensionUnit ToProtoEnum( DIM_UNITS_MODE aValue )
664{
665 switch( aValue )
666 {
667 case DIM_UNITS_MODE::INCH: return types::DimensionUnit::DU_INCHES;
668 case DIM_UNITS_MODE::MILS: return types::DimensionUnit::DU_MILS;
669 case DIM_UNITS_MODE::MM: return types::DimensionUnit::DU_MILLIMETERS;
670 case DIM_UNITS_MODE::AUTOMATIC: return types::DimensionUnit::DU_AUTOMATIC;
671
672 default:
673 wxCHECK_MSG( false, types::DimensionUnit::DU_UNKNOWN,
674 "Unhandled case in ToProtoEnum<DIM_UNITS_MODE>");
675 }
676}
677
678
679template<>
680DIM_UNITS_MODE FromProtoEnum( types::DimensionUnit aValue )
681{
682 switch( aValue )
683 {
684 case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::INCH;
685 case types::DimensionUnit::DU_MILS: return DIM_UNITS_MODE::MILS;
686 case types::DimensionUnit::DU_MILLIMETERS: return DIM_UNITS_MODE::MM;
687 case types::DimensionUnit::DU_UNKNOWN:
688 case types::DimensionUnit::DU_AUTOMATIC: return DIM_UNITS_MODE::AUTOMATIC;
689
690 default:
691 wxCHECK_MSG( false, DIM_UNITS_MODE::AUTOMATIC,
692 "Unhandled case in FromProtoEnum<types::DimensionUnit>" );
693 }
694}
695
696
697template<>
698commands::InactiveLayerDisplayMode ToProtoEnum( HIGH_CONTRAST_MODE aValue )
699{
700 switch( aValue )
701 {
702 case HIGH_CONTRAST_MODE::NORMAL: return commands::InactiveLayerDisplayMode::ILDM_NORMAL;
703 case HIGH_CONTRAST_MODE::DIMMED: return commands::InactiveLayerDisplayMode::ILDM_DIMMED;
704 case HIGH_CONTRAST_MODE::HIDDEN: return commands::InactiveLayerDisplayMode::ILDM_HIDDEN;
705
706 default:
707 wxCHECK_MSG( false, commands::InactiveLayerDisplayMode::ILDM_NORMAL,
708 "Unhandled case in ToProtoEnum<HIGH_CONTRAST_MODE>");
709 }
710}
711
712
713template<>
714HIGH_CONTRAST_MODE FromProtoEnum( commands::InactiveLayerDisplayMode aValue )
715{
716 switch( aValue )
717 {
718 case commands::InactiveLayerDisplayMode::ILDM_DIMMED: return HIGH_CONTRAST_MODE::DIMMED;
719 case commands::InactiveLayerDisplayMode::ILDM_HIDDEN: return HIGH_CONTRAST_MODE::HIDDEN;
720 case commands::InactiveLayerDisplayMode::ILDM_UNKNOWN:
721 case commands::InactiveLayerDisplayMode::ILDM_NORMAL: return HIGH_CONTRAST_MODE::NORMAL;
722
723 default:
724 wxCHECK_MSG( false, HIGH_CONTRAST_MODE::NORMAL,
725 "Unhandled case in FromProtoEnum<commands::InactiveLayerDisplayMode>" );
726 }
727}
728
729
730template<>
731commands::NetColorDisplayMode ToProtoEnum( NET_COLOR_MODE aValue )
732{
733 switch( aValue )
734 {
735 case NET_COLOR_MODE::ALL: return commands::NetColorDisplayMode::NCDM_ALL;
736 case NET_COLOR_MODE::RATSNEST: return commands::NetColorDisplayMode::NCDM_RATSNEST;
737 case NET_COLOR_MODE::OFF: return commands::NetColorDisplayMode::NCDM_OFF;
738
739 default:
740 wxCHECK_MSG( false, commands::NetColorDisplayMode::NCDM_UNKNOWN,
741 "Unhandled case in ToProtoEnum<NET_COLOR_MODE>");
742 }
743}
744
745
746template<>
747NET_COLOR_MODE FromProtoEnum( commands::NetColorDisplayMode aValue )
748{
749 switch( aValue )
750 {
751 case commands::NetColorDisplayMode::NCDM_ALL: return NET_COLOR_MODE::ALL;
752 case commands::NetColorDisplayMode::NCDM_OFF: return NET_COLOR_MODE::OFF;
753 case commands::NetColorDisplayMode::NCDM_UNKNOWN:
754 case commands::NetColorDisplayMode::NCDM_RATSNEST: return NET_COLOR_MODE::RATSNEST;
755
756 default:
757 wxCHECK_MSG( false, NET_COLOR_MODE::RATSNEST,
758 "Unhandled case in FromProtoEnum<commands::NetColorDisplayMode>" );
759 }
760}
761
762
763template<>
764commands::RatsnestDisplayMode ToProtoEnum( RATSNEST_MODE aValue )
765{
766 switch( aValue )
767 {
768 case RATSNEST_MODE::ALL: return commands::RatsnestDisplayMode::RDM_ALL_LAYERS;
769 case RATSNEST_MODE::VISIBLE: return commands::RatsnestDisplayMode::RDM_VISIBLE_LAYERS;
770
771 default:
772 wxCHECK_MSG( false, commands::RatsnestDisplayMode::RDM_UNKNOWN,
773 "Unhandled case in ToProtoEnum<RATSNEST_MODE>");
774 }
775}
776
777
778template<>
779RATSNEST_MODE FromProtoEnum( commands::RatsnestDisplayMode aValue )
780{
781 switch( aValue )
782 {
783 case commands::RatsnestDisplayMode::RDM_VISIBLE_LAYERS: return RATSNEST_MODE::VISIBLE;
784 case commands::RatsnestDisplayMode::RDM_UNKNOWN:
785 case commands::RatsnestDisplayMode::RDM_ALL_LAYERS: return RATSNEST_MODE::ALL;
786
787 default:
788 wxCHECK_MSG( false, RATSNEST_MODE::ALL,
789 "Unhandled case in FromProtoEnum<commands::RatsnestDisplayMode>" );
790 }
791}
792
793
794template<>
795BoardStackupLayerType ToProtoEnum( BOARD_STACKUP_ITEM_TYPE aValue )
796{
797 switch( aValue )
798 {
799 case BS_ITEM_TYPE_UNDEFINED: return BoardStackupLayerType::BSLT_UNDEFINED;
800 case BS_ITEM_TYPE_COPPER: return BoardStackupLayerType::BSLT_COPPER;
801 case BS_ITEM_TYPE_DIELECTRIC: return BoardStackupLayerType::BSLT_DIELECTRIC;
802 case BS_ITEM_TYPE_SOLDERPASTE: return BoardStackupLayerType::BSLT_SOLDERPASTE;
803 case BS_ITEM_TYPE_SOLDERMASK: return BoardStackupLayerType::BSLT_SOLDERMASK;
804 case BS_ITEM_TYPE_SILKSCREEN: return BoardStackupLayerType::BSLT_SILKSCREEN;
805
806 default:
807 wxCHECK_MSG( false, BoardStackupLayerType::BSLT_UNKNOWN,
808 "Unhandled case in ToProtoEnum<BOARD_STACKUP_ITEM_TYPE>");
809 }
810}
811
812
813template<>
814BOARD_STACKUP_ITEM_TYPE FromProtoEnum( BoardStackupLayerType aValue )
815{
816 switch( aValue )
817 {
818 case BoardStackupLayerType::BSLT_UNDEFINED: return BS_ITEM_TYPE_UNDEFINED;
819 case BoardStackupLayerType::BSLT_COPPER: return BS_ITEM_TYPE_COPPER;
820 case BoardStackupLayerType::BSLT_DIELECTRIC: return BS_ITEM_TYPE_DIELECTRIC;
821 case BoardStackupLayerType::BSLT_SOLDERPASTE: return BS_ITEM_TYPE_SOLDERPASTE;
822 case BoardStackupLayerType::BSLT_SOLDERMASK: return BS_ITEM_TYPE_SOLDERMASK;
823 case BoardStackupLayerType::BSLT_SILKSCREEN: return BS_ITEM_TYPE_SILKSCREEN;
824
825 default:
826 wxCHECK_MSG( false, BS_ITEM_TYPE_UNDEFINED,
827 "Unhandled case in FromProtoEnum<BoardStackupLayerType>" );
828 }
829}
830
831
832template<>
833DrcSeverity ToProtoEnum( SEVERITY aValue )
834{
835 switch( aValue )
836 {
837 case RPT_SEVERITY_WARNING: return DrcSeverity::DRS_WARNING;
838 case RPT_SEVERITY_ERROR: return DrcSeverity::DRS_ERROR;
839 case RPT_SEVERITY_EXCLUSION: return DrcSeverity::DRS_EXCLUSION;
840 case RPT_SEVERITY_IGNORE: return DrcSeverity::DRS_IGNORE;
841 case RPT_SEVERITY_INFO: return DrcSeverity::DRS_INFO;
842 case RPT_SEVERITY_ACTION: return DrcSeverity::DRS_ACTION;
843 case RPT_SEVERITY_DEBUG: return DrcSeverity::DRS_DEBUG;
844 case RPT_SEVERITY_UNDEFINED: return DrcSeverity::DRS_UNDEFINED;
845 default:
846 wxCHECK_MSG( false, DrcSeverity::DRS_UNDEFINED,
847 "Unhandled case in ToProtoEnum<SEVERITY>");
848 }
849}
850
851
852template<>
853SEVERITY FromProtoEnum( DrcSeverity aValue )
854{
855 switch( aValue )
856 {
857 case DrcSeverity::DRS_WARNING: return RPT_SEVERITY_WARNING;
858 case DrcSeverity::DRS_ERROR: return RPT_SEVERITY_ERROR;
859 case DrcSeverity::DRS_EXCLUSION: return RPT_SEVERITY_EXCLUSION;
860 case DrcSeverity::DRS_IGNORE: return RPT_SEVERITY_IGNORE;
861 case DrcSeverity::DRS_INFO: return RPT_SEVERITY_INFO;
862 case DrcSeverity::DRS_ACTION: return RPT_SEVERITY_ACTION;
863 case DrcSeverity::DRS_DEBUG: return RPT_SEVERITY_DEBUG;
864 case DrcSeverity::DRS_UNKNOWN:
865 default:
867 }
868}
869
870// Adding something new here? Add it to test_api_enums.cpp!
types::PadType ToProtoEnum(PAD_ATTRIB aValue)
PAD_ATTRIB FromProtoEnum(types::PadType aValue)
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
@ ALL
Ratsnest lines are drawn to items on all layers (default)
BOARD_STACKUP_ITEM_TYPE
@ BS_ITEM_TYPE_UNDEFINED
@ BS_ITEM_TYPE_COPPER
@ BS_ITEM_TYPE_SILKSCREEN
@ BS_ITEM_TYPE_DIELECTRIC
@ BS_ITEM_TYPE_SOLDERPASTE
@ BS_ITEM_TYPE_SOLDERMASK
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
Definition padstack.h:138
@ NORMAL
Shape is the same on all layers.
Definition padstack.h:139
@ CUSTOM
Shapes can be defined on arbitrary layers.
Definition padstack.h:141
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
Definition padstack.h:140
UNCONNECTED_LAYER_MODE
! Whether or not to remove the copper shape for unconnected layers
Definition padstack.h:152
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition padstack.h:69
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition padstack.h:81
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition padstack.h:87
@ SMD
Smd pad, appears on the solder paste layer (default)
Definition padstack.h:83
@ PTH
Plated through hole pad.
Definition padstack.h:82
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
Definition padstack.h:84
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition padstack.h:52
@ CHAMFERED_RECT
Definition padstack.h:60
@ ROUNDRECT
Definition padstack.h:57
@ TRAPEZOID
Definition padstack.h:56
@ RECTANGLE
Definition padstack.h:54
DIM_TEXT_POSITION
Where to place the text on a dimension.
@ OUTSIDE
Text appears outside the dimension line (default)
@ MANUAL
Text placement is manually set by the user.
@ INLINE
Text appears in line with the dimension line.
DIM_UNITS_FORMAT
How to display the units in a dimension's text.
DIM_UNITS_MODE
Used for storing the units selection in the file because EDA_UNITS alone doesn't cut it.
DIM_ARROW_DIRECTION
Used for dimension's arrow.
DIM_TEXT_BORDER
Frame to show around dimension text.
DIM_PRECISION
VIATYPE
Definition pcb_track.h:67
@ THROUGH
Definition pcb_track.h:68
@ MICROVIA
Definition pcb_track.h:71
SEVERITY
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_UNDEFINED
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_IGNORE
@ RPT_SEVERITY_DEBUG
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
TEARDROP_TYPE
define the type of a teardrop: on a via or pad, or a track end
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
ZONE_FILL_MODE
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
PLACEMENT_SOURCE_T
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition zones.h:47
@ THERMAL
Use thermal relief for pads.
Definition zones.h:50
@ THT_THERMAL
Thermal relief only for THT pads.
Definition zones.h:52
@ NONE
Pads are not covered.
Definition zones.h:49
@ FULL
pads are covered by copper
Definition zones.h:51