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 explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
341};
342
343
345{
346 UNKNOWN = -1,
347
348 BOTTOM_LEFT = 0,
349 BOTTOM_CENTER = 1,
350 BOTTOM_RIGHT = 2,
351 CENTER_LEFT = 3,
352 CENTER_CENTER = 4,
353 CENTER_RIGHT = 5,
354 TOP_LEFT = 6,
355 TOP_CENTER = 7,
356 TOP_RIGHT = 8
357};
358
359
361{
362 LEFT = 1,
363 CENTER = 2,
364 RIGHT = 3
365};
366
367
369{
371
372 wxString text;
374
377
380
381 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
382};
383
385{
386 wxString url;
387
388 explicit ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps );
389};
390
391
393{
396
397 // have both coordinates, for convenience
400
401 wxString Text;
402
403 bool IsWordWrapped; // to do when kicad supports this
405
407 int TextMargin; // to do when kicad supports this
413
415
416 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
417};
418
419
421{
422 wxString author;
423
424 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
425};
426
427
429{
430 std::vector<VECTOR2I> points;
431
432 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
433};
434
435
437{
438 SOLID = 0,
439 DASHED = 1,
440 DOTTED = 2,
441 DASH_DOTTED = 3
442};
443
444
446{
447 LEFT = 0,
448 RIGHT = 1,
449 TOP = 2,
450 BOTTOM = 3
451};
452
453
455{
456 std::vector<VECTOR2I> Points;
457
459
460 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
461};
462
463
465{
466 std::vector<VECTOR2I> points;
467
468 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
469};
470
471
473{
476
478
479 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
480};
481
482
484{
491
492 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
493};
494
495
497{
498 explicit ASCH_PIECHART( const std::map<wxString, wxString>& aProps );
499};
500
501
503{
507
508 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
509};
510
511
513{
516
518
519 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
520};
521
522
524{
527
528 std::vector<VECTOR2I> Points;
529
530 int Color;
532
533 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
534};
535
536
538{
541
543 int Color;
545 //int locationX; // keep just in case
546 //int locationY;
548 //int xSize; // keep just in case
549 //int ySize;
550
551 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
552};
553
554
556{
558 int Color;
563
564 bool OwnerIndexAdditionalList; // what is that?
565
566 wxString Name;
568
569 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
570};
571
572
574{
575 int Color;
577
579 bool OwnerIndexAdditionalList; // what is that?
580
582
583 wxString Text;
584
585 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
586};
587
588
590{
593
594 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
595};
596
597
599{
602
604
605 int color;
607
608 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
609};
610
611
613{
614 UNSPECIFIED = 0,
615 OUTPUT = 1,
616 INPUT = 2,
617 BIDI = 3,
618};
619
620
622{
623 NONE_HORIZONTAL = 0,
624 LEFT = 1,
625 RIGHT = 2,
626 LEFT_RIGHT = 3,
627 NONE_VERTICAL = 4,
628 TOP = 5,
629 BOTTOM = 6,
630 TOP_BOTTOM = 7
631};
632
633
635{
637
641
642 wxString name;
643
644 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
645};
646
647
649{
650 UNKNOWN = -1,
651
652 CIRCLE = 0,
653 ARROW = 1,
654 BAR = 2,
655 WAVE = 3,
656 POWER_GROUND = 4,
657 SIGNAL_GROUND = 5,
658 EARTH = 6,
659 GOST_ARROW = 7,
661 GOST_EARTH = 9,
662 GOST_BAR = 10
663};
664
665
667{
668 wxString text;
670
674
675 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
676};
677
678
680{
681 wxString Name;
682 wxString HarnessType;
683
685 int Width;
688 int Color;
691
693
696
697 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
698};
699
700
702{
704
707
708 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
709};
710
711
713{
714 wxString text;
715
717
720
721 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
722};
723
724
726{
728
729 std::vector<VECTOR2I> points;
730
731 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
732};
733
734
736{
738
739 std::vector<VECTOR2I> points;
740
741 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
742};
743
744
746{
748
749 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
750};
751
752
754{
755 wxString filename;
758
761
762 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
763};
764
765
767{
768 wxString FontName;
769
770 int Size;
773
774 bool Italic;
775 bool Bold;
777
778 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
779};
780
781
783{
784 UNKNOWN = -1, // use A4
785
786 A4 = 0, // 1150 × 760
787 A3 = 1, // 1550 × 1110
788 A2 = 2, // 2230 × 1570
789 A1 = 3, // 3150 × 2230
790 A0 = 4, // 4460 × 3150
791 A = 5, // 950 × 750
792 B = 6, // 1500 × 950
793 C = 7, // 2000 × 1500
794 D = 8, // 3200 × 2000
795 E = 9, // 4200 × 3200
796 LETTER = 10, // 1100 × 850
797 LEGAL = 11, // 1400 × 850
798 TABLOID = 12, // 1700 × 1100
799 ORCAD_A = 13, // 990 × 790
800 ORCAD_B = 14, // 1540 × 990
801 ORCAD_C = 15, // 2060 × 1560
802 ORCAD_D = 16, // 3260 × 2060
803 ORCAD_E = 17 // 4280 × 3280
804};
805
807
808
810{
811 LANDSCAPE = 0,
812 PORTRAIT = 1
813};
814
815
817{
818 std::vector<ASCH_SHEET_FONT> fonts;
819
822
825
826 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
827};
828
829
831{
832 wxString text;
833
836
838
839 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
840};
841
842
844{
845 wxString text;
846
849
851
852 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
853};
854
855
857{
858 wxString name;
859 wxString text;
861
865
866 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
867};
868
869
871{
872 wxString name;
873 wxString type;
874 wxString libname;
875 wxString description;
877
878 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
879};
880
881
883{
884 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
885};
886
887
889{
892
893 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
894};
895
896
898{
902
903 wxString name;
904 wxString text;
905
910
911 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
912};
913
914#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:95
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:87
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