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-2022 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
39class ALTIUM_PARSER;
40
42{
43 wxString filename;
44 std::vector<char> data;
45
46 explicit ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader );
47};
48
50{
51 wxString FileName;
52 std::vector<char> Data;
53
54 explicit ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader );
55};
56
58{
59 HEADER = 0,
60 COMPONENT = 1,
61 PIN = 2,
62 IEEE_SYMBOL = 3,
63 LABEL = 4,
64 BEZIER = 5,
65 POLYLINE = 6,
66 POLYGON = 7,
67 ELLIPSE = 8,
68 PIECHART = 9,
69 ROUND_RECTANGLE = 10,
70 ELLIPTICAL_ARC = 11,
71 ARC = 12,
72 LINE = 13,
73 RECTANGLE = 14,
74 SHEET_SYMBOL = 15,
75 SHEET_ENTRY = 16,
76 POWER_PORT = 17,
77 PORT = 18,
78 NO_ERC = 22,
79 NET_LABEL = 25,
80 BUS = 26,
81 WIRE = 27,
82 TEXT_FRAME = 28,
83 JUNCTION = 29,
84 IMAGE = 30,
85 SHEET = 31,
86 SHEET_NAME = 32,
87 FILE_NAME = 33,
88 DESIGNATOR = 34,
89 BUS_ENTRY = 37,
90 TEMPLATE = 39,
91 PARAMETER = 41,
92 PARAMETER_SET = 43,
94 IMPLEMENTATION = 45,
96 MAP_DEFINER = 47,
97 IMPL_PARAMS = 48,
98 NOTE = 209,
99 COMPILE_MASK = 211,
100 HARNESS_CONNECTOR = 215,
101 HARNESS_ENTRY = 216,
102 HARNESS_TYPE = 217,
103 SIGNAL_HARNESS = 218,
104 BLANKET = 225,
105 HYPERLINK = 226,
106};
107
108
110{
111 RIGHTWARDS = 0, // 0
112 UPWARDS = 1, // 90
113 LEFTWARDS = 2, // 180
114 DOWNWARDS = 3 // 270
115};
116
117
119{
124
125 explicit ASCH_OWNER_INTERFACE( const std::map<wxString, wxString>& aProps );
126};
127
129{
133
134 explicit ASCH_FILL_INTERFACE( const std::map<wxString, wxString>& aProps );
135};
136
138{
140 int Color;
141
142 explicit ASCH_BORDER_INTERFACE( const std::map<wxString, wxString>& aProps );
143};
144
145
147{
150 wxString libreference;
153
157
161
162 explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProps );
163};
164
165
167{
168 UNKNOWN = -1,
169 NO_SYMBOL = 0,
170 NEGATED = 1,
171 RIGHTLEFT = 2,
172 CLOCK = 3,
173 LOW_INPUT = 4,
174 ANALOG_IN = 5,
175 NOLOGICCONNECT = 6,
176 // 7 is missing
177 POSTPONE_OUTPUT = 8,
178 OPEN_COLLECTOR = 9,
179 HIZ = 10,
180 HIGH_CURRENT = 11,
181 PULSE = 12,
182 SCHMITT = 13,
183 // 14-16 missing
184 LOW_OUTPUT = 17,
185 // 18-21 missing
187 OPEN_EMITTER = 23,
189 DIGITAL_IN = 25,
190 // 26-29 missing
191 SHIFT_LEFT = 30,
192 // 31 is missing
193 OPEN_OUTPUT = 32,
194 LEFTRIGHT = 33,
195 BIDI = 34
196};
197
199{
200public:
201 enum PTYPE
202 {
207 CLOCK = 3,
211 // 7 is missing
214 HIZ = 10,
216 PULSE = 12,
218 // 14-16 missing
220 // 18-21 missing
225 // 26-29 missing
227 // 31 is missing
230 BIDI = 34
231 };
232
233 static PTYPE FromInt( int aInt )
234 {
235 switch( aInt )
236 {
237 case 0:
238 return NO_SYMBOL;
239 case 1:
240 return NEGATED;
241 case 2:
242 return RIGHTLEFT;
243 case 3:
244 return CLOCK;
245 case 4:
246 return LOW_INPUT;
247 case 5:
248 return ANALOG_IN;
249 case 6:
250 return NOLOGICCONNECT;
251 case 8:
252 return POSTPONE_OUTPUT;
253 case 9:
254 return OPEN_COLLECTOR;
255 case 10:
256 return HIZ;
257 case 11:
258 return HIGH_CURRENT;
259 case 12:
260 return PULSE;
261 case 13:
262 return SCHMITT;
263 case 17:
264 return LOW_OUTPUT;
265 case 22:
267 case 23:
268 return OPEN_EMITTER;
269 case 24:
271 case 25:
272 return DIGITAL_IN;
273 case 30:
274 return SHIFT_LEFT;
275 case 32:
276 return OPEN_OUTPUT;
277 case 33:
278 return LEFTRIGHT;
279 case 34:
280 return BIDI;
281 default:
282 return UNKNOWN;
283 }
284 }
285};
286
287
289{
290 UNKNOWN = -1,
291
292 INPUT = 0,
293 BIDI = 1,
294 OUTPUT = 2,
295 OPEN_COLLECTOR = 3,
296 PASSIVE = 4,
297 TRISTATE = 5,
298 OPEN_EMITTER = 6,
299 POWER = 7
300};
301
302
304{
305 wxString name;
306 wxString text;
307 wxString designator;
308
311
314
317
320
321 VECTOR2I kicadLocation; // location of pin in KiCad without rounding error
322
325 bool hidden;
326 bool locked;
327
328 bool isKiCadLibPin; // Tracking variable to handle LibEdit nuance
329
330 explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
331};
332
333
335{
336 UNKNOWN = -1,
337
338 BOTTOM_LEFT = 0,
339 BOTTOM_CENTER = 1,
340 BOTTOM_RIGHT = 2,
341 CENTER_LEFT = 3,
342 CENTER_CENTER = 4,
343 CENTER_RIGHT = 5,
344 TOP_LEFT = 6,
345 TOP_CENTER = 7,
346 TOP_RIGHT = 8
347};
348
349
351{
352 LEFT = 1,
353 CENTER = 2,
354 RIGHT = 3
355};
356
357
359{
361
362 wxString text;
364
367
370
371 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
372};
373
375{
376 wxString url;
377
378 explicit ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps );
379};
380
381
383{
386
387 // have both coordinates, for convenience
390
391 wxString Text;
392
393 bool IsWordWrapped; // to do when kicad supports this
395
397 int TextMargin; // to do when kicad supports this
403
405
406 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
407};
408
409
411{
412 wxString author;
413
414 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
415};
416
417
419{
420 std::vector<VECTOR2I> points;
421
422 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
423};
424
425
427{
428 SOLID = 0,
429 DASHED = 1,
430 DOTTED = 2,
431 DASH_DOTTED = 3
432};
433
434
436{
437 LEFT = 0,
438 RIGHT = 1,
439 TOP = 2,
440 BOTTOM = 3
441};
442
443
445{
446 std::vector<VECTOR2I> Points;
447
449
450 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
451};
452
453
455{
456 std::vector<VECTOR2I> points;
457
458 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
459};
460
461
463{
466
468
469 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
470};
471
472
474{
481
482 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
483};
484
485
487{
491
493
494 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
495};
496
497
499{
502
504
505 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
506};
507
508
510{
513
514 std::vector<VECTOR2I> Points;
515
516 int Color;
518
519 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
520};
521
522
524{
527
529 int Color;
531 //int locationX; // keep just in case
532 //int locationY;
534 //int xSize; // keep just in case
535 //int ySize;
536
537 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
538};
539
540
542{
544 int Color;
549
550 bool OwnerIndexAdditionalList; // what is that?
551
552 wxString Name;
554
555 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
556};
557
558
560{
561 int Color;
563
565 bool OwnerIndexAdditionalList; // what is that?
566
568
569 wxString Text;
570
571 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
572};
573
574
576{
579
580 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
581};
582
583
585{
588
590
591 int color;
593
594 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
595};
596
597
599{
600 UNSPECIFIED = 0,
601 OUTPUT = 1,
602 INPUT = 2,
603 BIDI = 3,
604};
605
606
608{
609 NONE_HORIZONTAL = 0,
610 LEFT = 1,
611 RIGHT = 2,
612 LEFT_RIGHT = 3,
613 NONE_VERTICAL = 4,
614 TOP = 5,
615 BOTTOM = 6,
616 TOP_BOTTOM = 7
617};
618
619
621{
623
627
628 wxString name;
629
630 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
631};
632
633
635{
636 UNKNOWN = -1,
637
638 CIRCLE = 0,
639 ARROW = 1,
640 BAR = 2,
641 WAVE = 3,
642 POWER_GROUND = 4,
643 SIGNAL_GROUND = 5,
644 EARTH = 6,
645 GOST_ARROW = 7,
647 GOST_EARTH = 9,
648 GOST_BAR = 10
649};
650
651
653{
654 wxString text;
656
660
661 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
662};
663
664
666{
667 wxString Name;
668 wxString HarnessType;
669
671 int Width;
674 int Color;
677
679
682
683 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
684};
685
686
688{
690
693
694 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
695};
696
697
699{
700 wxString text;
701
703
706
707 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
708};
709
710
712{
714
715 std::vector<VECTOR2I> points;
716
717 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
718};
719
720
722{
724
725 std::vector<VECTOR2I> points;
726
727 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
728};
729
730
732{
734
735 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
736};
737
738
740{
741 wxString filename;
744
747
748 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
749};
750
751
753{
754 wxString FontName;
755
756 int Size;
759
760 bool Italic;
761 bool Bold;
763
764 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
765};
766
767
769{
770 UNKNOWN = -1, // use A4
771
772 A4 = 0, // 1150 × 760
773 A3 = 1, // 1550 × 1110
774 A2 = 2, // 2230 × 1570
775 A1 = 3, // 3150 × 2230
776 A0 = 4, // 4460 × 3150
777 A = 5, // 950 × 750
778 B = 6, // 1500 × 950
779 C = 7, // 2000 × 1500
780 D = 8, // 3200 × 2000
781 E = 9, // 4200 × 3200
782 LETTER = 10, // 1100 × 850
783 LEGAL = 11, // 1400 × 850
784 TABLOID = 12, // 1700 × 1100
785 ORCAD_A = 13, // 990 × 790
786 ORCAD_B = 14, // 1540 × 990
787 ORCAD_C = 15, // 2060 × 1560
788 ORCAD_D = 16, // 3260 × 2060
789 ORCAD_E = 17 // 4280 × 3280
790};
791
793
794
796{
797 LANDSCAPE = 0,
798 PORTRAIT = 1
799};
800
801
803{
804 std::vector<ASCH_SHEET_FONT> fonts;
805
808
811
812 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
813};
814
815
817{
818 wxString text;
819
822
824
825 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
826};
827
828
830{
831 wxString text;
832
835
837
838 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
839};
840
841
843{
844 wxString name;
845 wxString text;
847
851
852 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
853};
854
855
857{
858 wxString name;
859 wxString type;
860 wxString libname;
861 wxString description;
863
864 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
865};
866
867
869{
870 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
871};
872
873
875{
878
879 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
880};
881
882
884{
888
889 wxString name;
890 wxString text;
891
896
897 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
898};
899
900#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