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 (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 ASCH_OWNER_INTERFACE( aProps )
146{
147 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PIN );
148
149 isKiCadLibPin = ALTIUM_PARSER::ReadBool( aProps, "ISKICADLIBPIN", false );
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 = ASCH_PIN_SYMBOL::FromInt( symbolOuterInt );
158
159 int symbolInnerInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNER", 0 );
160 symbolInner = ASCH_PIN_SYMBOL::FromInt( symbolInnerInt );
161
162 int symbolOuterEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_OUTEREDGE", 0 );
163 symbolOuterEdge = ASCH_PIN_SYMBOL::FromInt( symbolOuterEdgeInt );
164
165 int symbolInnerEdgeInt = ALTIUM_PARSER::ReadInt( aProps, "SYMBOL_INNEREDGE", 0 );
166 symbolInnerEdge = ASCH_PIN_SYMBOL::FromInt( symbolInnerEdgeInt );
167
168 electrical = ReadEnum<ASCH_PIN_ELECTRICAL>( aProps, "ELECTRICAL", 0, 7,
169 ASCH_PIN_ELECTRICAL::INPUT );
170
171 int pinconglomerate = ALTIUM_PARSER::ReadInt( aProps, "PINCONGLOMERATE", 0 );
172
173 orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
174 hidden = ( pinconglomerate & 0x04 ) != 0;
175 showPinName = ( pinconglomerate & 0x08 ) != 0;
176 showDesignator = ( pinconglomerate & 0x10 ) != 0;
177 // 0x20 is unknown
178 locked = ( pinconglomerate & 0x40 ) != 0;
179
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 int offsetY = p;
198 int offsetYfrac = pfrac;
199
200 if( isKiCadLibPin )
201 {
202 offsetY = -offsetY;
203 offsetYfrac = -offsetYfrac;
204 }
205
206 switch( orientation )
207 {
208 case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
209 kicadX += offsetY;
210 kicadXfrac += offsetYfrac;
211 break;
212
213 case ASCH_RECORD_ORIENTATION::UPWARDS:
214 kicadY += offsetY;
215 kicadYfrac += offsetYfrac;
216 break;
217
218 case ASCH_RECORD_ORIENTATION::LEFTWARDS:
219 kicadX -= offsetY;
220 kicadXfrac -= offsetYfrac;
221 break;
222
223 case ASCH_RECORD_ORIENTATION::DOWNWARDS:
224 kicadY -= offsetY;
225 kicadYfrac -= offsetYfrac;
226 break;
227
228 default:
229 wxLogWarning( "Pin has unexpected orientation" );
230 break;
231 }
232
233 kicadLocation = VECTOR2I( Altium2KiCadUnit( kicadX, kicadXfrac ),
234 -Altium2KiCadUnit( kicadY, kicadYfrac ) );
235}
236
237
238ASCH_OWNER_INTERFACE::ASCH_OWNER_INTERFACE( const std::map<wxString, wxString>& aProps )
239{
240 ownerindex = ReadOwnerIndex( aProps );
241 ownerpartid = ReadOwnerPartId( aProps );
242 ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
243 indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
244}
245
246
247ASCH_FILL_INTERFACE::ASCH_FILL_INTERFACE( const std::map<wxString, wxString>& aProps )
248{
249 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
250 IsSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
251 IsTransparent = ALTIUM_PARSER::ReadBool( aProps, "TRANSPARENT", false );
252}
253
254
255ASCH_BORDER_INTERFACE::ASCH_BORDER_INTERFACE( const std::map<wxString, wxString>& aProps )
256{
257 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
258
259 // Altium line width 0 means hairline. Since KiCad doesn't have a hairline, we
260 // represent it as a 1 mil line.
261 if( LineWidth == 0 )
263
264 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
265}
266
267
268ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProps ) :
269 ASCH_OWNER_INTERFACE( aProps )
270{
271 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LABEL );
272
273 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
274 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
275
276 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
277
278 textColor = 0;
279 fontId = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
280 isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
281
282 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
283 ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
284
285 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
286 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
287}
288
289
290ASCH_TEXT_FRAME::ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps ) :
291 ASCH_OWNER_INTERFACE( aProps )
292{
293 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NOTE
294 || ReadRecord( aProps ) == ALTIUM_SCH_RECORD::TEXT_FRAME );
295
296 BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
297 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
298 TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
299 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
300
301 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
302 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
303 Size = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ) - Location.x,
304 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) - Location.y );
305
306 Text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
307 Text.Replace( "~1", "\n", true );
308
309 FontID = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
310 IsWordWrapped = ALTIUM_PARSER::ReadBool( aProps, "WORDWRAP", false );
311 ShowBorder = ALTIUM_PARSER::ReadBool( aProps, "SHOWBORDER", false );
312 TextMargin = ReadKiCadUnitFrac( aProps, "TEXTMARGIN" );
313
314 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
315 BorderColor = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
316 TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
317
318 BorderWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
319 isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
320
321 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
322 ASCH_TEXT_FRAME_ALIGNMENT::LEFT );
323}
324
325
326ASCH_NOTE::ASCH_NOTE( const std::map<wxString, wxString>& aProperties ) :
327 ASCH_TEXT_FRAME( aProperties )
328{
329 wxASSERT( ReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NOTE );
330
331 author = ALTIUM_PARSER::ReadString( aProperties, "AUTHOR", "" );
332}
333
334
335ASCH_BEZIER::ASCH_BEZIER( const std::map<wxString, wxString>& aProps ) :
336 ASCH_OWNER_INTERFACE( aProps ),
337 ASCH_BORDER_INTERFACE( aProps )
338{
339 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BEZIER );
340
341 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
342
343 for( int i = 1; i <= locationCount; i++ )
344 {
345 const wxString si = std::to_string( i );
346 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
347 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
348 }
349}
350
351
352ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& aProps ) :
353 ASCH_OWNER_INTERFACE( aProps ),
354 ASCH_BORDER_INTERFACE( aProps )
355{
356 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYLINE );
357
358 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
359
360 for( int i = 1; i <= locationCount; i++ )
361 {
362 const wxString si = std::to_string( i );
363 Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
364 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
365 }
366
367 auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID );
368 LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present.
369}
370
371
372ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProps ) :
373 ASCH_OWNER_INTERFACE( aProps ),
374 ASCH_FILL_INTERFACE( aProps ),
375 ASCH_BORDER_INTERFACE( aProps )
376{
377 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POLYGON );
378
379 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
380
381 for( int i = 1; i <= locationCount; i++ )
382 {
383 const wxString si = std::to_string( i );
384 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
385 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
386 }
387}
388
389
390ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProps ) :
391 ASCH_OWNER_INTERFACE( aProps ),
392 ASCH_FILL_INTERFACE( aProps ),
393 ASCH_BORDER_INTERFACE( aProps )
394{
395 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
396
397 BottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
398 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
399 TopRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
400 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
401
402 CornerRadius = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ),
403 -ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) );
404}
405
406
407ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProps ) :
408 ASCH_OWNER_INTERFACE( aProps ),
409 ASCH_BORDER_INTERFACE( aProps )
410{
411 m_IsElliptical = ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ELLIPTICAL_ARC;
412 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ARC || m_IsElliptical );
413
414 m_Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
415 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
416 m_Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
418
419 if( m_IsElliptical )
420 m_SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
421
422 m_StartAngle = ALTIUM_PARSER::ReadDouble( aProps, "STARTANGLE", 0 );
423 m_EndAngle = ALTIUM_PARSER::ReadDouble( aProps, "ENDANGLE", 0 );
424}
425
426
427ASCH_ELLIPSE::ASCH_ELLIPSE( const std::map<wxString, wxString>& aProps ) :
428 ASCH_OWNER_INTERFACE( aProps ),
429 ASCH_FILL_INTERFACE( aProps ),
430 ASCH_BORDER_INTERFACE( aProps )
431{
432 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::ELLIPSE );
433
434 Center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
435 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
436
437 Radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
438 SecondaryRadius = ReadKiCadUnitFrac( aProps, "SECONDARYRADIUS" );
439
440 IsNotAccesible = ALTIUM_PARSER::ReadBool( aProps, "ISNOTACCESIBLE", false );
441}
442
443
444ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProps ) :
445 ASCH_OWNER_INTERFACE( aProps ),
446 ASCH_BORDER_INTERFACE( aProps )
447{
448 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::LINE );
449
450 point1 = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
451 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
452 point2 = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
453 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
454
455 auto lineStyleExt = ReadEnum( aProps, "LINESTYLEEXT", 0, 3, ASCH_POLYLINE_LINESTYLE::SOLID );
456 LineStyle = ReadEnum( aProps, "LINESTYLE", 0, 3, lineStyleExt ); // overwrite if present.
457}
458
459
460ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aProps ) :
461 ASCH_OWNER_INTERFACE( aProps )
462{
463 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SIGNAL_HARNESS );
464
465
466 int locationCount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
467
468 for( int i = 1; i <= locationCount; i++ )
469 {
470 const wxString si = std::to_string( i );
471 Points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
472 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
473 }
474
475 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
476 LineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
477}
478
479
480ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps ) :
481 ASCH_OWNER_INTERFACE( aProps )
482{
483 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR );
484
485
486 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
487 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
488 Size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
489
490 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
491 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
492
493 indexinsheet = 0;
494 LineWidth = 0;;
496}
497
498
499ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aProps ) :
500 ASCH_OWNER_INTERFACE( aProps )
501{
502 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_ENTRY );
503
504 // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead, because this property sometimes
505 // does not exist in altium file!
506 // ownerindex = ReadOwnerIndex( aProps );
507
508
509 DistanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
510
511 Side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
512
513 Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
514
515 OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
516
517 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
518 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
519 TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
520 TextFontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
521 TextStyle = 0;
522}
523
524
525ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps ) :
526 ASCH_OWNER_INTERFACE( aProps )
527{
528 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE );
529
530 //ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
531
532 Text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
533
534 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
535 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
536
537 IsHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
538 OwnerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
539
540 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
541 FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
542}
543
544
545ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps ) :
546 ASCH_OWNER_INTERFACE( aProps ),
547 ASCH_FILL_INTERFACE( aProps ),
548 ASCH_BORDER_INTERFACE( aProps )
549{
550 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
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}
558
559
560ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps ) :
561 ASCH_OWNER_INTERFACE( aProps )
562{
563 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
564
565 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
566 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
567 size = VECTOR2I( ReadKiCadUnitFrac( aProps, "XSIZE" ),
568 ReadKiCadUnitFrac( aProps, "YSIZE" ) );
569
570 isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
571
572 color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
573 areacolor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
574}
575
576
577ASCH_SHEET_ENTRY::ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProps ) :
578 ASCH_OWNER_INTERFACE( aProps )
579{
580 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_ENTRY );
581
582 // some magic, because it stores those infos in a different unit??
583 distanceFromTop = ReadKiCadUnitFrac1( aProps, "DISTANCEFROMTOP" );
584
585 side = ReadEnum<ASCH_SHEET_ENTRY_SIDE>( aProps, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
586
587 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
588
589 iotype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
590 style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
591}
592
593
594ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps ) :
595 ASCH_OWNER_INTERFACE( aProps )
596{
597 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::POWER_PORT );
598
599
600 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
601 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
602
603 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
604 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
605
606 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
607 showNetName = ALTIUM_PARSER::ReadBool( aProps, "SHOWNETNAME", true );
608
609 style = ReadEnum<ASCH_POWER_PORT_STYLE>( aProps, "STYLE", 0, 10,
610 ASCH_POWER_PORT_STYLE::CIRCLE );
611}
612
613
614ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProps ) :
615 ASCH_OWNER_INTERFACE( aProps )
616{
617 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PORT );
618
619
620 Location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
621 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
622
623 Name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
624 HarnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
625
626 Width = ReadKiCadUnitFrac( aProps, "WIDTH" );
627 Height = ReadKiCadUnitFrac( aProps, "HEIGHT" );
628
629 IOtype = ReadEnum<ASCH_PORT_IOTYPE>( aProps, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
630 Style = ReadEnum<ASCH_PORT_STYLE>( aProps, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
631
632 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
633 Color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
634 FontID = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
635 TextColor = ALTIUM_PARSER::ReadInt( aProps, "TEXTCOLOR", 0 );
636
637 Alignment = ReadEnum<ASCH_TEXT_FRAME_ALIGNMENT>( aProps, "ALIGNMENT", 1, 3,
638 ASCH_TEXT_FRAME_ALIGNMENT::LEFT );
639}
640
641
642ASCH_NO_ERC::ASCH_NO_ERC( const std::map<wxString, wxString>& aProps )
643{
644 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NO_ERC );
645
646 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
647 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
648
649 isActive = ALTIUM_PARSER::ReadBool( aProps, "ISACTIVE", true );
650 suppressAll = ALTIUM_PARSER::ReadInt( aProps, "SUPPRESSALL", true );
651}
652
653
654ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps ) :
655 ASCH_OWNER_INTERFACE( aProps )
656{
657 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NET_LABEL );
658
659 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
660
661 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
662 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
663
664 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
665 ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
666
667 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
668 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
669}
670
671
672ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProps ) :
673 ASCH_OWNER_INTERFACE( aProps )
674{
675 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS );
676
677 int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
678
679 for( int i = 1; i <= locationcount; i++ )
680 {
681 const wxString si = std::to_string( i );
682 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
683 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
684 }
685
686 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
687}
688
689
690ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProps ) :
691 ASCH_OWNER_INTERFACE( aProps )
692{
693 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::WIRE );
694
695 int locationcount = ALTIUM_PARSER::ReadInt( aProps, "LOCATIONCOUNT", 0 );
696
697 for( int i = 1; i <= locationcount; i++ )
698 {
699 const wxString si = std::to_string( i );
700 points.emplace_back( ReadKiCadUnitFrac( aProps, "X" + si ),
701 -ReadKiCadUnitFrac( aProps, "Y" + si ) );
702 }
703
704 lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
705}
706
707
708ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProps ) :
709 ASCH_OWNER_INTERFACE( aProps )
710{
711 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::JUNCTION );
712
713
714 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
715 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
716}
717
718
719ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProps ) :
720 ASCH_OWNER_INTERFACE( aProps ),
721 ASCH_BORDER_INTERFACE( aProps )
722{
723 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMAGE );
724
725 filename = ALTIUM_PARSER::ReadString( aProps, "FILENAME", "" );
726
727 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
728 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
729 corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
730 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
731
732 embedimage = ALTIUM_PARSER::ReadBool( aProps, "EMBEDIMAGE", false );
733 keepaspect = ALTIUM_PARSER::ReadBool( aProps, "KEEPASPECT", false );
734}
735
736
737ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, int aId ) :
738 ASCH_OWNER_INTERFACE( aProps )
739{
740 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
741
742 const wxString sid = std::to_string( aId );
743
744 FontName = ALTIUM_PARSER::ReadString( aProps, "FONTNAME" + sid, "" );
745
746 Size = ReadKiCadUnitFrac( aProps, "SIZE" + sid );
747 Rotation = ALTIUM_PARSER::ReadInt( aProps, "ROTATION" + sid, 0 );
748
749 Italic = ALTIUM_PARSER::ReadBool( aProps, "ITALIC" + sid, false );
750 Bold = ALTIUM_PARSER::ReadBool( aProps, "BOLD" + sid, false );
751 Underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false );
752
753 AreaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR" + sid, 0 );
754}
755
756
758{
759 // From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
760 switch( aSheetSize )
761 {
762 default:
763 case ASCH_SHEET_SIZE::A4: return { 1150, 760 };
764 case ASCH_SHEET_SIZE::A3: return { 1550, 1110 };
765 case ASCH_SHEET_SIZE::A2: return { 2230, 1570 };
766 case ASCH_SHEET_SIZE::A1: return { 3150, 2230 };
767 case ASCH_SHEET_SIZE::A0: return { 4460, 3150 };
768 case ASCH_SHEET_SIZE::A: return { 950, 750 };
769 case ASCH_SHEET_SIZE::B: return { 1500, 950 };
770 case ASCH_SHEET_SIZE::C: return { 2000, 1500 };
771 case ASCH_SHEET_SIZE::D: return { 3200, 2000 };
772 case ASCH_SHEET_SIZE::E: return { 4200, 3200 };
773 case ASCH_SHEET_SIZE::LETTER: return { 1100, 850 };
774 case ASCH_SHEET_SIZE::LEGAL: return { 1400, 850 };
775 case ASCH_SHEET_SIZE::TABLOID: return { 1700, 1100 };
776 case ASCH_SHEET_SIZE::ORCAD_A: return { 990, 790 };
777 case ASCH_SHEET_SIZE::ORCAD_B: return { 1540, 990 };
778 case ASCH_SHEET_SIZE::ORCAD_C: return { 2060, 1560 };
779 case ASCH_SHEET_SIZE::ORCAD_D: return { 3260, 2060 };
780 case ASCH_SHEET_SIZE::ORCAD_E: return { 4280, 3280 };
781 }
782}
783
784
785ASCH_SHEET::ASCH_SHEET( const std::map<wxString, wxString>& aProps ) :
786 ASCH_OWNER_INTERFACE( aProps )
787{
788 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET );
789
790 int fontidcount = ALTIUM_PARSER::ReadInt( aProps, "FONTIDCOUNT", 0 );
791
792 for( int i = 1; i <= fontidcount; i++ )
793 fonts.emplace_back( aProps, i );
794
795 useCustomSheet = ALTIUM_PARSER::ReadBool( aProps, "USECUSTOMSHEET", false );
796
797 customSize = VECTOR2I( ReadKiCadUnitFrac( aProps, "CUSTOMX" ),
798 ReadKiCadUnitFrac( aProps, "CUSTOMY" ) );
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 ASCH_OWNER_INTERFACE( aProps )
808{
809 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_NAME );
810
811 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
812
813 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
814 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
815
816 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
817 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
818
819 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
820}
821
822
823ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps ) :
824 ASCH_OWNER_INTERFACE( aProps )
825{
826 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::FILE_NAME );
827
828 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
829
830 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
831 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
832
833 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
834 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
835
836 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
837}
838
839
840ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps ) :
841 ASCH_OWNER_INTERFACE( aProps )
842{
843 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::DESIGNATOR );
844
845 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
846 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
847 fontId = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
848
849 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
850 ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
851
852 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
853 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
854
855 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
856 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
857}
858
859
860ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aProps ) :
861 ASCH_OWNER_INTERFACE( aProps )
862{
863 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION );
864
866 name = ALTIUM_PARSER::ReadString( aProps, "MODELNAME", "" );
867 type = ALTIUM_PARSER::ReadString( aProps, "MODELTYPE", "" );
868 libname = ALTIUM_PARSER::ReadString( aProps, "MODELDATAFILE0", "" );
869 description = ALTIUM_PARSER::ReadString( aProps, "DESCRIPTION", "" );
870 isCurrent = ALTIUM_PARSER::ReadBool( aProps, "ISCURRENT", false );
871}
872
873
874ASCH_IMPLEMENTATION_LIST::ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProps ) :
875 ASCH_OWNER_INTERFACE( aProps )
876{
877 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST );
878}
879
880
881ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps ) :
882 ASCH_OWNER_INTERFACE( aProps )
883{
884 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS_ENTRY );
885
886 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
887 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
888 corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
889 -ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
890}
891
892
893ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProps ) :
894 ASCH_OWNER_INTERFACE( aProps )
895{
896 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::PARAMETER );
897
898 location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
899 -ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
900
901 justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
902 ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
903
904 orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
905 ASCH_RECORD_ORIENTATION::RIGHTWARDS );
906
907 name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
908 text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
909
910 isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
911 isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
912 isShowName = ALTIUM_PARSER::ReadBool( aProps, "SHOWNAME", false );
913
914 fontId = ALTIUM_PARSER::ReadInt( aProps, "FONTID", 0 );
915}
916
917
918ASCH_HYPERLINK::ASCH_HYPERLINK( const std::map<wxString, wxString>& aProps ) :
919 ASCH_LABEL( aProps )
920{
921 wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HYPERLINK );
922
923 url = ALTIUM_PARSER::ReadString( aProps, "URL", "" );
924}
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: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)
static PTYPE FromInt(int aInt)
#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)
double m_StartAngle
VECTOR2I m_Center
double m_EndAngle
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_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)
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
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)
wxString author
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
VECTOR2I location
ASCH_PIN_SYMBOL::PTYPE symbolOuterEdge
wxString name
wxString text
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_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)
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
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
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:588