KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 <thomas.pointhuber@gmx.at>
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 uniqueid;
155 wxString libreference;
158
162
166
167 explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProps );
168};
169
170
172{
173 wxString filename;
174
175 explicit ASCH_TEMPLATE( const std::map<wxString, wxString>& aProps );
176};
177
178
180{
181 UNKNOWN = -1,
182 NO_SYMBOL = 0,
183 NEGATED = 1,
184 RIGHTLEFT = 2,
185 CLOCK = 3,
186 LOW_INPUT = 4,
187 ANALOG_IN = 5,
188 NOLOGICCONNECT = 6,
189 // 7 is missing
190 POSTPONE_OUTPUT = 8,
191 OPEN_COLLECTOR = 9,
192 HIZ = 10,
193 HIGH_CURRENT = 11,
194 PULSE = 12,
195 SCHMITT = 13,
196 // 14-16 missing
197 LOW_OUTPUT = 17,
198 // 18-21 missing
200 OPEN_EMITTER = 23,
202 DIGITAL_IN = 25,
203 // 26-29 missing
204 SHIFT_LEFT = 30,
205 // 31 is missing
206 OPEN_OUTPUT = 32,
207 LEFTRIGHT = 33,
208 BIDI = 34
209};
210
212{
213public:
214 enum PTYPE
215 {
220 CLOCK = 3,
224 // 7 is missing
227 HIZ = 10,
229 PULSE = 12,
231 // 14-16 missing
233 // 18-21 missing
238 // 26-29 missing
240 // 31 is missing
243 BIDI = 34
244 };
245
246 static PTYPE FromInt( int aInt )
247 {
248 switch( aInt )
249 {
250 case 0:
251 return NO_SYMBOL;
252 case 1:
253 return NEGATED;
254 case 2:
255 return RIGHTLEFT;
256 case 3:
257 return CLOCK;
258 case 4:
259 return LOW_INPUT;
260 case 5:
261 return ANALOG_IN;
262 case 6:
263 return NOLOGICCONNECT;
264 case 8:
265 return POSTPONE_OUTPUT;
266 case 9:
267 return OPEN_COLLECTOR;
268 case 10:
269 return HIZ;
270 case 11:
271 return HIGH_CURRENT;
272 case 12:
273 return PULSE;
274 case 13:
275 return SCHMITT;
276 case 17:
277 return LOW_OUTPUT;
278 case 22:
280 case 23:
281 return OPEN_EMITTER;
282 case 24:
284 case 25:
285 return DIGITAL_IN;
286 case 30:
287 return SHIFT_LEFT;
288 case 32:
289 return OPEN_OUTPUT;
290 case 33:
291 return LEFTRIGHT;
292 case 34:
293 return BIDI;
294 default:
295 return UNKNOWN;
296 }
297 }
298};
299
300
302{
303 UNKNOWN = -1,
304
305 INPUT = 0,
306 BIDI = 1,
307 OUTPUT = 2,
308 OPEN_COLLECTOR = 3,
309 PASSIVE = 4,
310 TRISTATE = 5,
311 OPEN_EMITTER = 6,
312 POWER = 7
313};
314
315
317{
318 wxString name;
319 wxString text;
320 wxString designator;
321
324
327
330
333
334 VECTOR2I kicadLocation; // location of pin in KiCad without rounding error
335
338 bool hidden;
339 bool locked;
340
341 explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
342};
343
344
346{
347 UNKNOWN = -1,
348
349 BOTTOM_LEFT = 0,
350 BOTTOM_CENTER = 1,
351 BOTTOM_RIGHT = 2,
352 CENTER_LEFT = 3,
353 CENTER_CENTER = 4,
354 CENTER_RIGHT = 5,
355 TOP_LEFT = 6,
356 TOP_CENTER = 7,
357 TOP_RIGHT = 8
358};
359
360
362{
363 LEFT = 1,
364 CENTER = 2,
365 RIGHT = 3
366};
367
368
370{
371 CENTER = 0,
372 RIGHT = 1,
373 LEFT = 2
374};
375
376
378{
380
381 wxString text;
383
386
389
390 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
391};
392
394{
395 wxString url;
396
397 explicit ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps );
398};
399
400
402{
405
406 // have both coordinates, for convenience
409
410 wxString Text;
411
412 bool IsWordWrapped; // to do when kicad supports this
414
416 int TextMargin; // to do when kicad supports this
422
424
425 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
426};
427
428
430{
431 wxString author;
432
433 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
434};
435
436
438{
439 std::vector<VECTOR2I> points;
440
441 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
442};
443
444
446{
447 SOLID = 0,
448 DASHED = 1,
449 DOTTED = 2,
450 DASH_DOTTED = 3
451};
452
453
455{
456 LEFT = 0,
457 RIGHT = 1,
458 TOP = 2,
459 BOTTOM = 3
460};
461
462
464{
465 std::vector<VECTOR2I> Points;
466
468
469 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
470};
471
472
474{
475 std::vector<VECTOR2I> points;
476
477 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
478};
479
480
482{
485
487
488 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
489};
490
491
493{
500
501 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
502};
503
504
506{
507 explicit ASCH_PIECHART( const std::map<wxString, wxString>& aProps );
508};
509
510
512{
516
517 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
518};
519
520
522{
525
527
528 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
529};
530
531
533{
536
537 std::vector<VECTOR2I> points;
538
539 int color;
541
542 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
543};
544
545
547{
550
556
557 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
558};
559
560
562{
564 int Color;
569
570 bool OwnerIndexAdditionalList; // what is that?
571
572 wxString Name;
574
575 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
576};
577
578
580{
581 int Color;
583
585 bool OwnerIndexAdditionalList; // what is that?
586
588
589 wxString Text;
590
591 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
592};
593
594
596{
599
600 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
601};
602
603
605{
608
610
611 int color;
613
614 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
615};
616
617
619{
620 UNSPECIFIED = 0,
621 OUTPUT = 1,
622 INPUT = 2,
623 BIDI = 3,
624};
625
626
628{
629 NONE_HORIZONTAL = 0,
630 LEFT = 1,
631 RIGHT = 2,
632 LEFT_RIGHT = 3,
633 NONE_VERTICAL = 4,
634 TOP = 5,
635 BOTTOM = 6,
636 TOP_BOTTOM = 7
637};
638
639
641{
643
647
648 wxString name;
649
650 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
651};
652
653
655{
656 UNKNOWN = -1,
657
658 CIRCLE = 0,
659 ARROW = 1,
660 BAR = 2,
661 WAVE = 3,
662 POWER_GROUND = 4,
663 SIGNAL_GROUND = 5,
664 EARTH = 6,
665 GOST_ARROW = 7,
667 GOST_EARTH = 9,
668 GOST_BAR = 10
669};
670
671
673{
674 wxString text;
676
680
681 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
682};
683
684
686{
687 wxString Name;
688 wxString HarnessType;
689
691 int Width;
694 int Color;
697
699
702
703 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
704};
705
706
708{
710
713
714 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
715};
716
717
719{
720 wxString text;
721
723
726
727 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
728};
729
730
732{
734
735 std::vector<VECTOR2I> points;
736
737 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
738};
739
740
742{
744
745 std::vector<VECTOR2I> points;
746
747 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
748};
749
750
752{
754
755 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
756};
757
758
760{
761 wxString filename;
764
767
768 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
769};
770
771
773{
774 wxString FontName;
775
776 int Size;
779
780 bool Italic;
781 bool Bold;
783
784 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
785};
786
787
789{
790 UNKNOWN = -1, // use A4
791
792 A4 = 0, // 1150 × 760
793 A3 = 1, // 1550 × 1110
794 A2 = 2, // 2230 × 1570
795 A1 = 3, // 3150 × 2230
796 A0 = 4, // 4460 × 3150
797 A = 5, // 950 × 750
798 B = 6, // 1500 × 950
799 C = 7, // 2000 × 1500
800 D = 8, // 3200 × 2000
801 E = 9, // 4200 × 3200
802 LETTER = 10, // 1100 × 850
803 LEGAL = 11, // 1400 × 850
804 TABLOID = 12, // 1700 × 1100
805 ORCAD_A = 13, // 990 × 790
806 ORCAD_B = 14, // 1540 × 990
807 ORCAD_C = 15, // 2060 × 1560
808 ORCAD_D = 16, // 3260 × 2060
809 ORCAD_E = 17 // 4280 × 3280
810};
811
813
814
816{
817 LANDSCAPE = 0,
818 PORTRAIT = 1
819};
820
821
823{
824 std::vector<ASCH_SHEET_FONT> fonts;
825
828
831
832 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
833};
834
835
837{
838 wxString text;
839
842
844
845 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
846};
847
848
850{
851 wxString text;
852
855
857
858 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
859};
860
861
863{
864 wxString name;
865 wxString text;
867
871
872 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
873};
874
875
877{
878 wxString name;
879 wxString type;
880 wxString libname;
881 wxString description;
883
884 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
885};
886
887
889{
890 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
891};
892
893
895{
898
899 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
900};
901
902
904{
908
909 wxString name;
910 wxString text;
911
916
917 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
918};
919
920#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