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