KiCad PCB EDA Suite
altium_parser_sch.cpp
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) 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#include <iostream>
26#include <unordered_map>
27
28#include <base_units.h>
29#include <ki_exception.h>
30
31#include <wx/log.h>
32
35
36
37ALTIUM_SCH_RECORD ReadRecord( const std::map<wxString, wxString>& aProps )
38{
39 int recordId = ALTIUM_PARSER::ReadInt( aProps, "RECORD", 0 );
40 return static_cast<ALTIUM_SCH_RECORD>( recordId );
41}
42
43
44constexpr int Altium2KiCadUnit( const int val, const int frac )
45{
46 constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
47
48 double dbase = 10 * schIUScale.MilsToIU( val );
49 double dfrac = schIUScale.MilsToIU( frac ) / 10000.0;
50
51 return KiROUND( Clamp<double>( -int_limit, ( dbase + dfrac ) / 10.0, int_limit ) ) * 10;
52}
53
54
55int ReadKiCadUnitFrac( const std::map<wxString, wxString>& aProps, const wxString& aKey )
56{
57 // a unit is stored using two fields, denoting the size in mils and a fraction size
58 int key = ALTIUM_PARSER::ReadInt( aProps, aKey, 0 );
59 int keyFrac = ALTIUM_PARSER::ReadInt( aProps, aKey + "_FRAC", 0 );
60 return Altium2KiCadUnit( key, keyFrac );
61}
62
63
64int ReadKiCadUnitFrac1( const std::map<wxString, wxString>& aProps, const wxString& aKey )
65{
66 // a unit is stored using two fields, denoting the size in mils and a fraction size
67 // Dunno why Altium invents different units for the same purpose
68 int key = ALTIUM_PARSER::ReadInt( aProps, aKey, 0 );
69 int keyFrac = ALTIUM_PARSER::ReadInt( aProps, aKey + "_FRAC1", 0 );
70 return Altium2KiCadUnit( key * 10, keyFrac );
71}
72
73
74int ReadOwnerIndex( const std::map<wxString, wxString>& aProperties )
75{
76 return ALTIUM_PARSER::ReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
77}
78
79
80int ReadOwnerPartId( const std::map<wxString, wxString>& aProperties )
81{
82 return ALTIUM_PARSER::ReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
83}
84
85
86template <typename T>
87T ReadEnum( const std::map<wxString, wxString>& aProps, const wxString& aKey, int aLower,
88 int aUpper, T aDefault )
89{
90 int value = ALTIUM_PARSER::ReadInt( aProps, aKey, static_cast<int>( aDefault ) );
91
92 if( value < aLower || value > aUpper )
93 return aDefault;
94 else
95 return static_cast<T>( value );
96}
97
98
100{
101 aReader.Skip( 5 );
102 filename = aReader.ReadWxString();
103 uint32_t dataSize = aReader.Read<uint32_t>();
104 data = aReader.ReadVector( dataSize );
105
106 if( aReader.HasParsingError() )
107 THROW_IO_ERROR( "Storage stream was not parsed correctly" );
108}
109
110
112{
113 aReader.Skip( 5 );
114 FileName = aReader.ReadWxString();
115 uint32_t dataSize = aReader.Read<uint32_t>();
116 Data = aReader.ReadVector( dataSize );
117
118 if( aReader.HasParsingError() )
119 THROW_IO_ERROR( "Additional stream was not parsed correctly" );
120}
121
122
123ASCH_SYMBOL::ASCH_SYMBOL( const std::map<wxString, wxString>& aProps )
124{
125 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::COMPONENT );
126
127 currentpartid = ALTIUM_PARSER::ReadInt( aProps, "CURRENTPARTID", ALTIUM_COMPONENT_NONE );
128 libreference = ALTIUM_PARSER::ReadString( aProps, "LIBREFERENCE", "" );
129 sourcelibraryname = ALTIUM_PARSER::ReadString( aProps, "SOURCELIBRARYNAME", "" );
130 componentdescription = ALTIUM_PARSER::ReadString( aProps, "COMPONENTDESCRIPTION", "" );
131
132 orientation = ALTIUM_PARSER::ReadInt( aProps, "ORIENTATION", 0 );
133 isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
134 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
135 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
136
137 partcount = ALTIUM_PARSER::ReadInt( aProps, "PARTCOUNT", 0 );
138 displaymodecount = ALTIUM_PARSER::ReadInt( aProps, "DISPLAYMODECOUNT", 0 );
139 m_indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", -1 );
140 displaymode = ALTIUM_PARSER::ReadInt( aProps, "DISPLAYMODE", 0 );
141}
142
143
144ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProps )
145{
146 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PIN );
147
148 ownerindex = ReadOwnerIndex( aProps );
149 ownerpartid = ReadOwnerPartId( aProps );
150 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
151
152 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
153 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
154 designator = ALTIUM_PARSER::ReadString( aProps, "DESIGNATOR", "" );
155
156 int symbolOuterInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTER", 0 );
157 symbolOuter = static_cast<ASCH_PIN_SYMBOL_OUTER>( symbolOuterInt );
158
159 int symbolInnerInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNER", 0 );
160 symbolInner = static_cast<ASCH_PIN_SYMBOL_INNER>( symbolInnerInt );
161
162 int symbolOuterEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTEREDGE", 0 );
163 symbolOuterEdge = ( symbolOuterEdgeInt == 0 || symbolOuterEdgeInt == 1
164 || symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
165 static_cast<ASCH_PIN_SYMBOL_OUTEREDGE>( symbolOuterEdgeInt ) :
167
168 int symbolInnerEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNEREDGE", 0 );
169 symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
170 static_cast<ASCH_PIN_SYMBOL_INNEREDGE>( symbolInnerEdgeInt ) :
172 electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps, "ELECTRICAL", 0, 7,
174
175 int pinconglomerate = ALTIUM_PARSER::ReadInt( aProps, "PINCONGLOMERATE", 0 );
176
177 orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
178 showPinName = ( pinconglomerate & 0x08 ) != 0;
179 showDesignator = ( pinconglomerate & 0x10 ) != 0;
180
181 int x = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X", 0 );
182 int xfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X_FRAC", 0 );
183 int y = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y", 0 );
184 int yfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y_FRAC", 0 );
185 location = VECTOR2I( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
186
187 int p = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH", 0 );
188 int pfrac = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH_FRAC", 0 );
189 pinlength = Altium2KiCadUnit( p, pfrac );
190
191 // this code calculates the location as required by KiCad without rounding error attached
192 int kicadX = x;
193 int kicadXfrac = xfrac;
194 int kicadY = y;
195 int kicadYfrac = yfrac;
196
197 switch( orientation )
198 {
200 kicadX += p;
201 kicadXfrac += pfrac;
202 break;
203
205 kicadY += p;
206 kicadYfrac += pfrac;
207 break;
208
210 kicadX -= p;
211 kicadXfrac -= pfrac;
212 break;
213
215 kicadY -= p;
216 kicadYfrac -= pfrac;
217 break;
218
219 default:
220 wxLogWarning( "Pin has unexpected orientation" );
221 break;
222 }
223
224 kicadLocation = VECTOR2I( Altium2KiCadUnit( kicadX, kicadXfrac ),
225 -Altium2KiCadUnit( kicadY, kicadYfrac ) );
226}
227
228
229ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProps )
230{
231 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LABEL );
232
233 ownerindex = ReadOwnerIndex( aProps );
234 ownerpartid = ReadOwnerPartId( aProps );
235
236 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
237 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
238
239 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
240
241 fontId = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
242 isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
243
244 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
246
247 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
249}
250
251
252ASCH_TEXT_FRAME::ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps )
253{
254 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NOTE
256
257 BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
258 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
259 TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
260 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
261
262 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
263 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
264 Size = wxSize( ReadKiCadUnitFrac( aProps, "CORNER.X" ) - Location.x,
265 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) - Location.y );
266
267 Text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
268 Text.Replace( "~1", "\n", true );
269
270 FontID = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
271 IsWordWrapped = ALTIUM_PARSER::ReadBool( aProps, "WORDWRAP", false );
272 ShowBorder = ALTIUM_PARSER::ReadBool( aProps, "SHOWBORDER", false );
273 TextMargin = ReadKiCadUnitFrac( aProps, "TEXTMARGIN" );
274 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
275 BorderColor = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
276
277 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "WORDWRAP", true );
278
279 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
281}
282
283
284ASCH_NOTE::ASCH_NOTE( const std::map<wxString, wxString>& aProperties ) :
285 ASCH_TEXT_FRAME( aProperties )
286{
287 wxASSERT( ReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NOTE );
288
289 author = ALTIUM_PARSER::ReadString( aProperties, "AUTHOR", "" );
290}
291
292
293ASCH_BEZIER::ASCH_BEZIER( const std::map<wxString, wxString>& aProps )
294{
295 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BEZIER );
296
297 ownerindex = ReadOwnerIndex( aProps );
298 ownerpartid = ReadOwnerPartId( aProps );
299 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
300
301 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
302
303 for( int i = 1; i <= locationCount; i++ )
304 {
305 const wxString si = std::to_string( i );
306 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
307 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
308 }
309
310 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
311}
312
313
314ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& aProps )
315{
316 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYLINE );
317
318 OwnerIndex = ReadOwnerIndex( aProps );
319 OwnerPartID = ReadOwnerPartId( aProps );
320 OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
321
322 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
323
324 for( int i = 1; i <= locationCount; i++ )
325 {
326 const wxString si = std::to_string( i );
327 Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
328 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
329 }
330
331 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
332 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
333
334 int linestyleVar = ALTIUM_PARSER::ReadInt( aProps, "LINESTYLEEXT", 0 );
335
336 // overwrite if present.
337 linestyleVar = ALTIUM_PARSER::ReadInt( aProps, "LINESTYLE", linestyleVar );
338 LineStyle = linestyleVar >= 0 && linestyleVar <= 3 ?
339 static_cast<ASCH_POLYLINE_LINESTYLE>( linestyleVar ) :
341}
342
343
344ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProps )
345{
346 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYGON );
347
348 OwnerIndex = ReadOwnerIndex( aProps );
349 OwnerPartID = ReadOwnerPartId( aProps );
350 OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
351
352 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
353
354 for( int i = 1; i <= locationCount; i++ )
355 {
356 const wxString si = std::to_string( i );
357 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
358 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
359 }
360
361 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
362 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
363
364 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
365 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
366}
367
368
369ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps )
370{
371 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
372
373 OwnerIndex = ReadOwnerIndex( aProps );
374 OwnerPartID = ReadOwnerPartId( aProps );
375 OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
376
377 BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
378 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
379 TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
380 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
381
382 CornerRadius = wxSize( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ),
383 -ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) );
384
385 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
386 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
387 IsTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false );
388
389 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
390 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
391}
392
393
394ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProps )
395{
397 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ARC || m_IsElliptical );
398
399 ownerindex = ReadOwnerIndex( aProps );
400 ownerpartid = ReadOwnerPartId( aProps );
401 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
402
403 m_Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
404 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
405 m_Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
407
408 if( m_IsElliptical )
409 m_SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
410
411 m_StartAngle = ALTIUM_PARSER::ReadDouble( aProps, "STARTANGLE", 0 );
412 m_EndAngle = ALTIUM_PARSER::ReadDouble( aProps, "ENDANGLE", 0 );
413
414 m_LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
415}
416
417
418ASCH_ELLIPSE::ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps )
419{
420 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ELLIPSE );
421
422 OwnerIndex = ReadOwnerIndex( aProps );
423 OwnerPartID = ReadOwnerPartId( aProps );
424
425 Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
426 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
427
428 Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
429 SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
430
431 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
432 IsNotAccesible = ALTIUM_PARSER::ReadBool( aProps, "ISNOTACCESIBLE", false );
433 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
434}
435
436
437ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProps )
438{
439 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LINE );
440
441 ownerindex = ReadOwnerIndex( aProps );
442 ownerpartid = ReadOwnerPartId( aProps );
443 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
444
445 point1 = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
446 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
447 point2 = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
448 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
449
450 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
451}
452
453
454ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps )
455{
456 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SIGNAL_HARNESS );
457
458 OwnerPartID = ReadOwnerPartId( aProps );
459
460 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
461
462 for( int i = 1; i <= locationCount; i++ )
463 {
464 const wxString si = std::to_string( i );
465 Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
466 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
467 }
468
469 IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
470
471 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
472 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
473}
474
475
476ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps )
477{
478 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR );
479
480 OwnerPartID = ReadOwnerPartId( aProps );
481
482 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
483 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
484 Size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
485
486 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
487 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
488
489 IndexInSheet = 0;
490 LineWidth = 0;;
492}
493
494
495ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps )
496{
497 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_ENTRY );
498
499 // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead, because this property sometimes
500 // does not exist in altium file!
501 // ownerindex = ReadOwnerIndex( aProps );
502
503 OwnerPartID = ReadOwnerPartId( aProps );
504
505 IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
506
507 DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
508
509 Side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
510
511 Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
512
513 OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
514
515 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
516 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
517 TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
518 TextFontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
519 TextStyle = 0;
520}
521
522
523ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps )
524{
525 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE );
526
527 //ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
528 OwnerPartID = ReadOwnerPartId( aProps );
529
530 Text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
531
532 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
533 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
534
535 IsHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
536 OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
537
538 IndexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
539 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
540 FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
541}
542
543
544ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps )
545{
546 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
547
548 OwnerIndex = ReadOwnerIndex( aProps );
549 OwnerPartID = ReadOwnerPartId( aProps );
550 OwnerPartDisplayMode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
551
552 BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
553 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
554 TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
555 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
556
557 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
558 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
559 IsTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false );
560
561 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
562 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
563}
564
565
566ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps )
567{
568 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
569
570 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
571 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
572 size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ),
573 ReadKiCadUnitFrac( aProps, "YSIZE" ) );
574
575 isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
576
577 color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
578 areacolor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
579}
580
581
582ASCH_SHEET_ENTRY::ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps )
583{
584 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_ENTRY );
585
586 ownerindex = ReadOwnerIndex( aProps );
587 ownerpartid = ReadOwnerPartId( aProps );
588
589 // some magic, because it stores those infos in a different unit??
590 distanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
591
592 side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
593
594 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
595
596 iotype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
597 style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
598}
599
600
601ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps )
602{
603 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POWER_PORT );
604
605 ownerpartid = ReadOwnerPartId( aProps );
606
607 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
608 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
609
610 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
612
613 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
614 showNetName = ALTIUM_PARSER::ReadBool( aProps, "SHOWNETNAME", true );
615
616 style = ReadEnum<ASCH_POWER_PORT_STYLE>( aProps, "STYLE", 0, 10,
618}
619
620
621ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProps )
622{
623 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PORT );
624
625 OwnerPartID = ReadOwnerPartId( aProps );
626
627 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
628 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
629
630 Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
631 HarnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
632
633 Width = ReadKiCadUnitFrac( aProps, "WIDTH" );
634 Height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
635
636 IOtype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
637 Style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
638
639 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
640 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
641 FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
642 TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
643
644 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
646}
647
648
649ASCH_NO_ERC::ASCH_NO_ERC( const std::map<wxString, wxString>& aProps )
650{
651 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NO_ERC );
652
653 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
654 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
655
656 isActive = ALTIUM_PARSER::ReadBool( aProps, "ISACTIVE", true );
657 suppressAll = ALTIUM_PARSER::ReadInt( aProps, "SUPPRESSALL", true );
658}
659
660
661ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps )
662{
663 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NET_LABEL );
664
665 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
666
667 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
668 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
669
670 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
672}
673
674
675ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProps )
676{
677 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS );
678
679 indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
680
681 int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
682
683 for( int i = 1; i <= locationcount; i++ )
684 {
685 const wxString si = std::to_string( i );
686 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
687 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
688 }
689
690 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
691}
692
693
694ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProps )
695{
696 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::WIRE );
697
698 indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
699
700 int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
701
702 for( int i = 1; i <= locationcount; i++ )
703 {
704 const wxString si = std::to_string( i );
705 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
706 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
707 }
708
709 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
710}
711
712
713ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProps )
714{
715 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::JUNCTION );
716
717 ownerpartid = ReadOwnerPartId( aProps );
718
719 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
720 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
721}
722
723
724ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProps )
725{
726 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMAGE );
727
728 indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
729 ownerindex = ReadOwnerIndex( aProps );
730 ownerpartid = ReadOwnerPartId( aProps );
731
732 filename = ALTIUM_PARSER::ReadString( aProps, "FILENAME", "" );
733
734 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
735 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
736 corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
737 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
738
739 embedimage = ALTIUM_PARSER::ReadBool( aProps, "EMBEDIMAGE", false );
740 keepaspect = ALTIUM_PARSER::ReadBool( aProps, "KEEPASPECT", false );
741}
742
743
744ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId )
745{
746 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
747
748 const wxString sid = std::to_string( aId );
749
750 FontName = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" );
751
752 Size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
753 Rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 );
754
755 Italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false );
756 Bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + sid, false );
757 Underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false );
758
759 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR" + sid, 0 );
760}
761
762
764{
765 // From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
766 switch( aSheetSize )
767 {
768 default:
769 case ASCH_SHEET_SIZE::A4: return { 1150, 760 };
770 case ASCH_SHEET_SIZE::A3: return { 1550, 1110 };
771 case ASCH_SHEET_SIZE::A2: return { 2230, 1570 };
772 case ASCH_SHEET_SIZE::A1: return { 3150, 2230 };
773 case ASCH_SHEET_SIZE::A0: return { 4460, 3150 };
774 case ASCH_SHEET_SIZE::A: return { 950, 750 };
775 case ASCH_SHEET_SIZE::B: return { 1500, 950 };
776 case ASCH_SHEET_SIZE::C: return { 2000, 1500 };
777 case ASCH_SHEET_SIZE::D: return { 3200, 2000 };
778 case ASCH_SHEET_SIZE::E: return { 4200, 3200 };
779 case ASCH_SHEET_SIZE::LETTER: return { 1100, 850 };
780 case ASCH_SHEET_SIZE::LEGAL: return { 1400, 850 };
781 case ASCH_SHEET_SIZE::TABLOID: return { 1700, 1100 };
782 case ASCH_SHEET_SIZE::ORCAD_A: return { 990, 790 };
783 case ASCH_SHEET_SIZE::ORCAD_B: return { 1540, 990 };
784 case ASCH_SHEET_SIZE::ORCAD_C: return { 2060, 1560 };
785 case ASCH_SHEET_SIZE::ORCAD_D: return { 3260, 2060 };
786 case ASCH_SHEET_SIZE::ORCAD_E: return { 4280, 3280 };
787 }
788}
789
790
791ASCH_SHEET::ASCH_SHEET( const std::map<wxString, wxString>& aProps )
792{
793 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
794
795 int fontidcount = ALTIUM_PARSER::ReadInt( aProps, "FONTIDCOUNT", 0 );
796
797 for( int i = 1; i <= fontidcount; i++ )
798 fonts.emplace_back( aProps, i );
799
800 sheetSize = ReadEnum<ASCH_SHEET_SIZE>( aProps, "SHEETSTYLE", 0, 17, ASCH_SHEET_SIZE::A4 );
801 sheetOrientation = ReadEnum<ASCH_SHEET_WORKSPACEORIENTATION>(
802 aProps, "WORKSPACEORIENTATION", 0, 1, ASCH_SHEET_WORKSPACEORIENTATION::LANDSCAPE );
803}
804
805
806ASCH_SHEET_NAME::ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps )
807{
808 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_NAME );
809
810 ownerindex = ReadOwnerIndex( aProps );
811 ownerpartid = ReadOwnerPartId( aProps );
812
813 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
814
815 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
817
818 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
819 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
820
821 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
822}
823
824
825ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps )
826{
827 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::FILE_NAME );
828
829 ownerindex = ReadOwnerIndex( aProps );
830 ownerpartid = ReadOwnerPartId( aProps );
831
832 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
833
834 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
836
837 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
838 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
839
840 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
841}
842
843
844ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps )
845{
846 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::DESIGNATOR );
847
848 ownerindex = ReadOwnerIndex( aProps );
849 ownerpartid = ReadOwnerPartId( aProps );
850
851 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
852 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
853
854 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
856
857 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
859
860 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
861 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
862}
863
864
865ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps )
866{
867 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION );
868
870 name = ALTIUM_PARSER::ReadString( aProps, "MODELNAME", "" );
871 type = ALTIUM_PARSER::ReadString( aProps, "MODELTYPE", "" );
872 libname = ALTIUM_PARSER::ReadString( aProps, "MODELDATAFILE0", "" );
873 isCurrent = ALTIUM_PARSER::ReadBool( aProps, "ISCURRENT", false );
874}
875
876
877ASCH_IMPLEMENTATION_LIST::ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps )
878{
879 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST );
880
881 ownerindex = ReadOwnerIndex( aProps );
882}
883
884
885ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps )
886{
887 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS_ENTRY );
888
889 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
890 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
891 corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
892 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
893}
894
895
896ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProps )
897{
898 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PARAMETER );
899
900 ownerindex = ReadOwnerIndex( aProps );
901 ownerpartid = ReadOwnerPartId( aProps );
902
903 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
904 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
905
906 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
908
909 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
911
912 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
913 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
914
915 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
916 isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
917 isShowName = ALTIUM_PARSER::ReadBool( aProps, "SHOWNAME", false );
918}
int ReadOwnerPartId(const std::map< wxString, wxString > &aProperties)
int ReadOwnerIndex(const std::map< wxString, wxString > &aProperties)
T ReadEnum(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aLower, int aUpper, T aDefault)
constexpr int Altium2KiCadUnit(const int val, const int frac)
VECTOR2I ASchSheetGetSize(ASCH_SHEET_SIZE aSheetSize)
int ReadKiCadUnitFrac1(const std::map< wxString, wxString > &aProps, const wxString &aKey)
int ReadKiCadUnitFrac(const std::map< wxString, wxString > &aProps, const wxString &aKey)
ALTIUM_SCH_RECORD ReadRecord(const std::map< wxString, wxString > &aProps)
ASCH_PIN_SYMBOL_INNER
ALTIUM_SCH_RECORD
ASCH_RECORD_ORIENTATION
ASCH_PIN_SYMBOL_INNEREDGE
const int ALTIUM_COMPONENT_NONE
ASCH_PIN_SYMBOL_OUTER
ASCH_POLYLINE_LINESTYLE
ASCH_SHEET_SIZE
ASCH_PIN_SYMBOL_OUTEREDGE
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
wxString ReadWxString()
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
bool HasParsingError()
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
std::vector< char > ReadVector(size_t aSize)
static double ReadDouble(const std::map< wxString, wxString > &aProps, const wxString &aKey, double aDefault)
static bool ReadBool(const std::map< wxString, wxString > &aProps, const wxString &aKey, bool aDefault)
void Skip(size_t aLength)
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
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
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618