KiCad PCB EDA Suite
Loading...
Searching...
No Matches
altium_parser_sch.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) 2020 Thomas Pointhuber <[email protected]>
5 * Copyright (C) 2021-2024 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 ALTIUM_PARSER_SCH_H
26#define ALTIUM_PARSER_SCH_H
27
28#include <cstdint>
29#include <cstring>
30#include <map>
31#include <vector>
32
33#include <math/vector2d.h>
34#include <wx/string.h>
35
36// this constant specifies a item which is not inside an component
37const int ALTIUM_COMPONENT_NONE = -1;
38
40
42{
43 wxString filename;
44 std::vector<char> data;
45
46 explicit ASCH_STORAGE_FILE( const std::map<wxString, wxString>& aProps );
47 explicit ASCH_STORAGE_FILE( ALTIUM_BINARY_PARSER& aReader );
48};
49
51{
52 wxString FileName;
53 std::vector<char> Data;
54
55 explicit ASCH_ADDITIONAL_FILE( ALTIUM_BINARY_PARSER& aReader );
56};
57
59{
60 UNKNOWN = -1,
61
62 HEADER = 0,
63 COMPONENT = 1,
64 PIN = 2,
65 IEEE_SYMBOL = 3,
66 LABEL = 4,
67 BEZIER = 5,
68 POLYLINE = 6,
69 POLYGON = 7,
70 ELLIPSE = 8,
71 PIECHART = 9,
72 ROUND_RECTANGLE = 10,
73 ELLIPTICAL_ARC = 11,
74 ARC = 12,
75 LINE = 13,
76 RECTANGLE = 14,
77 SHEET_SYMBOL = 15,
78 SHEET_ENTRY = 16,
79 POWER_PORT = 17,
80 PORT = 18,
81 NO_ERC = 22,
82 NET_LABEL = 25,
83 BUS = 26,
84 WIRE = 27,
85 TEXT_FRAME = 28,
86 JUNCTION = 29,
87 IMAGE = 30,
88 SHEET = 31,
89 SHEET_NAME = 32,
90 FILE_NAME = 33,
91 DESIGNATOR = 34,
92 BUS_ENTRY = 37,
93 TEMPLATE = 39,
94 PARAMETER = 41,
95 PARAMETER_SET = 43,
97 IMPLEMENTATION = 45,
99 MAP_DEFINER = 47,
100 IMPL_PARAMS = 48,
101 NOTE = 209,
102 COMPILE_MASK = 211,
103 HARNESS_CONNECTOR = 215,
104 HARNESS_ENTRY = 216,
105 HARNESS_TYPE = 217,
106 SIGNAL_HARNESS = 218,
107 BLANKET = 225,
108 HYPERLINK = 226,
109};
110
111
113{
114 RIGHTWARDS = 0, // 0
115 UPWARDS = 1, // 90
116 LEFTWARDS = 2, // 180
117 DOWNWARDS = 3 // 270
118};
119
120
122{
128
129 explicit ASCH_OWNER_INTERFACE( const std::map<wxString, wxString>& aProps );
130};
131
133{
137
138 explicit ASCH_FILL_INTERFACE( const std::map<wxString, wxString>& aProps );
139};
140
142{
144 int Color;
145
146 explicit ASCH_BORDER_INTERFACE( const std::map<wxString, wxString>& aProps );
147};
148
149
151{
154 wxString libreference;
157
161
165
166 explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProps );
167};
168
169
171{
172 wxString filename;
173
174 explicit ASCH_TEMPLATE( const std::map<wxString, wxString>& aProps );
175};
176
177
179{
180 UNKNOWN = -1,
181 NO_SYMBOL = 0,
182 NEGATED = 1,
183 RIGHTLEFT = 2,
184 CLOCK = 3,
185 LOW_INPUT = 4,
186 ANALOG_IN = 5,
187 NOLOGICCONNECT = 6,
188 // 7 is missing
189 POSTPONE_OUTPUT = 8,
190 OPEN_COLLECTOR = 9,
191 HIZ = 10,
192 HIGH_CURRENT = 11,
193 PULSE = 12,
194 SCHMITT = 13,
195 // 14-16 missing
196 LOW_OUTPUT = 17,
197 // 18-21 missing
199 OPEN_EMITTER = 23,
201 DIGITAL_IN = 25,
202 // 26-29 missing
203 SHIFT_LEFT = 30,
204 // 31 is missing
205 OPEN_OUTPUT = 32,
206 LEFTRIGHT = 33,
207 BIDI = 34
208};
209
211{
212public:
213 enum PTYPE
214 {
219 CLOCK = 3,
223 // 7 is missing
226 HIZ = 10,
228 PULSE = 12,
230 // 14-16 missing
232 // 18-21 missing
237 // 26-29 missing
239 // 31 is missing
242 BIDI = 34
243 };
244
245 static PTYPE FromInt( int aInt )
246 {
247 switch( aInt )
248 {
249 case 0:
250 return NO_SYMBOL;
251 case 1:
252 return NEGATED;
253 case 2:
254 return RIGHTLEFT;
255 case 3:
256 return CLOCK;
257 case 4:
258 return LOW_INPUT;
259 case 5:
260 return ANALOG_IN;
261 case 6:
262 return NOLOGICCONNECT;
263 case 8:
264 return POSTPONE_OUTPUT;
265 case 9:
266 return OPEN_COLLECTOR;
267 case 10:
268 return HIZ;
269 case 11:
270 return HIGH_CURRENT;
271 case 12:
272 return PULSE;
273 case 13:
274 return SCHMITT;
275 case 17:
276 return LOW_OUTPUT;
277 case 22:
279 case 23:
280 return OPEN_EMITTER;
281 case 24:
283 case 25:
284 return DIGITAL_IN;
285 case 30:
286 return SHIFT_LEFT;
287 case 32:
288 return OPEN_OUTPUT;
289 case 33:
290 return LEFTRIGHT;
291 case 34:
292 return BIDI;
293 default:
294 return UNKNOWN;
295 }
296 }
297};
298
299
301{
302 UNKNOWN = -1,
303
304 INPUT = 0,
305 BIDI = 1,
306 OUTPUT = 2,
307 OPEN_COLLECTOR = 3,
308 PASSIVE = 4,
309 TRISTATE = 5,
310 OPEN_EMITTER = 6,
311 POWER = 7
312};
313
314
316{
317 wxString name;
318 wxString text;
319 wxString designator;
320
323
326
329
332
333 VECTOR2I kicadLocation; // location of pin in KiCad without rounding error
334
337 bool hidden;
338 bool locked;
339
340 bool isKiCadLibPin; // Tracking variable to handle LibEdit nuance
341
342 explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
343};
344
345
347{
348 UNKNOWN = -1,
349
350 BOTTOM_LEFT = 0,
351 BOTTOM_CENTER = 1,
352 BOTTOM_RIGHT = 2,
353 CENTER_LEFT = 3,
354 CENTER_CENTER = 4,
355 CENTER_RIGHT = 5,
356 TOP_LEFT = 6,
357 TOP_CENTER = 7,
358 TOP_RIGHT = 8
359};
360
361
363{
364 LEFT = 1,
365 CENTER = 2,
366 RIGHT = 3
367};
368
369
371{
373
374 wxString text;
376
379
382
383 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
384};
385
387{
388 wxString url;
389
390 explicit ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps );
391};
392
393
395{
398
399 // have both coordinates, for convenience
402
403 wxString Text;
404
405 bool IsWordWrapped; // to do when kicad supports this
407
409 int TextMargin; // to do when kicad supports this
415
417
418 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
419};
420
421
423{
424 wxString author;
425
426 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
427};
428
429
431{
432 std::vector<VECTOR2I> points;
433
434 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
435};
436
437
439{
440 SOLID = 0,
441 DASHED = 1,
442 DOTTED = 2,
443 DASH_DOTTED = 3
444};
445
446
448{
449 LEFT = 0,
450 RIGHT = 1,
451 TOP = 2,
452 BOTTOM = 3
453};
454
455
457{
458 std::vector<VECTOR2I> Points;
459
461
462 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
463};
464
465
467{
468 std::vector<VECTOR2I> points;
469
470 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
471};
472
473
475{
478
480
481 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
482};
483
484
486{
493
494 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
495};
496
497
499{
503
504 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
505};
506
507
509{
512
514
515 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
516};
517
518
520{
523
524 std::vector<VECTOR2I> Points;
525
526 int Color;
528
529 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
530};
531
532
534{
537
539 int Color;
541 //int locationX; // keep just in case
542 //int locationY;
544 //int xSize; // keep just in case
545 //int ySize;
546
547 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
548};
549
550
552{
554 int Color;
559
560 bool OwnerIndexAdditionalList; // what is that?
561
562 wxString Name;
564
565 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
566};
567
568
570{
571 int Color;
573
575 bool OwnerIndexAdditionalList; // what is that?
576
578
579 wxString Text;
580
581 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
582};
583
584
586{
589
590 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
591};
592
593
595{
598
600
601 int color;
603
604 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
605};
606
607
609{
610 UNSPECIFIED = 0,
611 OUTPUT = 1,
612 INPUT = 2,
613 BIDI = 3,
614};
615
616
618{
619 NONE_HORIZONTAL = 0,
620 LEFT = 1,
621 RIGHT = 2,
622 LEFT_RIGHT = 3,
623 NONE_VERTICAL = 4,
624 TOP = 5,
625 BOTTOM = 6,
626 TOP_BOTTOM = 7
627};
628
629
631{
633
637
638 wxString name;
639
640 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
641};
642
643
645{
646 UNKNOWN = -1,
647
648 CIRCLE = 0,
649 ARROW = 1,
650 BAR = 2,
651 WAVE = 3,
652 POWER_GROUND = 4,
653 SIGNAL_GROUND = 5,
654 EARTH = 6,
655 GOST_ARROW = 7,
657 GOST_EARTH = 9,
658 GOST_BAR = 10
659};
660
661
663{
664 wxString text;
666
670
671 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
672};
673
674
676{
677 wxString Name;
678 wxString HarnessType;
679
681 int Width;
684 int Color;
687
689
692
693 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
694};
695
696
698{
700
703
704 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
705};
706
707
709{
710 wxString text;
711
713
716
717 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
718};
719
720
722{
724
725 std::vector<VECTOR2I> points;
726
727 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
728};
729
730
732{
734
735 std::vector<VECTOR2I> points;
736
737 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
738};
739
740
742{
744
745 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
746};
747
748
750{
751 wxString filename;
754
757
758 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
759};
760
761
763{
764 wxString FontName;
765
766 int Size;
769
770 bool Italic;
771 bool Bold;
773
774 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
775};
776
777
779{
780 UNKNOWN = -1, // use A4
781
782 A4 = 0, // 1150 × 760
783 A3 = 1, // 1550 × 1110
784 A2 = 2, // 2230 × 1570
785 A1 = 3, // 3150 × 2230
786 A0 = 4, // 4460 × 3150
787 A = 5, // 950 × 750
788 B = 6, // 1500 × 950
789 C = 7, // 2000 × 1500
790 D = 8, // 3200 × 2000
791 E = 9, // 4200 × 3200
792 LETTER = 10, // 1100 × 850
793 LEGAL = 11, // 1400 × 850
794 TABLOID = 12, // 1700 × 1100
795 ORCAD_A = 13, // 990 × 790
796 ORCAD_B = 14, // 1540 × 990
797 ORCAD_C = 15, // 2060 × 1560
798 ORCAD_D = 16, // 3260 × 2060
799 ORCAD_E = 17 // 4280 × 3280
800};
801
803
804
806{
807 LANDSCAPE = 0,
808 PORTRAIT = 1
809};
810
811
813{
814 std::vector<ASCH_SHEET_FONT> fonts;
815
818
821
822 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
823};
824
825
827{
828 wxString text;
829
832
834
835 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
836};
837
838
840{
841 wxString text;
842
845
847
848 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
849};
850
851
853{
854 wxString name;
855 wxString text;
857
861
862 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
863};
864
865
867{
868 wxString name;
869 wxString type;
870 wxString libname;
871 wxString description;
873
874 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
875};
876
877
879{
880 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
881};
882
883
885{
888
889 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
890};
891
892
894{
898
899 wxString name;
900 wxString text;
901
906
907 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
908};
909
910#endif //ALTIUM_PARSER_SCH_H
ALTIUM_SCH_RECORD
ASCH_RECORD_ORIENTATION
ASCH_SHEET_ENTRY_SIDE
ASCH_PIN_ELECTRICAL
ASCH_PORT_IOTYPE
ASCH_PORT_STYLE
const int ALTIUM_COMPONENT_NONE
VECTOR2I ASchSheetGetSize(ASCH_SHEET_SIZE aSheetSize)
ASCH_TEXT_FRAME_ALIGNMENT
ASCH_PIN_SYMBOL_EDGE
ASCH_LABEL_JUSTIFICATION
ASCH_POLYLINE_LINESTYLE
ASCH_SHEET_SIZE
ASCH_POWER_PORT_STYLE
ASCH_SHEET_WORKSPACEORIENTATION
static PTYPE FromInt(int aInt)
Generic cubic Bezier representation.
Definition: bezier_curves.h:78
Represent basic circle geometry with utility geometry functions.
Definition: circle.h:33
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:86
This class was created to handle importing ellipses from other file formats that support them nativel...
Definition: ellipse.h:34
Manage an 8-bit channel image.
Definition: image.h:90
std::chrono::steady_clock CLOCK
std::vector< char > Data
double m_StartAngle
VECTOR2I m_Center
double m_EndAngle
std::vector< VECTOR2I > points
VECTOR2I corner
VECTOR2I location
std::vector< VECTOR2I > points
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
ASCH_RECORD_ORIENTATION orientation
int TextStyle
int TextFontID
int AreaColor
int DistanceFromTop
ASCH_SHEET_ENTRY_SIDE Side
int TextColor
int Color
wxString Name
bool OwnerIndexAdditionalList
VECTOR2I location
wxString filename
ASCH_RECORD_ORIENTATION orientation
VECTOR2I location
ASCH_LABEL_JUSTIFICATION justification
VECTOR2I point1
VECTOR2I point2
ASCH_POLYLINE_LINESTYLE LineStyle
ASCH_LABEL_JUSTIFICATION justification
ASCH_RECORD_ORIENTATION orientation
wxString author
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
VECTOR2I location
ASCH_PIN_SYMBOL::PTYPE symbolOuterEdge
wxString name
wxString text
VECTOR2I kicadLocation
wxString designator
ASCH_PIN_SYMBOL::PTYPE symbolOuter
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL::PTYPE symbolInner
ASCH_PIN_SYMBOL::PTYPE symbolInnerEdge
ASCH_RECORD_ORIENTATION orientation
std::vector< VECTOR2I > points
ASCH_POLYLINE_LINESTYLE LineStyle
std::vector< VECTOR2I > Points
VECTOR2I Location
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_PORT_IOTYPE IOtype
wxString HarnessType
ASCH_PORT_STYLE Style
ASCH_POWER_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
wxString name
int distanceFromTop
ASCH_SHEET_ENTRY_SIDE side
ASCH_PORT_IOTYPE iotype
ASCH_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_SIZE sheetSize
ASCH_SHEET_WORKSPACEORIENTATION sheetOrientation
VECTOR2I customSize
std::vector< ASCH_SHEET_FONT > fonts
std::vector< VECTOR2I > Points
std::vector< char > data
wxString componentdescription
wxString libreference
wxString sourcelibraryname
ASCH_TEXT_FRAME_ALIGNMENT Alignment
std::vector< VECTOR2I > points