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 <thomas.pointhuber@gmx.at>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef ALTIUM_PARSER_SCH_H
25 #define ALTIUM_PARSER_SCH_H
26 
27 #include <cstdint>
28 #include <cstring>
29 #include <map>
30 #include <vector>
31 
32 #include <wx/gdicmn.h>
33 #include <wx/string.h>
34 
35 // this constant specifies a item which is not inside an component
36 const int ALTIUM_COMPONENT_NONE = -1;
37 
39 {
40  HEADER = 0,
41  COMPONENT = 1,
42  PIN = 2,
43  IEEE_SYMBOL = 3,
44  LABEL = 4,
45  BEZIER = 5,
46  POLYLINE = 6,
47  POLYGON = 7,
48  ELLIPSE = 8,
49  PIECHART = 9,
50  ROUND_RECTANGLE = 10,
51  ELLIPTICAL_ARC = 11,
52  ARC = 12,
53  LINE = 13,
54  RECTANGLE = 14,
55  SHEET_SYMBOL = 15,
56  SHEET_ENTRY = 16,
57  POWER_PORT = 17,
58  PORT = 18,
59  NO_ERC = 22,
60  NET_LABEL = 25,
61  BUS = 26,
62  WIRE = 27,
63  TEXT_FRAME = 28,
64  JUNCTION = 29,
65  IMAGE = 30,
66  SHEET = 31,
67  SHEET_NAME = 32,
68  FILE_NAME = 33,
69  DESIGNATOR = 34,
70  BUS_ENTRY = 37,
71  TEMPLATE = 39,
72  PARAMETER = 41,
73  WARNING_SIGN = 43,
75  IMPLEMENTATION = 45,
76  RECORD_46 = 46,
77  RECORD_47 = 47,
78  RECORD_48 = 48,
79  RECORD_209 = 209,
80  RECORD_215 = 215,
81  RECORD_216 = 216,
82  RECORD_217 = 217,
83  RECORD_218 = 218,
84  RECORD_226 = 226,
85 };
86 
87 
89 {
90  RIGHTWARDS = 0,
91  UPWARDS = 1,
92  LEFTWARDS = 2,
93  DOWNWARDS = 3
94 };
95 
96 
98 {
100  wxString libreference;
103 
106  wxPoint location;
107 
111 
112  explicit ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties );
113 };
114 
115 
117 {
118  UNKNOWN = -1,
119  NO_SYMBOL = 0,
121  ANALOG_SIGNAL_IN = 5,
123  DIGITAL_SIGNAL_IN = 25,
125  BIDI_SIGNAL_FLOW = 34
126 };
127 
128 
130 {
131  UNKNOWN = -1,
132  NO_SYMBOL = 0,
133  POSPONED_OUTPUT = 8,
134  OPEN_COLLECTOR = 9,
135  HIZ = 10,
136  HIGH_CURRENT = 11,
137  PULSE = 12,
138  SCHMITT = 13,
140  OPEN_EMITTER = 23,
142  SHIFT_LEFT = 30,
143  OPEN_OUTPUT = 32
144 };
145 
146 
148 {
149  UNKNOWN = -1,
150  NO_SYMBOL = 0,
151  NEGATED = 1,
152  LOW_INPUT = 4,
153  LOW_OUTPUT = 17
154 };
155 
156 
158 {
159  UNKNOWN = -1,
160  NO_SYMBOL = 0,
161  CLOCK = 3,
162 };
163 
164 
166 {
167  UNKNOWN = -1,
168 
169  INPUT = 0,
170  BIDI = 1,
171  OUTPUT = 2,
172  OPEN_COLLECTOR = 3,
173  PASSIVE = 4,
174  TRISTATE = 5,
175  OPEN_EMITTER = 6,
176  POWER = 7
177 };
178 
179 
180 struct ASCH_PIN
181 {
185 
186  wxString name;
187  wxString text;
188  wxString designator;
189 
192 
195 
198 
199  wxPoint location;
201 
202  wxPoint kicadLocation; // location of pin in KiCad without rounding error
203 
206 
207  explicit ASCH_PIN( const std::map<wxString, wxString>& aProperties );
208 };
209 
210 
212 {
213  UNKNOWN = -1,
214 
215  BOTTOM_LEFT = 0,
216  BOTTOM_CENTER = 1,
217  BOTTOM_RIGHT = 2,
218  CENTER_LEFT = 3,
219  CENTER_CENTER = 4,
220  CENTER_RIGHT = 5,
221  TOP_LEFT = 6,
222  TOP_CENTER = 7,
223  TOP_RIGHT = 8
224 };
225 
226 
228 {
231 
232  wxPoint location;
233 
234  wxString text;
235 
236  int fontId;
238 
240 
241  explicit ASCH_LABEL( const std::map<wxString, wxString>& aProperties );
242 };
243 
244 
246 {
250 
251  std::vector<wxPoint> points;
252 
254 
255  explicit ASCH_BEZIER( const std::map<wxString, wxString>& aProperties );
256 };
257 
258 
260 {
261  SOLID = 0,
262  DASHED = 1,
263  DOTTED = 2,
264  DASH_DOTTED = 3
265 };
266 
267 
269 {
273 
274  std::vector<wxPoint> points;
275 
277 
279 
280  explicit ASCH_POLYLINE( const std::map<wxString, wxString>& aProperties );
281 };
282 
283 
285 {
289 
290  std::vector<wxPoint> points;
291 
293  bool isSolid;
294 
295  int color;
297 
298  explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProperties );
299 };
300 
301 
303 {
307 
308  wxPoint bottomLeft;
309  wxPoint topRight;
310 
311  wxSize cornerradius;
312 
314  bool isSolid;
316 
317  int color;
319 
320  explicit ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProperties );
321 };
322 
323 
324 struct ASCH_ARC
325 {
329 
330  wxPoint center;
331  int radius;
332  double startAngle;
333  double endAngle;
334 
336 
337  explicit ASCH_ARC( const std::map<wxString, wxString>& aProperties );
338 };
339 
340 
341 struct ASCH_LINE
342 {
346 
347  wxPoint point1;
348  wxPoint point2;
349 
351 
352  explicit ASCH_LINE( const std::map<wxString, wxString>& aProperties );
353 };
354 
355 
357 {
361 
362  wxPoint bottomLeft;
363  wxPoint topRight;
364 
366  bool isSolid;
368 
369  int color;
371 
372  explicit ASCH_RECTANGLE( const std::map<wxString, wxString>& aProperties );
373 };
374 
375 
377 {
378  wxPoint location;
379  wxSize size;
380 
381  bool isSolid;
382 
383  int color;
385 
386  explicit ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProperties );
387 };
388 
389 
391 {
392  LEFT = 0,
393  RIGHT = 1,
394  TOP = 2,
395  BOTTOM = 3
396 };
397 
398 
400 {
401  UNSPECIFIED = 0,
402  OUTPUT = 1,
403  INPUT = 2,
404  BIDI = 3,
405 };
406 
407 
408 enum class ASCH_PORT_STYLE
409 {
410  NONE_HORIZONTAL = 0,
411  LEFT = 1,
412  RIGHT = 2,
413  LEFT_RIGHT = 3,
414  NONE_VERTICAL = 4,
415  TOP = 5,
416  BOTTOM = 6,
417  TOP_BOTTOM = 7
418 };
419 
420 
422 {
425 
427 
431 
432  wxString name;
433 
434  explicit ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProperties );
435 };
436 
437 
439 {
440  UNKNOWN = -1,
441 
442  CIRCLE = 0,
443  ARROW = 1,
444  BAR = 2,
445  WAVE = 3,
446  POWER_GROUND = 4,
447  SIGNAL_GROUND = 5,
448  EARTH = 6,
449  GOST_ARROW = 7,
450  GOST_POWER_GROUND = 8,
451  GOST_EARTH = 9,
452  GOST_BAR = 10
453 };
454 
455 
457 {
459 
460  wxString text;
462 
463  wxPoint location;
466 
467  explicit ASCH_POWER_PORT( const std::map<wxString, wxString>& aProperties );
468 };
469 
470 
471 struct ASCH_PORT
472 {
474 
475  wxString name;
476 
477  wxPoint location;
478  int width;
479  int height;
480 
483 
484  explicit ASCH_PORT( const std::map<wxString, wxString>& aProperties );
485 };
486 
487 
489 {
490  wxPoint location;
491 
492  bool isActive;
494 
495  explicit ASCH_NO_ERC( const std::map<wxString, wxString>& aProperties );
496 };
497 
498 
500 {
501  wxString text;
502 
503  wxPoint location;
504 
506 
507  explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProperties );
508 };
509 
510 
511 struct ASCH_BUS
512 {
515 
516  std::vector<wxPoint> points;
517 
518  explicit ASCH_BUS( const std::map<wxString, wxString>& aProperties );
519 };
520 
521 
522 struct ASCH_WIRE
523 {
526 
527  std::vector<wxPoint> points;
528 
529  explicit ASCH_WIRE( const std::map<wxString, wxString>& aProperties );
530 };
531 
532 
534 {
536 
537  wxPoint location;
538 
539  explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProperties );
540 };
541 
542 
544 {
545  wxString fontname;
546 
547  int size;
548  int rotation;
549 
550  bool italic;
551  bool bold;
552  bool underline;
553 
554  explicit ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProperties, int aId );
555 };
556 
557 
558 enum class ASCH_SHEET_SIZE
559 {
560  UNKNOWN = -1, // use A4
561 
562  A4 = 0, // 1150 × 760
563  A3 = 1, // 1550 × 1110
564  A2 = 2, // 2230 × 1570
565  A1 = 3, // 3150 × 2230
566  A0 = 4, // 4460 × 3150
567  A = 5, // 950 × 750
568  B = 6, // 1500 × 950
569  C = 7, // 2000 × 1500
570  D = 8, // 3200 × 2000
571  E = 9, // 4200 × 3200
572  LETTER = 10, // 1100 × 850
573  LEGAL = 11, // 1400 × 850
574  TABLOID = 12, // 1700 × 1100
575  ORCAD_A = 13, // 990 × 790
576  ORCAD_B = 14, // 1540 × 990
577  ORCAD_C = 15, // 2060 × 1560
578  ORCAD_D = 16, // 3260 × 2060
579  ORCAD_E = 17 // 4280 × 3280
580 };
581 
582 wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize );
583 
584 
586 {
587  LANDSCAPE = 0,
588  PORTRAIT = 1
589 };
590 
591 
593 {
594  std::vector<ASCH_SHEET_FONT> fonts;
595 
598 
599  explicit ASCH_SHEET( const std::map<wxString, wxString>& aProperties );
600 };
601 
602 
604 {
607 
608  wxString text;
609 
611  wxPoint location;
612 
613  bool isHidden;
614 
615  explicit ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProperties );
616 };
617 
618 
620 {
623 
624  wxString text;
625 
627  wxPoint location;
628 
629  bool isHidden;
630 
631  explicit ASCH_FILE_NAME( const std::map<wxString, wxString>& aProperties );
632 };
633 
634 
636 {
639 
640  wxString name;
641  wxString text;
642 
644  wxPoint location;
645 
646  explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProperties );
647 };
648 
649 
651 {
652  wxPoint location;
653  wxPoint corner;
654 
655  explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProperties );
656 };
657 
658 
660 {
663 
664  wxPoint location;
666 
667  wxString name;
668  wxString text;
669 
670  bool isHidden;
673 
674  explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProperties );
675 };
676 
677 #endif //ALTIUM_PARSER_SCH_H
wxPoint location
ASCH_SHEET_NAME(const std::map< wxString, wxString > &aProperties)
ASCH_PORT_IOTYPE
ASCH_SHEET_SYMBOL(const std::map< wxString, wxString > &aProperties)
wxString text
ASCH_RECORD_ORIENTATION orientation
ASCH_POLYGON(const std::map< wxString, wxString > &aProperties)
ASCH_RECTANGLE(const std::map< wxString, wxString > &aProperties)
int distanceFromTop
ASCH_JUNCTION(const std::map< wxString, wxString > &aProperties)
ASCH_BUS(const std::map< wxString, wxString > &aProperties)
ASCH_DESIGNATOR(const std::map< wxString, wxString > &aProperties)
ASCH_PORT_IOTYPE iotype
std::vector< wxPoint > points
ASCH_LABEL_JUSTIFICATION
ASCH_LABEL_JUSTIFICATION justification
int ownerpartdisplaymode
ASCH_PARAMETER(const std::map< wxString, wxString > &aProperties)
ASCH_PIN_SYMBOL_OUTER
ASCH_POWER_PORT_STYLE style
ASCH_PORT_STYLE style
wxPoint corner
ASCH_POLYLINE_LINESTYLE
std::chrono::steady_clock CLOCK
wxPoint kicadLocation
ASCH_NO_ERC(const std::map< wxString, wxString > &aProperties)
ASCH_RECORD_ORIENTATION orientation
ASCH_COMPONENT(const std::map< wxString, wxString > &aProperties)
wxPoint location
int ownerpartid
ASCH_ROUND_RECTANGLE(const std::map< wxString, wxString > &aProperties)
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN_SYMBOL_OUTEREDGE
ASCH_SHEET_ENTRY(const std::map< wxString, wxString > &aProperties)
ASCH_RECORD_ORIENTATION orientation
ASCH_WIRE(const std::map< wxString, wxString > &aProperties)
int ownerindex
ASCH_RECORD_ORIENTATION
std::vector< wxPoint > points
ASCH_FILE_NAME(const std::map< wxString, wxString > &aProperties)
ASCH_PIN(const std::map< wxString, wxString > &aProperties)
Class Circle Represents basic circle geometry with utility geometry functions.
Definition: circle.h:33
int ownerpartdisplaymode
ASCH_RECORD_ORIENTATION orientation
ASCH_PIN_ELECTRICAL
ASCH_SHEET(const std::map< wxString, wxString > &aProperties)
wxString name
std::vector< wxPoint > points
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:83
ASCH_BEZIER(const std::map< wxString, wxString > &aProperties)
wxString designator
ASCH_SHEET_WORKSPACEORIENTATION
ASCH_PORT_IOTYPE iotype
wxString componentdescription
ASCH_SHEET_FONT(const std::map< wxString, wxString > &aProperties, int aId)
ASCH_PIN_SYMBOL_INNER
ASCH_PORT_STYLE
ASCH_LABEL(const std::map< wxString, wxString > &aProperties)
ASCH_SHEET_SIZE sheetSize
ASCH_SHEET_ENTRY_SIDE side
Definition: track.h:262
ASCH_RECORD_ORIENTATION orientation
double startAngle
ASCH_PIN_SYMBOL_OUTEREDGE symbolOuterEdge
wxString sourcelibraryname
Manage an 8-bit channel image.
Definition: image.h:89
std::vector< ASCH_SHEET_FONT > fonts
ASCH_POLYLINE_LINESTYLE linestyle
ASCH_PIN_SYMBOL_INNER symbolInner
ASCH_RECORD_ORIENTATION orientation
wxPoint location
ASCH_BUS_ENTRY(const std::map< wxString, wxString > &aProperties)
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_PORT(const std::map< wxString, wxString > &aProperties)
ASCH_PIN_ELECTRICAL electrical
wxPoint center
ASCH_ARC(const std::map< wxString, wxString > &aProperties)
wxPoint ASchSheetGetSize(ASCH_SHEET_SIZE aSheetSize)
ASCH_PIN_SYMBOL_OUTER symbolOuter
ASCH_NET_LABEL(const std::map< wxString, wxString > &aProperties)
ASCH_PIN_SYMBOL_INNEREDGE symbolInnerEdge
ALTIUM_SCH_RECORD
ASCH_SHEET_WORKSPACEORIENTATION sheetOrientation
ASCH_LINE(const std::map< wxString, wxString > &aProperties)
ASCH_POLYLINE(const std::map< wxString, wxString > &aProperties)
This item represents a bus vector.
ASCH_SHEET_ENTRY_SIDE
std::vector< wxPoint > points
wxString name
ASCH_POWER_PORT(const std::map< wxString, wxString > &aProperties)