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 The 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{
370 CENTER = 0,
371 RIGHT = 1,
372 LEFT = 2
373};
374
375
377{
379
380 wxString text;
382
385
388
389 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
390};
391
393{
394 wxString url;
395
396 explicit ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps );
397};
398
399
401{
404
405 // have both coordinates, for convenience
408
409 wxString Text;
410
411 bool IsWordWrapped; // to do when kicad supports this
413
415 int TextMargin; // to do when kicad supports this
421
423
424 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
425};
426
427
429{
430 wxString author;
431
432 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
433};
434
435
437{
438 std::vector<VECTOR2I> points;
439
440 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
441};
442
443
445{
446 SOLID = 0,
447 DASHED = 1,
448 DOTTED = 2,
449 DASH_DOTTED = 3
450};
451
452
454{
455 LEFT = 0,
456 RIGHT = 1,
457 TOP = 2,
458 BOTTOM = 3
459};
460
461
463{
464 std::vector<VECTOR2I> Points;
465
467
468 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
469};
470
471
473{
474 std::vector<VECTOR2I> points;
475
476 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
477};
478
479
481{
484
486
487 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
488};
489
490
492{
499
500 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
501};
502
503
505{
506 explicit ASCH_PIECHART( const std::map<wxString, wxString>& aProps );
507};
508
509
511{
515
516 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
517};
518
519
521{
524
526
527 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
528};
529
530
532{
535
536 std::vector<VECTOR2I> points;
537
538 int color;
540
541 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
542};
543
544
546{
549
555
556 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
557};
558
559
561{
563 int Color;
568
569 bool OwnerIndexAdditionalList; // what is that?
570
571 wxString Name;
573
574 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
575};
576
577
579{
580 int Color;
582
584 bool OwnerIndexAdditionalList; // what is that?
585
587
588 wxString Text;
589
590 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
591};
592
593
595{
598
599 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
600};
601
602
604{
607
609
610 int color;
612
613 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
614};
615
616
618{
619 UNSPECIFIED = 0,
620 OUTPUT = 1,
621 INPUT = 2,
622 BIDI = 3,
623};
624
625
627{
628 NONE_HORIZONTAL = 0,
629 LEFT = 1,
630 RIGHT = 2,
631 LEFT_RIGHT = 3,
632 NONE_VERTICAL = 4,
633 TOP = 5,
634 BOTTOM = 6,
635 TOP_BOTTOM = 7
636};
637
638
640{
642
646
647 wxString name;
648
649 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
650};
651
652
654{
655 UNKNOWN = -1,
656
657 CIRCLE = 0,
658 ARROW = 1,
659 BAR = 2,
660 WAVE = 3,
661 POWER_GROUND = 4,
662 SIGNAL_GROUND = 5,
663 EARTH = 6,
664 GOST_ARROW = 7,
666 GOST_EARTH = 9,
667 GOST_BAR = 10
668};
669
670
672{
673 wxString text;
675
679
680 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
681};
682
683
685{
686 wxString Name;
687 wxString HarnessType;
688
690 int Width;
693 int Color;
696
698
701
702 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
703};
704
705
707{
709
712
713 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
714};
715
716
718{
719 wxString text;
720
722
725
726 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
727};
728
729
731{
733
734 std::vector<VECTOR2I> points;
735
736 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
737};
738
739
741{
743
744 std::vector<VECTOR2I> points;
745
746 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
747};
748
749
751{
753
754 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
755};
756
757
759{
760 wxString filename;
763
766
767 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
768};
769
770
772{
773 wxString FontName;
774
775 int Size;
778
779 bool Italic;
780 bool Bold;
782
783 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
784};
785
786
788{
789 UNKNOWN = -1, // use A4
790
791 A4 = 0, // 1150 × 760
792 A3 = 1, // 1550 × 1110
793 A2 = 2, // 2230 × 1570
794 A1 = 3, // 3150 × 2230
795 A0 = 4, // 4460 × 3150
796 A = 5, // 950 × 750
797 B = 6, // 1500 × 950
798 C = 7, // 2000 × 1500
799 D = 8, // 3200 × 2000
800 E = 9, // 4200 × 3200
801 LETTER = 10, // 1100 × 850
802 LEGAL = 11, // 1400 × 850
803 TABLOID = 12, // 1700 × 1100
804 ORCAD_A = 13, // 990 × 790
805 ORCAD_B = 14, // 1540 × 990
806 ORCAD_C = 15, // 2060 × 1560
807 ORCAD_D = 16, // 3260 × 2060
808 ORCAD_E = 17 // 4280 × 3280
809};
810
812
813
815{
816 LANDSCAPE = 0,
817 PORTRAIT = 1
818};
819
820
822{
823 std::vector<ASCH_SHEET_FONT> fonts;
824
827
830
831 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
832};
833
834
836{
837 wxString text;
838
841
843
844 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
845};
846
847
849{
850 wxString text;
851
854
856
857 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
858};
859
860
862{
863 wxString name;
864 wxString text;
866
870
871 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
872};
873
874
876{
877 wxString name;
878 wxString type;
879 wxString libname;
880 wxString description;
882
883 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
884};
885
886
888{
889 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
890};
891
892
894{
897
898 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
899};
900
901
903{
907
908 wxString name;
909 wxString text;
910
915
916 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
917};
918
919#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_PORT_ALIGNMENT
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:88
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
Definition: line.h:36
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
ASCH_SHEET_ENTRY_SIDE m_harnessConnectorSide
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_PORT_IOTYPE IOtype
wxString HarnessType
ASCH_PORT_ALIGNMENT m_align
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