KiCad PCB EDA Suite
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
35#include <wx/gdicmn.h>
36#include <wx/string.h>
37
38// this constant specifies a item which is not inside an component
39const int ALTIUM_COMPONENT_NONE = -1;
40
41class ALTIUM_PARSER;
42
44{
45 wxString filename;
46 std::vector<char> data;
47
48 explicit ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader );
49};
50
52{
53 wxString FileName;
54 std::vector<char> Data;
55
56 explicit ASCH_ADDITIONAL_FILE( ALTIUM_PARSER& aReader );
57};
58
60{
61 HEADER = 0,
62 COMPONENT = 1,
63 PIN = 2,
64 IEEE_SYMBOL = 3,
65 LABEL = 4,
66 BEZIER = 5,
67 POLYLINE = 6,
68 POLYGON = 7,
69 ELLIPSE = 8,
70 PIECHART = 9,
71 ROUND_RECTANGLE = 10,
72 ELLIPTICAL_ARC = 11,
73 ARC = 12,
74 LINE = 13,
75 RECTANGLE = 14,
76 SHEET_SYMBOL = 15,
77 SHEET_ENTRY = 16,
78 POWER_PORT = 17,
79 PORT = 18,
80 NO_ERC = 22,
81 NET_LABEL = 25,
82 BUS = 26,
83 WIRE = 27,
84 TEXT_FRAME = 28,
85 JUNCTION = 29,
86 IMAGE = 30,
87 SHEET = 31,
88 SHEET_NAME = 32,
89 FILE_NAME = 33,
90 DESIGNATOR = 34,
91 BUS_ENTRY = 37,
92 TEMPLATE = 39,
93 PARAMETER = 41,
94 WARNING_SIGN = 43,
96 IMPLEMENTATION = 45,
97 RECORD_46 = 46,
98 RECORD_47 = 47,
99 RECORD_48 = 48,
100 NOTE = 209,
101 COMPILE_MASK = 211,
102 HARNESS_CONNECTOR = 215,
103 HARNESS_ENTRY = 216,
104 HARNESS_TYPE = 217,
105 SIGNAL_HARNESS = 218,
106 RECORD_226 = 226,
107};
108
109
111{
112 RIGHTWARDS = 0, // 0
113 UPWARDS = 1, // 90
114 LEFTWARDS = 2, // 180
115 DOWNWARDS = 3 // 270
116};
117
118
120{
124
127
128 int Color;
130};
131
132
134{
137 wxString libreference;
140
144
148
149 explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProps );
150};
151
152
154{
155 UNKNOWN = -1,
156 NO_SYMBOL = 0,
163};
164
165
167{
168 UNKNOWN = -1,
169 NO_SYMBOL = 0,
170 POSPONED_OUTPUT = 8,
171 OPEN_COLLECTOR = 9,
172 HIZ = 10,
173 HIGH_CURRENT = 11,
174 PULSE = 12,
175 SCHMITT = 13,
177 OPEN_EMITTER = 23,
179 SHIFT_LEFT = 30,
180 OPEN_OUTPUT = 32
181};
182
183
185{
186 UNKNOWN = -1,
187 NO_SYMBOL = 0,
188 NEGATED = 1,
189 LOW_INPUT = 4,
190 LOW_OUTPUT = 17
191};
192
193
195{
196 UNKNOWN = -1,
197 NO_SYMBOL = 0,
198 CLOCK = 3,
199};
200
201
203{
204 UNKNOWN = -1,
205
206 INPUT = 0,
207 BIDI = 1,
208 OUTPUT = 2,
209 OPEN_COLLECTOR = 3,
210 PASSIVE = 4,
211 TRISTATE = 5,
212 OPEN_EMITTER = 6,
213 POWER = 7
214};
215
216
218{
222
223 wxString name;
224 wxString text;
225 wxString designator;
226
229
232
235
238
239 VECTOR2I kicadLocation; // location of pin in KiCad without rounding error
240
243
244 explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
245};
246
247
249{
250 UNKNOWN = -1,
251
252 BOTTOM_LEFT = 0,
253 BOTTOM_CENTER = 1,
254 BOTTOM_RIGHT = 2,
255 CENTER_LEFT = 3,
256 CENTER_CENTER = 4,
257 CENTER_RIGHT = 5,
258 TOP_LEFT = 6,
259 TOP_CENTER = 7,
260 TOP_RIGHT = 8
261};
262
263
265{
266 LEFT = 1,
267 CENTER = 2,
268 RIGHT = 3
269};
270
271
273{
276
278
279 wxString text;
280
283
286
287 explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
288};
289
290
292{
294 wxSize Size;
295
296 // have both coordinates, for convenience
299
300 wxString Text;
301
302 bool IsWordWrapped; // to do when kicad supports this
305
307 int TextMargin; // to do when kicad supports this
310
312
313 explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
314};
315
316
318{
319 wxString author;
320
321 explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
322};
323
324
326{
330
331 std::vector<VECTOR2I> points;
332
334
335 explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
336};
337
338
340{
341 SOLID = 0,
342 DASHED = 1,
343 DOTTED = 2,
344 DASH_DOTTED = 3
345};
346
347
349{
350 LEFT = 0,
351 RIGHT = 1,
352 TOP = 2,
353 BOTTOM = 3
354};
355
356
358{
362
363 std::vector<VECTOR2I> Points;
364
366 int Color;
367
369
370 explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
371};
372
373
375{
376 std::vector<VECTOR2I> points;
377
378 explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
379};
380
381
383{
386
388
390
391 explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
392};
393
394
396{
400
407
409
410 explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
411};
412
413
415{
418
422
426
427 explicit ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps );
428};
429
430
432{
436
439
441
442 explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
443};
444
445
447{
448 int OwnerPartID; // always -1, can be safely ignored I think
449
452
453 std::vector<VECTOR2I> Points;
454
455 int Color;
458
459 explicit ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps );
460};
461
462
464{
465 int OwnerPartID; // always -1, can be safely ignored I think
466
468 wxSize Size;
469
471 int Color;
472 int IndexInSheet; // Keeps increasing nicely
474 //int locationX; // keep just in case
475 //int locationY;
477 //int xSize; // keep just in case
478 //int ySize;
479
480 explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
481};
482
483
485{
486 // Completely random, mostly this entry exists, but not always, should not be used!
487 // int ownerindex;
488
489 int OwnerPartID; // always -1, can be safely ignored I think
490
492 int Color;
498
499 bool OwnerIndexAdditionalList; // what is that?
500
501 wxString Name;
503
504 explicit ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps );
505};
506
507
509{
510 //int ownerindex; // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
511 int OwnerPartID; // Always -1, presumably safe to remuve
512
513 int Color;
516
518 bool OwnerIndexAdditionalList; // what is that?
519
521
522 wxString Text;
523
524 explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
525};
526
527
529{
532
534
535 explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
536};
537
538
540{
542 wxSize size;
543
545
546 int color;
548
549 explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
550};
551
552
554{
555 UNSPECIFIED = 0,
556 OUTPUT = 1,
557 INPUT = 2,
558 BIDI = 3,
559};
560
561
563{
564 NONE_HORIZONTAL = 0,
565 LEFT = 1,
566 RIGHT = 2,
567 LEFT_RIGHT = 3,
568 NONE_VERTICAL = 4,
569 TOP = 5,
570 BOTTOM = 6,
571 TOP_BOTTOM = 7
572};
573
574
576{
579
581
585
586 wxString name;
587
588 explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
589};
590
591
593{
594 UNKNOWN = -1,
595
596 CIRCLE = 0,
597 ARROW = 1,
598 BAR = 2,
599 WAVE = 3,
600 POWER_GROUND = 4,
601 SIGNAL_GROUND = 5,
602 EARTH = 6,
603 GOST_ARROW = 7,
605 GOST_EARTH = 9,
606 GOST_BAR = 10
607};
608
609
611{
613
614 wxString text;
616
620
621 explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
622};
623
624
626{
628
629 wxString Name;
630 wxString HarnessType;
631
633 int Width;
636 int Color;
639
641
644
645 explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
646};
647
648
650{
652
655
656 explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
657};
658
659
661{
662 wxString text;
663
665
667
668 explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
669};
670
671
673{
676
677 std::vector<VECTOR2I> points;
678
679 explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
680};
681
682
684{
687
688 std::vector<VECTOR2I> points;
689
690 explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
691};
692
693
695{
697
699
700 explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
701};
702
703
705{
709
710 wxString filename;
713
716
717 explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
718};
719
720
722{
723 wxString FontName;
724
725 int Size;
728
729 bool Italic;
730 bool Bold;
732
733 explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
734};
735
736
738{
739 UNKNOWN = -1, // use A4
740
741 A4 = 0, // 1150 × 760
742 A3 = 1, // 1550 × 1110
743 A2 = 2, // 2230 × 1570
744 A1 = 3, // 3150 × 2230
745 A0 = 4, // 4460 × 3150
746 A = 5, // 950 × 750
747 B = 6, // 1500 × 950
748 C = 7, // 2000 × 1500
749 D = 8, // 3200 × 2000
750 E = 9, // 4200 × 3200
751 LETTER = 10, // 1100 × 850
752 LEGAL = 11, // 1400 × 850
753 TABLOID = 12, // 1700 × 1100
754 ORCAD_A = 13, // 990 × 790
755 ORCAD_B = 14, // 1540 × 990
756 ORCAD_C = 15, // 2060 × 1560
757 ORCAD_D = 16, // 3260 × 2060
758 ORCAD_E = 17 // 4280 × 3280
759};
760
762
763
765{
766 LANDSCAPE = 0,
767 PORTRAIT = 1
768};
769
770
772{
773 std::vector<ASCH_SHEET_FONT> fonts;
774
777
778 explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
779};
780
781
783{
786
787 wxString text;
788
791
793
794 explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
795};
796
797
799{
802
803 wxString text;
804
807
809
810 explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
811};
812
813
815{
818
819 wxString name;
820 wxString text;
821
825
826 explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
827};
828
829
831{
833
834 wxString name;
835 wxString type;
836 wxString libname;
837
839
840 explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
841};
842
843
845{
847 explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
848};
849
850
852{
855
856 explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
857};
858
859
861{
864
868
869 wxString name;
870 wxString text;
871
875
876 explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
877};
878
879#endif //ALTIUM_PARSER_SCH_H
ASCH_PIN_SYMBOL_INNER
ALTIUM_SCH_RECORD
ASCH_RECORD_ORIENTATION
ASCH_SHEET_ENTRY_SIDE
ASCH_PIN_SYMBOL_INNEREDGE
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_LABEL_JUSTIFICATION
ASCH_PIN_SYMBOL_OUTER
ASCH_POLYLINE_LINESTYLE
ASCH_SHEET_SIZE
ASCH_POWER_PORT_STYLE
ASCH_SHEET_WORKSPACEORIENTATION
ASCH_PIN_SYMBOL_OUTEREDGE
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:85
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
@ BUS
This item represents a bus vector.
@ UNKNOWN
Definition: sch_item.h:64
std::vector< char > Data
ASCH_ADDITIONAL_FILE(ALTIUM_PARSER &aReader)
ASCH_ARC(const std::map< wxString, wxString > &aProps)
int ownerpartdisplaymode
double m_StartAngle
VECTOR2I m_Center
double m_EndAngle
ASCH_BEZIER(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_BUS_ENTRY(const std::map< wxString, wxString > &aProps)
VECTOR2I corner
VECTOR2I location
ASCH_BUS(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_LABEL_JUSTIFICATION justification
ASCH_DESIGNATOR(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_ELLIPSE(const std::map< wxString, wxString > &aProps)
ASCH_FILE_NAME(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_HARNESS_CONNECTOR(const std::map< wxString, wxString > &aProps)
int OwnerPartID
ASCH_HARNESS_ENTRY(const std::map< wxString, wxString > &aProps)
int TextStyle
int IndexInSheet
int TextFontID
int AreaColor
int DistanceFromTop
ASCH_SHEET_ENTRY_SIDE Side
int TextColor
int Color
wxString Name
bool OwnerIndexAdditionalList
ASCH_HARNESS_TYPE(const std::map< wxString, wxString > &aProps)
VECTOR2I location
ASCH_IMAGE(const std::map< wxString, wxString > &aProps)
wxString filename
ASCH_IMPLEMENTATION_LIST(const std::map< wxString, wxString > &aProps)
ASCH_IMPLEMENTATION(const std::map< wxString, wxString > &aProps)
ASCH_JUNCTION(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
VECTOR2I location
ASCH_LABEL(const std::map< wxString, wxString > &aProps)
ASCH_LABEL_JUSTIFICATION justification
VECTOR2I point1
VECTOR2I point2
int ownerpartdisplaymode
ASCH_LINE(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_NET_LABEL(const std::map< wxString, wxString > &aProps)
ASCH_NOTE(const std::map< wxString, wxString > &aProperties)
wxString author
ASCH_NO_ERC(const std::map< wxString, wxString > &aProps)
ASCH_PARAMETER(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_LABEL_JUSTIFICATION justification
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
ASCH_PIN_SYMBOL_OUTER symbolOuter
VECTOR2I location
int ownerpartdisplaymode
wxString name
wxString text
VECTOR2I kicadLocation
wxString designator
ASCH_PIN_ELECTRICAL electrical
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points
ASCH_POLYGON(const std::map< wxString, wxString > &aProps)
ASCH_POLYLINE(const std::map< wxString, wxString > &aProps)
ASCH_POLYLINE_LINESTYLE LineStyle
std::vector< VECTOR2I > Points
VECTOR2I Location
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_PORT_IOTYPE IOtype
ASCH_PORT(const std::map< wxString, wxString > &aProps)
wxString HarnessType
ASCH_PORT_STYLE Style
ASCH_POWER_PORT(const std::map< wxString, wxString > &aProps)
ASCH_POWER_PORT_STYLE style
ASCH_RECORD_ORIENTATION orientation
ASCH_RECTANGLE(const std::map< wxString, wxString > &aProps)
ASCH_ROUND_RECTANGLE(const std::map< wxString, wxString > &aProps)
int ownerpartid
wxString name
int distanceFromTop
ASCH_SHEET_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_ENTRY_SIDE side
ASCH_PORT_IOTYPE iotype
ASCH_PORT_STYLE style
int ownerindex
ASCH_SHEET_FONT(const std::map< wxString, wxString > &aProps, int aId)
ASCH_SHEET_NAME(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION orientation
ASCH_SHEET_SYMBOL(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_SIZE sheetSize
ASCH_SHEET_WORKSPACEORIENTATION sheetOrientation
ASCH_SHEET(const std::map< wxString, wxString > &aProps)
std::vector< ASCH_SHEET_FONT > fonts
ASCH_SIGNAL_HARNESS(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > Points
std::vector< char > data
ASCH_STORAGE_FILE(ALTIUM_PARSER &aReader)
wxString componentdescription
ASCH_SYMBOL(const std::map< wxString, wxString > &aProps)
wxString libreference
wxString sourcelibraryname
ASCH_TEXT_FRAME_ALIGNMENT Alignment
ASCH_TEXT_FRAME(const std::map< wxString, wxString > &aProps)
ASCH_WIRE(const std::map< wxString, wxString > &aProps)
std::vector< VECTOR2I > points