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 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 <wx/gdicmn.h>
34 #include <wx/string.h>
35 
36 // this constant specifies a item which is not inside an component
37 const int ALTIUM_COMPONENT_NONE = -1;
38 
39 class ALTIUM_PARSER;
40 
42 {
43  wxString filename;
44  std::vector<char> data;
45 
46  explicit ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader );
47 };
48 
49 
51 {
52  HEADER = 0,
53  COMPONENT = 1,
54  PIN = 2,
55  IEEE_SYMBOL = 3,
56  LABEL = 4,
57  BEZIER = 5,
58  POLYLINE = 6,
59  POLYGON = 7,
60  ELLIPSE = 8,
61  PIECHART = 9,
62  ROUND_RECTANGLE = 10,
63  ELLIPTICAL_ARC = 11,
64  ARC = 12,
65  LINE = 13,
66  RECTANGLE = 14,
67  SHEET_SYMBOL = 15,
68  SHEET_ENTRY = 16,
69  POWER_PORT = 17,
70  PORT = 18,
71  NO_ERC = 22,
72  NET_LABEL = 25,
73  BUS = 26,
74  WIRE = 27,
75  TEXT_FRAME = 28,
76  JUNCTION = 29,
77  IMAGE = 30,
78  SHEET = 31,
79  SHEET_NAME = 32,
80  FILE_NAME = 33,
81  DESIGNATOR = 34,
82  BUS_ENTRY = 37,
83  TEMPLATE = 39,
84  PARAMETER = 41,
85  WARNING_SIGN = 43,
87  IMPLEMENTATION = 45,
88  RECORD_46 = 46,
89  RECORD_47 = 47,
90  RECORD_48 = 48,
91  NOTE = 209,
92  COMPILE_MASK = 211,
93  RECORD_215 = 215,
94  RECORD_216 = 216,
95  RECORD_217 = 217,
96  RECORD_218 = 218,
97  RECORD_226 = 226,
98 };
99 
100 
102 {
103  RIGHTWARDS = 0, // 0
104  UPWARDS = 1, // 90
105  LEFTWARDS = 2, // 180
106  DOWNWARDS = 3 // 270
107 };
108 
109 
111 {
113  wxString libreference;
116 
119  wxPoint location;
120 
124 
125  explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProps );
126 };
127 
128 
130 {
131  UNKNOWN = -1,
132  NO_SYMBOL = 0,
134  ANALOG_SIGNAL_IN = 5,
136  DIGITAL_SIGNAL_IN = 25,
138  BIDI_SIGNAL_FLOW = 34
139 };
140 
141 
143 {
144  UNKNOWN = -1,
145  NO_SYMBOL = 0,
146  POSPONED_OUTPUT = 8,
147  OPEN_COLLECTOR = 9,
148  HIZ = 10,
149  HIGH_CURRENT = 11,
150  PULSE = 12,
151  SCHMITT = 13,
153  OPEN_EMITTER = 23,
155  SHIFT_LEFT = 30,
156  OPEN_OUTPUT = 32
157 };
158 
159 
161 {
162  UNKNOWN = -1,
163  NO_SYMBOL = 0,
164  NEGATED = 1,
165  LOW_INPUT = 4,
166  LOW_OUTPUT = 17
167 };
168 
169 
171 {
172  UNKNOWN = -1,
173  NO_SYMBOL = 0,
174  CLOCK = 3,
175 };
176 
177 
179 {
180  UNKNOWN = -1,
181 
182  INPUT = 0,
183  BIDI = 1,
184  OUTPUT = 2,
185  OPEN_COLLECTOR = 3,
186  PASSIVE = 4,
187  TRISTATE = 5,
188  OPEN_EMITTER = 6,
189  POWER = 7
190 };
191 
192 
193 struct ASCH_PIN
194 {
198 
199  wxString name;
200  wxString text;
201  wxString designator;
202 
205 
208 
211 
212  wxPoint location;
214 
215  wxPoint kicadLocation; // location of pin in KiCad without rounding error
216 
219 
220  explicit ASCH_PIN( const std::map<wxString, wxString>& aProps );
221 };
222 
223 
225 {
226  UNKNOWN = -1,
227 
228  BOTTOM_LEFT = 0,
229  BOTTOM_CENTER = 1,
230  BOTTOM_RIGHT = 2,
231  CENTER_LEFT = 3,
232  CENTER_CENTER = 4,
233  CENTER_RIGHT = 5,
234  TOP_LEFT = 6,
235  TOP_CENTER = 7,
236  TOP_RIGHT = 8
237 };
238 
239 
241 {
242  LEFT = 1,
243  CENTER = 2,
244  RIGHT = 3
245 };
246 
247 
249 {
252 
253  wxPoint location;
254 
255  wxString text;
256 
257  int fontId;
259 
262 
263  explicit ASCH_LABEL( const std::map<wxString, wxString>& aProps );
264 };
265 
266 
268 {
269  wxPoint location;
270  wxSize size;
271 
272  wxString text;
273 
274  int fontId;
276  bool border;
279 
281 
282  explicit ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps );
283 };
284 
285 
287 {
288  wxString author;
289 
290  explicit ASCH_NOTE( const std::map<wxString, wxString>& aProperties );
291 };
292 
293 
295 {
299 
300  std::vector<wxPoint> points;
301 
303 
304  explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProps );
305 };
306 
307 
309 {
310  SOLID = 0,
311  DASHED = 1,
312  DOTTED = 2,
313  DASH_DOTTED = 3
314 };
315 
316 
318 {
322 
323  std::vector<wxPoint> points;
324 
326 
328 
329  explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProps );
330 };
331 
332 
334 {
338 
339  std::vector<wxPoint> points;
340 
342  bool isSolid;
343 
344  int color;
346 
347  explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
348 };
349 
350 
352 {
356 
357  wxPoint bottomLeft;
358  wxPoint topRight;
359 
360  wxSize cornerradius;
361 
363  bool isSolid;
365 
366  int color;
368 
369  explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps );
370 };
371 
372 
373 struct ASCH_ARC
374 {
378 
379  wxPoint center;
380  int radius;
381  double startAngle;
382  double endAngle;
383 
385 
386  explicit ASCH_ARC( const std::map<wxString, wxString>& aProps );
387 };
388 
389 
390 struct ASCH_LINE
391 {
395 
396  wxPoint point1;
397  wxPoint point2;
398 
400 
401  explicit ASCH_LINE( const std::map<wxString, wxString>& aProps );
402 };
403 
404 
406 {
410 
411  wxPoint bottomLeft;
412  wxPoint topRight;
413 
415  bool isSolid;
417 
418  int color;
420 
421  explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps );
422 };
423 
424 
426 {
427  wxPoint location;
428  wxSize size;
429 
430  bool isSolid;
431 
432  int color;
434 
435  explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps );
436 };
437 
438 
440 {
441  LEFT = 0,
442  RIGHT = 1,
443  TOP = 2,
444  BOTTOM = 3
445 };
446 
447 
449 {
450  UNSPECIFIED = 0,
451  OUTPUT = 1,
452  INPUT = 2,
453  BIDI = 3,
454 };
455 
456 
457 enum class ASCH_PORT_STYLE
458 {
459  NONE_HORIZONTAL = 0,
460  LEFT = 1,
461  RIGHT = 2,
462  LEFT_RIGHT = 3,
463  NONE_VERTICAL = 4,
464  TOP = 5,
465  BOTTOM = 6,
466  TOP_BOTTOM = 7
467 };
468 
469 
471 {
474 
476 
480 
481  wxString name;
482 
483  explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps );
484 };
485 
486 
488 {
489  UNKNOWN = -1,
490 
491  CIRCLE = 0,
492  ARROW = 1,
493  BAR = 2,
494  WAVE = 3,
495  POWER_GROUND = 4,
496  SIGNAL_GROUND = 5,
497  EARTH = 6,
498  GOST_ARROW = 7,
499  GOST_POWER_GROUND = 8,
500  GOST_EARTH = 9,
501  GOST_BAR = 10
502 };
503 
504 
506 {
508 
509  wxString text;
511 
512  wxPoint location;
515 
516  explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps );
517 };
518 
519 
520 struct ASCH_PORT
521 {
523 
524  wxString name;
525  wxString harnessType;
526 
527  wxPoint location;
528  int width;
529  int height;
530 
533 
534  explicit ASCH_PORT( const std::map<wxString, wxString>& aProps );
535 };
536 
537 
539 {
540  wxPoint location;
541 
542  bool isActive;
544 
545  explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProps );
546 };
547 
548 
550 {
551  wxString text;
552 
553  wxPoint location;
554 
556 
557  explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
558 };
559 
560 
561 struct ASCH_BUS
562 {
565 
566  std::vector<wxPoint> points;
567 
568  explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
569 };
570 
571 
572 struct ASCH_WIRE
573 {
576 
577  std::vector<wxPoint> points;
578 
579  explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
580 };
581 
582 
584 {
586 
587  wxPoint location;
588 
589  explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
590 };
591 
592 
594 {
597 
598  wxString filename;
599  wxPoint location;
600  wxPoint corner;
601 
604 
605  explicit ASCH_IMAGE( const std::map<wxString, wxString>& aProps );
606 };
607 
608 
610 {
611  wxString fontname;
612 
613  int size;
614  int rotation;
615 
616  bool italic;
617  bool bold;
618  bool underline;
619 
620  explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId );
621 };
622 
623 
624 enum class ASCH_SHEET_SIZE
625 {
626  UNKNOWN = -1, // use A4
627 
628  A4 = 0, // 1150 × 760
629  A3 = 1, // 1550 × 1110
630  A2 = 2, // 2230 × 1570
631  A1 = 3, // 3150 × 2230
632  A0 = 4, // 4460 × 3150
633  A = 5, // 950 × 750
634  B = 6, // 1500 × 950
635  C = 7, // 2000 × 1500
636  D = 8, // 3200 × 2000
637  E = 9, // 4200 × 3200
638  LETTER = 10, // 1100 × 850
639  LEGAL = 11, // 1400 × 850
640  TABLOID = 12, // 1700 × 1100
641  ORCAD_A = 13, // 990 × 790
642  ORCAD_B = 14, // 1540 × 990
643  ORCAD_C = 15, // 2060 × 1560
644  ORCAD_D = 16, // 3260 × 2060
645  ORCAD_E = 17 // 4280 × 3280
646 };
647 
648 wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize );
649 
650 
652 {
653  LANDSCAPE = 0,
654  PORTRAIT = 1
655 };
656 
657 
659 {
660  std::vector<ASCH_SHEET_FONT> fonts;
661 
664 
665  explicit ASCH_SHEET( const std::map<wxString, wxString>& aProps );
666 };
667 
668 
670 {
673 
674  wxString text;
675 
677  wxPoint location;
678 
679  bool isHidden;
680 
681  explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps );
682 };
683 
684 
686 {
689 
690  wxString text;
691 
693  wxPoint location;
694 
695  bool isHidden;
696 
697  explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps );
698 };
699 
700 
702 {
705 
706  wxString name;
707  wxString text;
708 
711  wxPoint location;
712 
713  explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
714 };
715 
716 
718 {
720 
721  wxString name;
722  wxString type;
723  wxString libname;
724 
725  bool isCurrent;
726 
727  explicit ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps );
728 };
729 
730 
732 {
734  explicit ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps );
735 };
736 
737 
739 {
740  wxPoint location;
741  wxPoint corner;
742 
743  explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
744 };
745 
746 
748 {
751 
752  wxPoint location;
755 
756  wxString name;
757  wxString text;
758 
759  bool isHidden;
762 
763  explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProps );
764 };
765 
766 #endif //ALTIUM_PARSER_SCH_H
wxPoint location
wxString sourcelibraryname
ASCH_PORT_IOTYPE
wxString text
ASCH_RECORD_ORIENTATION orientation
std::vector< char > data
int distanceFromTop
ASCH_IMAGE(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_FONT(const std::map< wxString, wxString > &aProps, int aId)
ASCH_PARAMETER(const std::map< wxString, wxString > &aProps)
ASCH_JUNCTION(const std::map< wxString, wxString > &aProps)
ASCH_PORT_IOTYPE iotype
wxString harnessType
std::vector< wxPoint > points
ASCH_LABEL_JUSTIFICATION
ASCH_LABEL_JUSTIFICATION justification
int ownerpartdisplaymode
wxString filename
ASCH_PIN_SYMBOL_OUTER
ASCH_POWER_PORT_STYLE style
ASCH_PORT_STYLE style
ASCH_TEXT_FRAME_ALIGNMENT
ASCH_IMPLEMENTATION(const std::map< wxString, wxString > &aProps)
wxPoint corner
ASCH_POLYLINE_LINESTYLE
std::chrono::steady_clock CLOCK
ASCH_SHEET(const std::map< wxString, wxString > &aProps)
ASCH_FILE_NAME(const std::map< wxString, wxString > &aProps)
ASCH_RECTANGLE(const std::map< wxString, wxString > &aProps)
ASCH_BEZIER(const std::map< wxString, wxString > &aProps)
wxPoint kicadLocation
ASCH_RECORD_ORIENTATION orientation
ASCH_STORAGE_FILE(ALTIUM_PARSER &aReader)
ASCH_NOTE(const std::map< wxString, wxString > &aProperties)
ASCH_LABEL(const std::map< wxString, wxString > &aProps)
ASCH_POLYGON(const std::map< wxString, wxString > &aProps)
wxPoint location
int ownerpartid
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN_SYMBOL_OUTEREDGE
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN(const std::map< wxString, wxString > &aProps)
wxString libreference
int ownerindex
ASCH_WIRE(const std::map< wxString, wxString > &aProps)
ASCH_RECORD_ORIENTATION
ASCH_SHEET_NAME(const std::map< wxString, wxString > &aProps)
std::vector< wxPoint > points
ASCH_SHEET_SYMBOL(const std::map< wxString, wxString > &aProps)
ASCH_LINE(const std::map< wxString, wxString > &aProps)
Represent basic circle geometry with utility geometry functions.
Definition: circle.h:32
int ownerpartdisplaymode
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN_ELECTRICAL
ASCH_BUS_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_BUS(const std::map< wxString, wxString > &aProps)
ASCH_POWER_PORT(const std::map< wxString, wxString > &aProps)
wxString name
std::vector< wxPoint > points
ASCH_RECORD_ORIENTATION orientation
ASCH_PORT(const std::map< wxString, wxString > &aProps)
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
ASCH_POLYLINE(const std::map< wxString, wxString > &aProps)
ASCH_DESIGNATOR(const std::map< wxString, wxString > &aProps)
wxString designator
ASCH_TEXT_FRAME(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_WORKSPACEORIENTATION
ASCH_PORT_IOTYPE iotype
ASCH_PIN_SYMBOL_INNER
ASCH_SHEET_ENTRY(const std::map< wxString, wxString > &aProps)
ASCH_PORT_STYLE
ASCH_ARC(const std::map< wxString, wxString > &aProps)
ASCH_SHEET_SIZE sheetSize
ASCH_SHEET_ENTRY_SIDE side
ASCH_RECORD_ORIENTATION orientation
double startAngle
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
wxString author
ASCH_NO_ERC(const std::map< wxString, wxString > &aProps)
ASCH_IMPLEMENTATION_LIST(const std::map< wxString, wxString > &aProps)
Manage an 8-bit channel image.
Definition: image.h:89
std::vector< ASCH_SHEET_FONT > fonts
ASCH_TEXT_FRAME_ALIGNMENT alignment
ASCH_POLYLINE_LINESTYLE linestyle
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
wxPoint location
ASCH_SYMBOL(const std::map< wxString, wxString > &aProps)
const int ALTIUM_COMPONENT_NONE
std::vector< wxPoint > points
ASCH_POWER_PORT_STYLE
ASCH_SHEET_SIZE
ASCH_PIN_SYMBOL_INNEREDGE
int ownerpartdisplaymode
ASCH_PORT_STYLE style
ASCH_PIN_ELECTRICAL electrical
wxPoint center
ASCH_NET_LABEL(const std::map< wxString, wxString > &aProps)
wxPoint ASchSheetGetSize(ASCH_SHEET_SIZE aSheetSize)
ASCH_PIN_SYMBOL_OUTER symbolOuter
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ALTIUM_SCH_RECORD
ASCH_LABEL_JUSTIFICATION justification
ASCH_SHEET_WORKSPACEORIENTATION sheetOrientation
wxString componentdescription
ASCH_LABEL_JUSTIFICATION justification
This item represents a bus vector.
ASCH_SHEET_ENTRY_SIDE
std::vector< wxPoint > points
wxString name
ASCH_ROUND_RECTANGLE(const std::map< wxString, wxString > &aProps)