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>
26
27#include <padstack.h>
28#include <pcb_dimension.h>
29#include <pcb_track.h>
30#include <zones.h>
31#include <zone_settings.h>
33
34// Adding something new here? Add it to test_api_enums.cpp!
35
36using namespace kiapi::board;
37
38template<>
39types::PadType ToProtoEnum( PAD_ATTRIB aValue )
40{
41 switch( aValue )
42 {
43 case PAD_ATTRIB::PTH: return types::PadType::PT_PTH;
44 case PAD_ATTRIB::SMD: return types::PadType::PT_SMD;
45 case PAD_ATTRIB::CONN: return types::PadType::PT_EDGE_CONNECTOR;
46 case PAD_ATTRIB::NPTH: return types::PadType::PT_NPTH;
47
48 default:
49 wxCHECK_MSG( false, types::PadType::PT_UNKNOWN,
50 "Unhandled case in ToProtoEnum<PAD_ATTRIB>");
51 }
52}
53
54
55template<>
56PAD_ATTRIB FromProtoEnum( types::PadType aValue )
57{
58 switch( aValue )
59 {
60 case types::PadType::PT_UNKNOWN:
61 case types::PadType::PT_PTH: return PAD_ATTRIB::PTH;
62 case types::PadType::PT_SMD: return PAD_ATTRIB::SMD;
63 case types::PadType::PT_EDGE_CONNECTOR: return PAD_ATTRIB::CONN;
64 case types::PadType::PT_NPTH: return PAD_ATTRIB::NPTH;
65
66 default:
67 wxCHECK_MSG( false, PAD_ATTRIB::PTH,
68 "Unhandled case in FromProtoEnum<types::PadType>" );
69 }
70}
71
72template<>
73types::DrillShape ToProtoEnum( PAD_DRILL_SHAPE aValue )
74{
75 switch( aValue )
76 {
77 case PAD_DRILL_SHAPE::CIRCLE: return types::DrillShape::DS_CIRCLE;
78 case PAD_DRILL_SHAPE::OBLONG: return types::DrillShape::DS_OBLONG;
79 case PAD_DRILL_SHAPE::UNDEFINED: return types::DrillShape::DS_UNDEFINED;
80 default:
81 wxCHECK_MSG( false, types::DrillShape::DS_UNKNOWN,
82 "Unhandled case in ToProtoEnum<PAD_DRILL_SHAPE>");
83 }
84}
85
86template<>
87PAD_DRILL_SHAPE FromProtoEnum( types::DrillShape aValue )
88{
89 switch( aValue )
90 {
91 case types::DrillShape::DS_CIRCLE: return PAD_DRILL_SHAPE::CIRCLE;
92 case types::DrillShape::DS_OBLONG: return PAD_DRILL_SHAPE::OBLONG;
93 case types::DrillShape::DS_UNKNOWN:
94 case types::DrillShape::DS_UNDEFINED: return PAD_DRILL_SHAPE::UNDEFINED;
95 default:
96 wxCHECK_MSG( false, PAD_DRILL_SHAPE::UNDEFINED,
97 "Unhandled case in FromProtoEnum<types::DrillShape>" );
98 }
99}
100
101template<>
102types::PadStackShape ToProtoEnum( PAD_SHAPE aValue )
103{
104 switch( aValue )
105 {
106 case PAD_SHAPE::CIRCLE: return types::PadStackShape::PSS_CIRCLE;
107 case PAD_SHAPE::RECTANGLE: return types::PadStackShape::PSS_RECTANGLE;
108 case PAD_SHAPE::OVAL: return types::PadStackShape::PSS_OVAL;
109 case PAD_SHAPE::TRAPEZOID: return types::PadStackShape::PSS_TRAPEZOID;
110 case PAD_SHAPE::ROUNDRECT: return types::PadStackShape::PSS_ROUNDRECT;
111 case PAD_SHAPE::CHAMFERED_RECT: return types::PadStackShape::PSS_CHAMFEREDRECT;
112 case PAD_SHAPE::CUSTOM: return types::PadStackShape::PSS_CUSTOM;
113
114 default:
115 wxCHECK_MSG( false, types::PadStackShape::PSS_UNKNOWN,
116 "Unhandled case in ToProtoEnum<PAD_SHAPE>");
117 }
118}
119
120
121template<>
122PAD_SHAPE FromProtoEnum( types::PadStackShape aValue )
123{
124 switch( aValue )
125 {
126 case types::PadStackShape::PSS_UNKNOWN:
127 case types::PadStackShape::PSS_CIRCLE: return PAD_SHAPE::CIRCLE;
128 case types::PadStackShape::PSS_RECTANGLE: return PAD_SHAPE::RECTANGLE;
129 case types::PadStackShape::PSS_OVAL: return PAD_SHAPE::OVAL;
130 case types::PadStackShape::PSS_TRAPEZOID: return PAD_SHAPE::TRAPEZOID;
131 case types::PadStackShape::PSS_ROUNDRECT: return PAD_SHAPE::ROUNDRECT;
132 case types::PadStackShape::PSS_CHAMFEREDRECT: return PAD_SHAPE::CHAMFERED_RECT;
133 case types::PadStackShape::PSS_CUSTOM: return PAD_SHAPE::CUSTOM;
134
135 default:
136 wxCHECK_MSG( false, PAD_SHAPE::CIRCLE,
137 "Unhandled case in FromProtoEnum<types::PadStackShape>" );
138 }
139}
140
141
142template<>
143types::PadStackType ToProtoEnum( PADSTACK::MODE aValue )
144{
145 switch( aValue )
146 {
147 case PADSTACK::MODE::NORMAL: return types::PadStackType::PST_NORMAL;
148 case PADSTACK::MODE::FRONT_INNER_BACK: return types::PadStackType::PST_FRONT_INNER_BACK;
149 case PADSTACK::MODE::CUSTOM: return types::PadStackType::PST_CUSTOM;
150
151 default:
152 wxCHECK_MSG( false, types::PadStackType::PST_UNKNOWN,
153 "Unhandled case in ToProtoEnum<PADSTACK::MODE>");
154 }
155}
156
157
158template<>
159PADSTACK::MODE FromProtoEnum( types::PadStackType aValue )
160{
161 switch( aValue )
162 {
163 case types::PadStackType::PST_UNKNOWN:
164 case types::PadStackType::PST_NORMAL: return PADSTACK::MODE::NORMAL;
165 case types::PadStackType::PST_FRONT_INNER_BACK: return PADSTACK::MODE::FRONT_INNER_BACK;
166 case types::PadStackType::PST_CUSTOM: return PADSTACK::MODE::CUSTOM;
167
168 default:
169 wxCHECK_MSG( false, PADSTACK::MODE::NORMAL,
170 "Unhandled case in FromProtoEnum<types::PadStackType>" );
171 }
172}
173
174
175template<>
176types::ViaType ToProtoEnum( VIATYPE aValue )
177{
178 switch( aValue )
179 {
180 case VIATYPE::THROUGH: return types::ViaType::VT_THROUGH;
181 case VIATYPE::BLIND_BURIED: return types::ViaType::VT_BLIND_BURIED;
182 case VIATYPE::MICROVIA: return types::ViaType::VT_MICRO;
183
184 default:
185 wxCHECK_MSG( false, types::ViaType::VT_UNKNOWN,
186 "Unhandled case in ToProtoEnum<VIATYPE>");
187 }
188}
189
190
191template<>
192VIATYPE FromProtoEnum( types::ViaType aValue )
193{
194 switch( aValue )
195 {
196 case types::ViaType::VT_UNKNOWN:
197 case types::ViaType::VT_THROUGH: return VIATYPE::THROUGH;
198 case types::ViaType::VT_BLIND_BURIED: return VIATYPE::BLIND_BURIED;
199 case types::ViaType::VT_MICRO: return VIATYPE::MICROVIA;
200
201 default:
202 wxCHECK_MSG( false, VIATYPE::THROUGH,
203 "Unhandled case in FromProtoEnum<types::ViaType>" );
204 }
205}
206
207
208template<>
209types::ZoneConnectionStyle ToProtoEnum( ZONE_CONNECTION aValue )
210{
211 switch( aValue )
212 {
213 case ZONE_CONNECTION::INHERITED: return types::ZoneConnectionStyle::ZCS_INHERITED;
214 case ZONE_CONNECTION::NONE: return types::ZoneConnectionStyle::ZCS_NONE;
215 case ZONE_CONNECTION::THERMAL: return types::ZoneConnectionStyle::ZCS_THERMAL;
216 case ZONE_CONNECTION::FULL: return types::ZoneConnectionStyle::ZCS_FULL;
217 case ZONE_CONNECTION::THT_THERMAL: return types::ZoneConnectionStyle::ZCS_PTH_THERMAL;
218
219 default:
220 wxCHECK_MSG( false, types::ZoneConnectionStyle::ZCS_UNKNOWN,
221 "Unhandled case in ToProtoEnum<ZONE_CONNECTION>");
222 }
223}
224
225
226template<>
227ZONE_CONNECTION FromProtoEnum( types::ZoneConnectionStyle aValue )
228{
229 switch( aValue )
230 {
231 case types::ZoneConnectionStyle::ZCS_UNKNOWN: return ZONE_CONNECTION::INHERITED;
232 case types::ZoneConnectionStyle::ZCS_INHERITED: return ZONE_CONNECTION::INHERITED;
233 case types::ZoneConnectionStyle::ZCS_NONE: return ZONE_CONNECTION::NONE;
234 case types::ZoneConnectionStyle::ZCS_THERMAL: return ZONE_CONNECTION::THERMAL;
235 case types::ZoneConnectionStyle::ZCS_FULL: return ZONE_CONNECTION::FULL;
236 case types::ZoneConnectionStyle::ZCS_PTH_THERMAL: return ZONE_CONNECTION::THT_THERMAL;
237
238 default:
239 wxCHECK_MSG( false, ZONE_CONNECTION::INHERITED,
240 "Unhandled case in FromProtoEnum<types::ZoneConnectionStyle>" );
241 }
242}
243
244
245template<>
246types::UnconnectedLayerRemoval ToProtoEnum( PADSTACK::UNCONNECTED_LAYER_MODE aValue )
247{
248 switch( aValue )
249 {
251 return types::UnconnectedLayerRemoval::ULR_KEEP;
252
254 return types::UnconnectedLayerRemoval::ULR_REMOVE;
255
257 return types::UnconnectedLayerRemoval::ULR_REMOVE_EXCEPT_START_AND_END;
258
259 default:
260 wxCHECK_MSG( false, types::UnconnectedLayerRemoval::ULR_UNKNOWN,
261 "Unhandled case in ToProtoEnum<PADSTACK::UNCONNECTED_LAYER_MODE>");
262 }
263}
264
265
266template<>
267PADSTACK::UNCONNECTED_LAYER_MODE FromProtoEnum( types::UnconnectedLayerRemoval aValue )
268{
269 switch( aValue )
270 {
271 case types::UnconnectedLayerRemoval::ULR_UNKNOWN:
272 case types::UnconnectedLayerRemoval::ULR_KEEP:
274
275 case types::UnconnectedLayerRemoval::ULR_REMOVE:
277
278 case types::UnconnectedLayerRemoval::ULR_REMOVE_EXCEPT_START_AND_END:
280
281 default:
283 "Unhandled case in FromProtoEnum<types::UnconnectedLayerRemoval>");
284 }
285}
286
287
288template<>
289types::IslandRemovalMode ToProtoEnum( ISLAND_REMOVAL_MODE aValue )
290{
291 switch( aValue )
292 {
293 case ISLAND_REMOVAL_MODE::ALWAYS: return types::IslandRemovalMode::IRM_ALWAYS;
294 case ISLAND_REMOVAL_MODE::NEVER: return types::IslandRemovalMode::IRM_NEVER;
295 case ISLAND_REMOVAL_MODE::AREA: return types::IslandRemovalMode::IRM_AREA;
296
297 default:
298 wxCHECK_MSG( false, types::IslandRemovalMode::IRM_UNKNOWN,
299 "Unhandled case in ToProtoEnum<ISLAND_REMOVAL_MODE>");
300 }
301}
302
303
304template<>
305ISLAND_REMOVAL_MODE FromProtoEnum( types::IslandRemovalMode aValue )
306{
307 switch( aValue )
308 {
309 case types::IslandRemovalMode::IRM_UNKNOWN:
310 case types::IslandRemovalMode::IRM_ALWAYS: return ISLAND_REMOVAL_MODE::ALWAYS;
311 case types::IslandRemovalMode::IRM_NEVER: return ISLAND_REMOVAL_MODE::NEVER;
312 case types::IslandRemovalMode::IRM_AREA: return ISLAND_REMOVAL_MODE::AREA;
313
314 default:
315 wxCHECK_MSG( false, ISLAND_REMOVAL_MODE::ALWAYS,
316 "Unhandled case in FromProtoEnum<types::IslandRemovalMode>" );
317 }
318}
319
320
321template<>
322types::ZoneFillMode ToProtoEnum( ZONE_FILL_MODE aValue )
323{
324 switch( aValue )
325 {
326 case ZONE_FILL_MODE::POLYGONS: return types::ZoneFillMode::ZFM_SOLID;
327 case ZONE_FILL_MODE::HATCH_PATTERN: return types::ZoneFillMode::ZFM_HATCHED;
328
329 default:
330 wxCHECK_MSG( false, types::ZoneFillMode::ZFM_UNKNOWN,
331 "Unhandled case in ToProtoEnum<ZONE_FILL_MODE>");
332 }
333}
334
335
336template<>
337ZONE_FILL_MODE FromProtoEnum( types::ZoneFillMode aValue )
338{
339 switch( aValue )
340 {
341 case types::ZoneFillMode::ZFM_UNKNOWN:
342 case types::ZoneFillMode::ZFM_SOLID: return ZONE_FILL_MODE::POLYGONS;
343 case types::ZoneFillMode::ZFM_HATCHED: return ZONE_FILL_MODE::HATCH_PATTERN;
344
345 default:
346 wxCHECK_MSG( false, ZONE_FILL_MODE::POLYGONS,
347 "Unhandled case in FromProtoEnum<types::ZoneFillMode>" );
348 }
349}
350
351
352template<>
353types::ZoneBorderStyle ToProtoEnum( ZONE_BORDER_DISPLAY_STYLE aValue )
354{
355 switch( aValue )
356 {
357 case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: return types::ZoneBorderStyle::ZBS_SOLID;
358 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: return types::ZoneBorderStyle::ZBS_DIAGONAL_FULL;
359 case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: return types::ZoneBorderStyle::ZBS_DIAGONAL_EDGE;
360 case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER: return types::ZoneBorderStyle::ZBS_INVISIBLE;
361
362 default:
363 wxCHECK_MSG( false, types::ZoneBorderStyle::ZBS_UNKNOWN,
364 "Unhandled case in ToProtoEnum<ZONE_BORDER_DISPLAY_STYLE>");
365 }
366}
367
368
369template<>
370ZONE_BORDER_DISPLAY_STYLE FromProtoEnum( types::ZoneBorderStyle aValue )
371{
372 switch( aValue )
373 {
374 case types::ZoneBorderStyle::ZBS_SOLID: return ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
375 case types::ZoneBorderStyle::ZBS_DIAGONAL_FULL: return ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL;
376 case types::ZoneBorderStyle::ZBS_UNKNOWN:
377 case types::ZoneBorderStyle::ZBS_DIAGONAL_EDGE: return ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
378 case types::ZoneBorderStyle::ZBS_INVISIBLE: return ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER;
379
380 default:
382 "Unhandled case in FromProtoEnum<types::ZoneHatchBorderMode>" );
383 }
384}
385
386
387template<>
388types::PlacementRuleSourceType ToProtoEnum( RULE_AREA_PLACEMENT_SOURCE_TYPE aValue )
389{
390 switch( aValue )
391 {
393 return types::PlacementRuleSourceType::PRST_SHEET_NAME;
394
396 return types::PlacementRuleSourceType::PRST_COMPONENT_CLASS;
397
398 default:
399 wxCHECK_MSG( false, types::PlacementRuleSourceType::PRST_UNKNOWN,
400 "Unhandled case in ToProtoEnum<RULE_AREA_PLACEMENT_SOURCE_TYPE>");
401 }
402}
403
404
405template<>
406RULE_AREA_PLACEMENT_SOURCE_TYPE FromProtoEnum( types::PlacementRuleSourceType aValue )
407{
408 switch( aValue )
409 {
410 case types::PlacementRuleSourceType::PRST_UNKNOWN:
411 case types::PlacementRuleSourceType::PRST_SHEET_NAME:
413
414 case types::PlacementRuleSourceType::PRST_COMPONENT_CLASS:
416
417 default:
419 "Unhandled case in FromProtoEnum<types::PlacementRuleSourceType>" );
420 }
421}
422
423
424template<>
425types::TeardropType ToProtoEnum( TEARDROP_TYPE aValue )
426{
427 switch( aValue )
428 {
429 case TEARDROP_TYPE::TD_NONE: return types::TeardropType::TDT_NONE;
430 case TEARDROP_TYPE::TD_UNSPECIFIED: return types::TeardropType::TDT_UNSPECIFIED;
431 case TEARDROP_TYPE::TD_VIAPAD: return types::TeardropType::TDT_VIA_PAD;
432 case TEARDROP_TYPE::TD_TRACKEND: return types::TeardropType::TDT_TRACK_END;
433
434 default:
435 wxCHECK_MSG( false, types::TeardropType::TDT_UNKNOWN,
436 "Unhandled case in ToProtoEnum<TEARDROP_TYPE>");
437 }
438}
439
440
441template<>
442TEARDROP_TYPE FromProtoEnum( types::TeardropType aValue )
443{
444 switch( aValue )
445 {
446 case types::TeardropType::TDT_UNKNOWN:
447 case types::TeardropType::TDT_NONE: return TEARDROP_TYPE::TD_NONE;
448 case types::TeardropType::TDT_UNSPECIFIED: return TEARDROP_TYPE::TD_UNSPECIFIED;
449 case types::TeardropType::TDT_VIA_PAD: return TEARDROP_TYPE::TD_VIAPAD;
450 case types::TeardropType::TDT_TRACK_END: return TEARDROP_TYPE::TD_TRACKEND;
451
452 default:
453 wxCHECK_MSG( false, TEARDROP_TYPE::TD_NONE,
454 "Unhandled case in FromProtoEnum<types::ZoneHatchBorderMode>" );
455 }
456}
457
458
459template<>
460types::DimensionTextBorderStyle ToProtoEnum( DIM_TEXT_BORDER aValue )
461{
462 switch( aValue )
463 {
464 case DIM_TEXT_BORDER::NONE: return types::DimensionTextBorderStyle::DTBS_NONE;
465 case DIM_TEXT_BORDER::RECTANGLE: return types::DimensionTextBorderStyle::DTBS_RECTANGLE;
466 case DIM_TEXT_BORDER::CIRCLE: return types::DimensionTextBorderStyle::DTBS_CIRCLE;
467 case DIM_TEXT_BORDER::ROUNDRECT: return types::DimensionTextBorderStyle::DTBS_ROUNDRECT;
468
469 default:
470 wxCHECK_MSG( false, types::DimensionTextBorderStyle::DTBS_UNKNOWN,
471 "Unhandled case in ToProtoEnum<DIM_TEXT_BORDER>");
472 }
473}
474
475
476template<>
477DIM_TEXT_BORDER FromProtoEnum( types::DimensionTextBorderStyle aValue )
478{
479 switch( aValue )
480 {
481 case types::DimensionTextBorderStyle::DTBS_UNKNOWN:
482 case types::DimensionTextBorderStyle::DTBS_NONE: return DIM_TEXT_BORDER::NONE;
483 case types::DimensionTextBorderStyle::DTBS_RECTANGLE: return DIM_TEXT_BORDER::RECTANGLE;
484 case types::DimensionTextBorderStyle::DTBS_CIRCLE: return DIM_TEXT_BORDER::CIRCLE;
485 case types::DimensionTextBorderStyle::DTBS_ROUNDRECT: return DIM_TEXT_BORDER::ROUNDRECT;
486
487 default:
488 wxCHECK_MSG( false, DIM_TEXT_BORDER::NONE,
489 "Unhandled case in FromProtoEnum<types::DimensionTextBorderStyle>" );
490 }
491}
492
493
494template<>
495types::DimensionUnitFormat ToProtoEnum( DIM_UNITS_FORMAT aValue )
496{
497 switch( aValue )
498 {
499 case DIM_UNITS_FORMAT::NO_SUFFIX: return types::DimensionUnitFormat::DUF_NO_SUFFIX;
500 case DIM_UNITS_FORMAT::BARE_SUFFIX: return types::DimensionUnitFormat::DUF_BARE_SUFFIX;
501 case DIM_UNITS_FORMAT::PAREN_SUFFIX: return types::DimensionUnitFormat::DUF_PAREN_SUFFIX;
502
503 default:
504 wxCHECK_MSG( false, types::DimensionUnitFormat::DUF_UNKNOWN,
505 "Unhandled case in ToProtoEnum<DIM_UNITS_FORMAT>");
506 }
507}
508
509
510template<>
511DIM_UNITS_FORMAT FromProtoEnum( types::DimensionUnitFormat aValue )
512{
513 switch( aValue )
514 {
515 case types::DimensionUnitFormat::DUF_UNKNOWN:
516 case types::DimensionUnitFormat::DUF_NO_SUFFIX: return DIM_UNITS_FORMAT::NO_SUFFIX;
517 case types::DimensionUnitFormat::DUF_BARE_SUFFIX: return DIM_UNITS_FORMAT::BARE_SUFFIX;
518 case types::DimensionUnitFormat::DUF_PAREN_SUFFIX: return DIM_UNITS_FORMAT::PAREN_SUFFIX;
519
520 default:
521 wxCHECK_MSG( false, DIM_UNITS_FORMAT::NO_SUFFIX,
522 "Unhandled case in FromProtoEnum<types::DimensionUnitFormat>" );
523 }
524}
525
526
527template<>
528types::DimensionArrowDirection ToProtoEnum( DIM_ARROW_DIRECTION aValue )
529{
530 switch( aValue )
531 {
532 case DIM_ARROW_DIRECTION::INWARD: return types::DimensionArrowDirection::DAD_INWARD;
533 case DIM_ARROW_DIRECTION::OUTWARD: return types::DimensionArrowDirection::DAD_OUTWARD;
534
535 default:
536 wxCHECK_MSG( false, types::DimensionArrowDirection::DAD_UNKNOWN,
537 "Unhandled case in ToProtoEnum<DIM_ARROW_DIRECTION>");
538 }
539}
540
541
542template<>
543DIM_ARROW_DIRECTION FromProtoEnum( types::DimensionArrowDirection aValue )
544{
545 switch( aValue )
546 {
547 case types::DimensionArrowDirection::DAD_INWARD: return DIM_ARROW_DIRECTION::INWARD;
548 case types::DimensionArrowDirection::DAD_UNKNOWN:
549 case types::DimensionArrowDirection::DAD_OUTWARD: return DIM_ARROW_DIRECTION::OUTWARD;
550
551 default:
552 wxCHECK_MSG( false, DIM_ARROW_DIRECTION::OUTWARD,
553 "Unhandled case in FromProtoEnum<types::DimensionArrowDirection>" );
554 }
555}
556
557
558template<>
559types::DimensionPrecision ToProtoEnum( DIM_PRECISION aValue )
560{
561 switch( aValue )
562 {
563 case DIM_PRECISION::X: return types::DimensionPrecision::DP_FIXED_0;
564 case DIM_PRECISION::X_X: return types::DimensionPrecision::DP_FIXED_1;
565 case DIM_PRECISION::X_XX: return types::DimensionPrecision::DP_FIXED_2;
566 case DIM_PRECISION::X_XXX: return types::DimensionPrecision::DP_FIXED_3;
567 case DIM_PRECISION::X_XXXX: return types::DimensionPrecision::DP_FIXED_4;
568 case DIM_PRECISION::X_XXXXX: return types::DimensionPrecision::DP_FIXED_5;
569 case DIM_PRECISION::V_VV: return types::DimensionPrecision::DP_SCALED_IN_2;
570 case DIM_PRECISION::V_VVV: return types::DimensionPrecision::DP_SCALED_IN_3;
571 case DIM_PRECISION::V_VVVV: return types::DimensionPrecision::DP_SCALED_IN_4;
572 case DIM_PRECISION::V_VVVVV: return types::DimensionPrecision::DP_SCALED_IN_5;
573
574 default:
575 wxCHECK_MSG( false, types::DimensionPrecision::DP_UNKNOWN,
576 "Unhandled case in ToProtoEnum<DIM_PRECISION>");
577 }
578}
579
580
581template<>
582DIM_PRECISION FromProtoEnum( types::DimensionPrecision aValue )
583{
584 switch( aValue )
585 {
586 case types::DimensionPrecision::DP_FIXED_0: return DIM_PRECISION::X;
587 case types::DimensionPrecision::DP_FIXED_1: return DIM_PRECISION::X_X;
588 case types::DimensionPrecision::DP_FIXED_2: return DIM_PRECISION::X_XX;
589 case types::DimensionPrecision::DP_FIXED_3: return DIM_PRECISION::X_XXX;
590 case types::DimensionPrecision::DP_FIXED_4: return DIM_PRECISION::X_XXXX;
591 case types::DimensionPrecision::DP_FIXED_5: return DIM_PRECISION::X_XXXXX;
592 case types::DimensionPrecision::DP_UNKNOWN:
593 case types::DimensionPrecision::DP_SCALED_IN_2: return DIM_PRECISION::V_VV;
594 case types::DimensionPrecision::DP_SCALED_IN_3: return DIM_PRECISION::V_VVV;
595 case types::DimensionPrecision::DP_SCALED_IN_4: return DIM_PRECISION::V_VVVV;
596 case types::DimensionPrecision::DP_SCALED_IN_5: return DIM_PRECISION::V_VVVVV;
597
598 default:
599 wxCHECK_MSG( false, DIM_PRECISION::V_VV,
600 "Unhandled case in FromProtoEnum<types::DimensionPrecision>" );
601 }
602}
603
604
605template<>
606types::DimensionTextPosition ToProtoEnum( DIM_TEXT_POSITION aValue )
607{
608 switch( aValue )
609 {
610 case DIM_TEXT_POSITION::OUTSIDE: return types::DimensionTextPosition::DTP_OUTSIDE;
611 case DIM_TEXT_POSITION::INLINE: return types::DimensionTextPosition::DTP_INLINE;
612 case DIM_TEXT_POSITION::MANUAL: return types::DimensionTextPosition::DTP_MANUAL;
613
614 default:
615 wxCHECK_MSG( false, types::DimensionTextPosition::DTP_UNKNOWN,
616 "Unhandled case in ToProtoEnum<DIM_TEXT_POSITION>");
617 }
618}
619
620
621template<>
622DIM_TEXT_POSITION FromProtoEnum( types::DimensionTextPosition aValue )
623{
624 switch( aValue )
625 {
626 case types::DimensionTextPosition::DTP_UNKNOWN:
627 case types::DimensionTextPosition::DTP_OUTSIDE: return DIM_TEXT_POSITION::OUTSIDE;
628 case types::DimensionTextPosition::DTP_INLINE: return DIM_TEXT_POSITION::INLINE;
629 case types::DimensionTextPosition::DTP_MANUAL: return DIM_TEXT_POSITION::MANUAL;
630
631 default:
632 wxCHECK_MSG( false, DIM_TEXT_POSITION::OUTSIDE,
633 "Unhandled case in FromProtoEnum<types::DimensionTextPosition>" );
634 }
635}
636
637
638template<>
639types::DimensionUnit ToProtoEnum( DIM_UNITS_MODE aValue )
640{
641 switch( aValue )
642 {
643 case DIM_UNITS_MODE::INCHES: return types::DimensionUnit::DU_INCHES;
644 case DIM_UNITS_MODE::MILS: return types::DimensionUnit::DU_MILS;
645 case DIM_UNITS_MODE::MILLIMETRES: return types::DimensionUnit::DU_MILLIMETERS;
646 case DIM_UNITS_MODE::AUTOMATIC: return types::DimensionUnit::DU_AUTOMATIC;
647
648 default:
649 wxCHECK_MSG( false, types::DimensionUnit::DU_UNKNOWN,
650 "Unhandled case in ToProtoEnum<DIM_UNITS_MODE>");
651 }
652}
653
654
655template<>
656DIM_UNITS_MODE FromProtoEnum( types::DimensionUnit aValue )
657{
658 switch( aValue )
659 {
660 case types::DimensionUnit::DU_INCHES: return DIM_UNITS_MODE::INCHES;
661 case types::DimensionUnit::DU_MILS: return DIM_UNITS_MODE::MILS;
662 case types::DimensionUnit::DU_MILLIMETERS: return DIM_UNITS_MODE::MILLIMETRES;
663 case types::DimensionUnit::DU_UNKNOWN:
664 case types::DimensionUnit::DU_AUTOMATIC: return DIM_UNITS_MODE::AUTOMATIC;
665
666 default:
667 wxCHECK_MSG( false, DIM_UNITS_MODE::AUTOMATIC,
668 "Unhandled case in FromProtoEnum<types::DimensionUnit>" );
669 }
670}
671
672
673template<>
674commands::InactiveLayerDisplayMode ToProtoEnum( HIGH_CONTRAST_MODE aValue )
675{
676 switch( aValue )
677 {
678 case HIGH_CONTRAST_MODE::NORMAL: return commands::InactiveLayerDisplayMode::ILDM_NORMAL;
679 case HIGH_CONTRAST_MODE::DIMMED: return commands::InactiveLayerDisplayMode::ILDM_DIMMED;
680 case HIGH_CONTRAST_MODE::HIDDEN: return commands::InactiveLayerDisplayMode::ILDM_HIDDEN;
681
682 default:
683 wxCHECK_MSG( false, commands::InactiveLayerDisplayMode::ILDM_NORMAL,
684 "Unhandled case in ToProtoEnum<HIGH_CONTRAST_MODE>");
685 }
686}
687
688
689template<>
690HIGH_CONTRAST_MODE FromProtoEnum( commands::InactiveLayerDisplayMode aValue )
691{
692 switch( aValue )
693 {
694 case commands::InactiveLayerDisplayMode::ILDM_DIMMED: return HIGH_CONTRAST_MODE::DIMMED;
695 case commands::InactiveLayerDisplayMode::ILDM_HIDDEN: return HIGH_CONTRAST_MODE::HIDDEN;
696 case commands::InactiveLayerDisplayMode::ILDM_UNKNOWN:
697 case commands::InactiveLayerDisplayMode::ILDM_NORMAL: return HIGH_CONTRAST_MODE::NORMAL;
698
699 default:
700 wxCHECK_MSG( false, HIGH_CONTRAST_MODE::NORMAL,
701 "Unhandled case in FromProtoEnum<commands::InactiveLayerDisplayMode>" );
702 }
703}
704
705
706template<>
707commands::NetColorDisplayMode ToProtoEnum( NET_COLOR_MODE aValue )
708{
709 switch( aValue )
710 {
711 case NET_COLOR_MODE::ALL: return commands::NetColorDisplayMode::NCDM_ALL;
712 case NET_COLOR_MODE::RATSNEST: return commands::NetColorDisplayMode::NCDM_RATSNEST;
713 case NET_COLOR_MODE::OFF: return commands::NetColorDisplayMode::NCDM_OFF;
714
715 default:
716 wxCHECK_MSG( false, commands::NetColorDisplayMode::NCDM_UNKNOWN,
717 "Unhandled case in ToProtoEnum<NET_COLOR_MODE>");
718 }
719}
720
721
722template<>
723NET_COLOR_MODE FromProtoEnum( commands::NetColorDisplayMode aValue )
724{
725 switch( aValue )
726 {
727 case commands::NetColorDisplayMode::NCDM_ALL: return NET_COLOR_MODE::ALL;
728 case commands::NetColorDisplayMode::NCDM_OFF: return NET_COLOR_MODE::OFF;
729 case commands::NetColorDisplayMode::NCDM_UNKNOWN:
730 case commands::NetColorDisplayMode::NCDM_RATSNEST: return NET_COLOR_MODE::RATSNEST;
731
732 default:
733 wxCHECK_MSG( false, NET_COLOR_MODE::RATSNEST,
734 "Unhandled case in FromProtoEnum<commands::NetColorDisplayMode>" );
735 }
736}
737
738
739template<>
740commands::RatsnestDisplayMode ToProtoEnum( RATSNEST_MODE aValue )
741{
742 switch( aValue )
743 {
744 case RATSNEST_MODE::ALL: return commands::RatsnestDisplayMode::RDM_ALL_LAYERS;
745 case RATSNEST_MODE::VISIBLE: return commands::RatsnestDisplayMode::RDM_VISIBLE_LAYERS;
746
747 default:
748 wxCHECK_MSG( false, commands::RatsnestDisplayMode::RDM_UNKNOWN,
749 "Unhandled case in ToProtoEnum<RATSNEST_MODE>");
750 }
751}
752
753
754template<>
755RATSNEST_MODE FromProtoEnum( commands::RatsnestDisplayMode aValue )
756{
757 switch( aValue )
758 {
759 case commands::RatsnestDisplayMode::RDM_VISIBLE_LAYERS: return RATSNEST_MODE::VISIBLE;
760 case commands::RatsnestDisplayMode::RDM_UNKNOWN:
761 case commands::RatsnestDisplayMode::RDM_ALL_LAYERS: return RATSNEST_MODE::ALL;
762
763 default:
764 wxCHECK_MSG( false, RATSNEST_MODE::ALL,
765 "Unhandled case in FromProtoEnum<commands::RatsnestDisplayMode>" );
766 }
767}
768
769// 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)
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
Definition: padstack.h:137
@ NORMAL
Shape is the same on all layers.
@ CUSTOM
Shapes can be defined on arbitrary layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
UNCONNECTED_LAYER_MODE
! Whether or not to remove the copper shape for unconnected layers
Definition: padstack.h:151
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
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition: padstack.h:52
DIM_TEXT_POSITION
Where to place the text on a dimension.
Definition: pcb_dimension.h:62
@ 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.
Definition: pcb_dimension.h:40
DIM_UNITS_MODE
Used for storing the units selection in the file because EDA_UNITS alone doesn't cut it.
Definition: pcb_dimension.h:72
DIM_ARROW_DIRECTION
Used for dimension's arrow.
Definition: pcb_dimension.h:83
DIM_TEXT_BORDER
Frame to show around dimension text.
Definition: pcb_dimension.h:92
DIM_PRECISION
Definition: pcb_dimension.h:47
VIATYPE
Definition: pcb_track.h:66
@ BLIND_BURIED
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.
RULE_AREA_PLACEMENT_SOURCE_TYPE
Definition: zone_settings.h:66
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
Definition: zone_settings.h:59
ZONE_FILL_MODE
Definition: zone_settings.h:42
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:50
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:47
@ THERMAL
Use thermal relief for pads.
@ THT_THERMAL
Thermal relief only for THT pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper