2020-08-23 19:01:08 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
2021-06-10 14:10:55 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-08-23 19:01:08 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
#include <convert_to_biu.h>
|
|
|
|
#include <ki_exception.h>
|
|
|
|
|
2021-06-01 05:17:57 +00:00
|
|
|
#include <wx/log.h>
|
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
#include "plugins/altium/altium_parser.h"
|
|
|
|
#include "sch_plugins/altium/altium_parser_sch.h"
|
|
|
|
|
|
|
|
|
|
|
|
ALTIUM_SCH_RECORD PropertiesReadRecord( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
int recordId = ALTIUM_PARSER::PropertiesReadInt( aProperties, "RECORD", 0 );
|
|
|
|
return static_cast<ALTIUM_SCH_RECORD>( recordId );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constexpr int Altium2KiCadUnit( const int val, const int frac )
|
|
|
|
{
|
|
|
|
return Mils2iu( val ) * 10 + Mils2iu( frac ) / 10000; // TODO: correct, rounding issues?
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
int PropertiesReadKiCadUnitFrac(
|
|
|
|
const std::map<wxString, wxString>& aProperties, const wxString& aKey )
|
|
|
|
{
|
|
|
|
// a unit is stored using two fields, denoting the size in mils and a fraction size
|
|
|
|
int key = ALTIUM_PARSER::PropertiesReadInt( aProperties, aKey, 0 );
|
|
|
|
int keyFrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, aKey + "_FRAC", 0 );
|
|
|
|
return Altium2KiCadUnit( key, keyFrac );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-27 14:51:19 +00:00
|
|
|
int PropertiesReadKiCadUnitFrac1(
|
|
|
|
const std::map<wxString, wxString>& aProperties, const wxString& aKey )
|
|
|
|
{
|
|
|
|
// a unit is stored using two fields, denoting the size in mils and a fraction size
|
|
|
|
// Dunno why Altium invents different units for the same purpose
|
|
|
|
int key = ALTIUM_PARSER::PropertiesReadInt( aProperties, aKey, 0 );
|
|
|
|
int keyFrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, aKey + "_FRAC1", 0 );
|
|
|
|
return Altium2KiCadUnit( key * 10, keyFrac );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
template <typename T>
|
|
|
|
T PropertiesReadEnum( const std::map<wxString, wxString>& aProperties, const wxString& aKey,
|
|
|
|
int aLower, int aUpper, T aDefault )
|
|
|
|
{
|
|
|
|
int value = ALTIUM_PARSER::PropertiesReadInt( aProperties, aKey, static_cast<int>( aDefault ) );
|
|
|
|
if( value < aLower || value > aUpper )
|
|
|
|
return aDefault;
|
|
|
|
else
|
|
|
|
return static_cast<T>( value );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-04-10 19:45:36 +00:00
|
|
|
ASCH_STORAGE_FILE::ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader )
|
|
|
|
{
|
|
|
|
aReader.Skip( 5 );
|
|
|
|
filename = aReader.ReadWxString();
|
|
|
|
uint32_t dataSize = aReader.Read<uint32_t>();
|
|
|
|
data = aReader.ReadVector( dataSize );
|
|
|
|
|
|
|
|
if( aReader.HasParsingError() )
|
|
|
|
{
|
|
|
|
THROW_IO_ERROR( "Storage stream was not parsed correctly" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
ASCH_SYMBOL::ASCH_SYMBOL( const std::map<wxString, wxString>& aProperties )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::COMPONENT );
|
|
|
|
|
|
|
|
currentpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "CURRENTPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
libreference = ALTIUM_PARSER::PropertiesReadString( aProperties, "LIBREFERENCE", "" );
|
2020-10-23 14:22:56 +00:00
|
|
|
sourcelibraryname = ALTIUM_PARSER::PropertiesReadString( aProperties, "SOURCELIBRARYNAME", "" );
|
|
|
|
componentdescription =
|
|
|
|
ALTIUM_PARSER::PropertiesReadString( aProperties, "COMPONENTDESCRIPTION", "" );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
|
|
|
orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 );
|
2020-10-23 14:22:56 +00:00
|
|
|
isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false );
|
2020-10-10 14:30:13 +00:00
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
2020-10-23 14:22:56 +00:00
|
|
|
|
|
|
|
partcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PARTCOUNT", 0 );
|
|
|
|
displaymodecount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODECOUNT", 0 );
|
|
|
|
displaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODE", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PIN );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
2020-10-10 14:22:53 +00:00
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
|
|
|
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
designator = ALTIUM_PARSER::PropertiesReadString( aProperties, "DESIGNATOR", "" );
|
|
|
|
|
2020-10-09 15:13:18 +00:00
|
|
|
int symbolOuterInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_OUTER", 0 );
|
|
|
|
symbolOuter = static_cast<ASCH_PIN_SYMBOL_OUTER>( symbolOuterInt );
|
|
|
|
|
|
|
|
int symbolInnerInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_INNER", 0 );
|
|
|
|
symbolInner = static_cast<ASCH_PIN_SYMBOL_INNER>( symbolInnerInt );
|
|
|
|
|
2020-10-09 14:23:07 +00:00
|
|
|
int symbolOuterEdgeInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_OUTEREDGE", 0 );
|
2020-10-09 15:13:18 +00:00
|
|
|
symbolOuterEdge = ( symbolOuterEdgeInt == 0 || symbolOuterEdgeInt == 1
|
|
|
|
|| symbolOuterEdgeInt == 4 || symbolOuterEdgeInt == 17 ) ?
|
2020-10-09 14:23:07 +00:00
|
|
|
static_cast<ASCH_PIN_SYMBOL_OUTEREDGE>( symbolOuterEdgeInt ) :
|
2020-10-17 13:47:11 +00:00
|
|
|
ASCH_PIN_SYMBOL_OUTEREDGE::NO_SYMBOL;
|
2020-10-09 14:23:07 +00:00
|
|
|
|
|
|
|
int symbolInnerEdgeInt = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SYMBOL_INNEREDGE", 0 );
|
|
|
|
symbolInnerEdge = ( symbolInnerEdgeInt == 0 || symbolInnerEdgeInt == 3 ) ?
|
|
|
|
static_cast<ASCH_PIN_SYMBOL_INNEREDGE>( symbolInnerEdgeInt ) :
|
2020-10-17 13:47:11 +00:00
|
|
|
ASCH_PIN_SYMBOL_INNEREDGE::NO_SYMBOL;
|
2020-10-17 11:52:47 +00:00
|
|
|
electrical = PropertiesReadEnum<ASCH_PIN_ELECTRICAL>(
|
2020-10-17 13:47:11 +00:00
|
|
|
aProperties, "ELECTRICAL", 0, 7, ASCH_PIN_ELECTRICAL::INPUT );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
int pinconglomerate = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINCONGLOMERATE", 0 );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
2020-10-14 19:38:12 +00:00
|
|
|
orientation = static_cast<ASCH_RECORD_ORIENTATION>( pinconglomerate & 0x03 );
|
2020-10-09 14:23:07 +00:00
|
|
|
showPinName = ( pinconglomerate & 0x08 ) != 0;
|
|
|
|
showDesignator = ( pinconglomerate & 0x10 ) != 0;
|
2020-08-23 19:01:08 +00:00
|
|
|
|
|
|
|
int x = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X", 0 );
|
|
|
|
int xfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.X_FRAC", 0 );
|
|
|
|
int y = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y", 0 );
|
|
|
|
int yfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATION.Y_FRAC", 0 );
|
|
|
|
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
|
2020-10-09 14:23:07 +00:00
|
|
|
|
|
|
|
int p = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH", 0 );
|
|
|
|
int pfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH_FRAC", 0 );
|
|
|
|
pinlength = Altium2KiCadUnit( p, pfrac );
|
2020-10-10 14:43:33 +00:00
|
|
|
|
|
|
|
// this code calculates the location as required by KiCad without rounding error attached
|
|
|
|
int kicadX = x;
|
|
|
|
int kicadXfrac = xfrac;
|
|
|
|
int kicadY = y;
|
|
|
|
int kicadYfrac = yfrac;
|
|
|
|
|
|
|
|
switch( orientation )
|
|
|
|
{
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
|
2020-10-10 14:43:33 +00:00
|
|
|
kicadX += p;
|
|
|
|
kicadXfrac += pfrac;
|
|
|
|
break;
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::UPWARDS:
|
2020-10-10 14:43:33 +00:00
|
|
|
kicadY += p;
|
|
|
|
kicadYfrac += pfrac;
|
|
|
|
break;
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::LEFTWARDS:
|
2020-10-10 14:43:33 +00:00
|
|
|
kicadX -= p;
|
|
|
|
kicadXfrac -= pfrac;
|
|
|
|
break;
|
2020-10-14 19:38:12 +00:00
|
|
|
case ASCH_RECORD_ORIENTATION::DOWNWARDS:
|
2020-10-10 14:43:33 +00:00
|
|
|
kicadY -= p;
|
|
|
|
kicadYfrac -= pfrac;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
wxLogWarning( "Pin has unexpected orientation" );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
kicadLocation = wxPoint(
|
|
|
|
Altium2KiCadUnit( kicadX, kicadXfrac ), -Altium2KiCadUnit( kicadY, kicadYfrac ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LABEL );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
2020-10-17 12:33:30 +00:00
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
|
|
|
|
fontId = ALTIUM_PARSER::PropertiesReadInt( aProperties, "FONTID", 0 );
|
|
|
|
isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false );
|
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
justification = PropertiesReadEnum<ASCH_LABEL_JUSTIFICATION>(
|
2020-10-17 13:47:11 +00:00
|
|
|
aProperties, "JUSTIFICATION", 0, 8, ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
2020-10-17 11:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 14:56:19 +00:00
|
|
|
ASCH_BEZIER::ASCH_BEZIER( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BEZIER );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-10 14:56:19 +00:00
|
|
|
|
|
|
|
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
|
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
|
|
|
points.emplace_back( PropertiesReadKiCadUnitFrac( aProperties, "X" + si ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "Y" + si ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYLINE );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-10 14:56:19 +00:00
|
|
|
|
|
|
|
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
|
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
|
|
|
points.emplace_back( PropertiesReadKiCadUnitFrac( aProperties, "X" + si ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "Y" + si ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
2020-10-14 19:04:53 +00:00
|
|
|
|
|
|
|
int linestyleVar = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LINESTYLEEXT", 0 );
|
|
|
|
linestyleVar = ALTIUM_PARSER::PropertiesReadInt(
|
|
|
|
aProperties, "LINESTYLE", linestyleVar ); // overwrite if present
|
|
|
|
linestyle = linestyleVar >= 0 && linestyleVar <= 3 ?
|
|
|
|
static_cast<ASCH_POLYLINE_LINESTYLE>( linestyleVar ) :
|
|
|
|
ASCH_POLYLINE_LINESTYLE::SOLID;
|
2020-10-10 14:56:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYGON );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-10 14:22:53 +00:00
|
|
|
|
|
|
|
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
|
|
|
|
for( int i = 1; i <= locationCount; i++ )
|
|
|
|
{
|
|
|
|
const wxString si = std::to_string( i );
|
2020-10-10 14:30:13 +00:00
|
|
|
points.emplace_back( PropertiesReadKiCadUnitFrac( aProperties, "X" + si ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "Y" + si ) );
|
2020-10-10 14:22:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
|
|
|
isSolid = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISSOLID", false );
|
2020-10-14 19:04:53 +00:00
|
|
|
|
|
|
|
color = ALTIUM_PARSER::PropertiesReadInt( aProperties, "COLOR", 0 );
|
2020-10-14 19:15:09 +00:00
|
|
|
areacolor = ALTIUM_PARSER::PropertiesReadInt( aProperties, "AREACOLOR", 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
2020-10-14 19:23:36 +00:00
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
|
2020-10-14 19:15:09 +00:00
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-14 19:15:09 +00:00
|
|
|
|
|
|
|
bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
topRight = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNER.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNER.Y" ) );
|
|
|
|
|
|
|
|
topRight = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNERXRADIUS" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNERYRADIUS" ) );
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
|
|
|
isSolid = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISSOLID", false );
|
|
|
|
isTransparent = ALTIUM_PARSER::PropertiesReadBool( aProperties, "TRANSPARENT", false );
|
|
|
|
|
|
|
|
color = ALTIUM_PARSER::PropertiesReadInt( aProperties, "COLOR", 0 );
|
2020-10-14 19:04:53 +00:00
|
|
|
areacolor = ALTIUM_PARSER::PropertiesReadInt( aProperties, "AREACOLOR", 0 );
|
2020-10-10 14:22:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-10 16:41:19 +00:00
|
|
|
ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ARC );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-10 16:41:19 +00:00
|
|
|
|
|
|
|
center = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
radius = PropertiesReadKiCadUnitFrac( aProperties, "RADIUS" );
|
|
|
|
|
|
|
|
startAngle = ALTIUM_PARSER::PropertiesReadDouble( aProperties, "STARTANGLE", 0 );
|
|
|
|
endAngle = ALTIUM_PARSER::PropertiesReadDouble( aProperties, "ENDANGLE", 0 );
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LINE );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-10-10 16:41:19 +00:00
|
|
|
|
|
|
|
point1 = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
point2 = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNER.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNER.Y" ) );
|
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::RECTANGLE );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
2020-10-10 14:22:53 +00:00
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
2020-10-23 15:02:56 +00:00
|
|
|
ownerpartdisplaymode =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2020-10-10 14:30:13 +00:00
|
|
|
bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
topRight = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNER.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNER.Y" ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2020-10-10 14:22:53 +00:00
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
2020-08-23 19:01:08 +00:00
|
|
|
isSolid = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISSOLID", false );
|
|
|
|
isTransparent = ALTIUM_PARSER::PropertiesReadBool( aProperties, "TRANSPARENT", false );
|
2020-10-14 19:04:53 +00:00
|
|
|
|
|
|
|
color = ALTIUM_PARSER::PropertiesReadInt( aProperties, "COLOR", 0 );
|
|
|
|
areacolor = ALTIUM_PARSER::PropertiesReadInt( aProperties, "AREACOLOR", 0 );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-27 14:51:19 +00:00
|
|
|
ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
|
|
|
|
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
size = wxSize( PropertiesReadKiCadUnitFrac( aProperties, "XSIZE" ),
|
|
|
|
PropertiesReadKiCadUnitFrac( aProperties, "YSIZE" ) );
|
|
|
|
|
|
|
|
isSolid = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISSOLID", false );
|
|
|
|
|
|
|
|
color = ALTIUM_PARSER::PropertiesReadInt( aProperties, "COLOR", 0 );
|
|
|
|
areacolor = ALTIUM_PARSER::PropertiesReadInt( aProperties, "AREACOLOR", 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_SHEET_ENTRY::ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_ENTRY );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
|
|
|
|
// some magic, because it stores those infos in a different unit??
|
|
|
|
distanceFromTop = PropertiesReadKiCadUnitFrac1( aProperties, "DISTANCEFROMTOP" );
|
|
|
|
|
|
|
|
side = PropertiesReadEnum<ASCH_SHEET_ENTRY_SIDE>(
|
|
|
|
aProperties, "SIDE", 0, 3, ASCH_SHEET_ENTRY_SIDE::LEFT );
|
|
|
|
|
|
|
|
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
|
|
|
|
|
|
|
|
iotype = PropertiesReadEnum<ASCH_PORT_IOTYPE>(
|
|
|
|
aProperties, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
|
|
|
|
style = PropertiesReadEnum<ASCH_PORT_STYLE>(
|
|
|
|
aProperties, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-24 16:40:16 +00:00
|
|
|
ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POWER_PORT );
|
|
|
|
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
|
|
|
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
showNetName = ALTIUM_PARSER::PropertiesReadBool( aProperties, "SHOWNETNAME", true );
|
|
|
|
|
|
|
|
style = PropertiesReadEnum<ASCH_POWER_PORT_STYLE>(
|
|
|
|
aProperties, "STYLE", 0, 10, ASCH_POWER_PORT_STYLE::CIRCLE );
|
|
|
|
}
|
|
|
|
|
2020-10-26 15:54:49 +00:00
|
|
|
ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PORT );
|
|
|
|
|
|
|
|
ownerpartid =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
|
|
|
|
|
|
|
|
width = PropertiesReadKiCadUnitFrac( aProperties, "WIDTH" );
|
|
|
|
height = PropertiesReadKiCadUnitFrac( aProperties, "HEIGHT" );
|
|
|
|
|
|
|
|
iotype = PropertiesReadEnum<ASCH_PORT_IOTYPE>(
|
|
|
|
aProperties, "IOTYPE", 0, 3, ASCH_PORT_IOTYPE::UNSPECIFIED );
|
|
|
|
style = PropertiesReadEnum<ASCH_PORT_STYLE>(
|
|
|
|
aProperties, "STYLE", 0, 7, ASCH_PORT_STYLE::NONE_HORIZONTAL );
|
|
|
|
}
|
|
|
|
|
2020-10-24 16:40:16 +00:00
|
|
|
|
2020-10-14 19:23:36 +00:00
|
|
|
ASCH_NO_ERC::ASCH_NO_ERC( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NO_ERC );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
isActive = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISACTIVE", true );
|
|
|
|
supressAll = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SUPPRESSALL", true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NET_LABEL );
|
|
|
|
|
2020-10-17 12:33:30 +00:00
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2020-10-10 14:30:13 +00:00
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
2020-10-14 19:38:12 +00:00
|
|
|
|
2020-10-17 11:52:47 +00:00
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BUS );
|
|
|
|
|
|
|
|
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
|
|
|
|
|
|
|
|
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
|
2020-10-10 14:22:53 +00:00
|
|
|
for( int i = 1; i <= locationcount; i++ )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2020-10-10 14:22:53 +00:00
|
|
|
const wxString si = std::to_string( i );
|
2020-10-10 14:30:13 +00:00
|
|
|
points.emplace_back( PropertiesReadKiCadUnitFrac( aProperties, "X" + si ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "Y" + si ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
2020-10-10 14:22:53 +00:00
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::WIRE );
|
|
|
|
|
|
|
|
/*std::cout << "-----------------------------------" << std::endl;
|
|
|
|
// debug
|
|
|
|
for( auto& property : aProperties )
|
|
|
|
{
|
|
|
|
std::cout << " * '" << property.first << "' = '" << property.second << "'"
|
|
|
|
<< std::endl;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
|
|
|
|
|
|
|
|
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
|
2020-10-10 14:22:53 +00:00
|
|
|
for( int i = 1; i <= locationcount; i++ )
|
2020-08-23 19:01:08 +00:00
|
|
|
{
|
2020-10-10 14:22:53 +00:00
|
|
|
const wxString si = std::to_string( i );
|
2020-10-10 14:30:13 +00:00
|
|
|
points.emplace_back( PropertiesReadKiCadUnitFrac( aProperties, "X" + si ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "Y" + si ) );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
2020-10-10 14:22:53 +00:00
|
|
|
|
|
|
|
lineWidth = PropertiesReadKiCadUnitFrac( aProperties, "LINEWIDTH" );
|
2020-08-23 19:01:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-09 15:21:27 +00:00
|
|
|
ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::JUNCTION );
|
|
|
|
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", -1 );
|
|
|
|
|
2020-10-10 14:30:13 +00:00
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
2020-10-09 15:21:27 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 19:45:36 +00:00
|
|
|
|
|
|
|
ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMAGE );
|
|
|
|
|
|
|
|
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", -1 );
|
|
|
|
|
|
|
|
filename = ALTIUM_PARSER::PropertiesReadString( aProperties, "FILENAME", "" );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
corner = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNER.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNER.Y" ) );
|
|
|
|
|
|
|
|
embedimage = ALTIUM_PARSER::PropertiesReadBool( aProperties, "EMBEDIMAGE", false );
|
|
|
|
keepaspect = ALTIUM_PARSER::PropertiesReadBool( aProperties, "KEEPASPECT", false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-17 12:33:30 +00:00
|
|
|
ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProperties, int aId )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET );
|
|
|
|
|
|
|
|
const wxString sid = std::to_string( aId );
|
|
|
|
|
|
|
|
fontname = ALTIUM_PARSER::PropertiesReadString( aProperties, "FONTNAME" + sid, "" );
|
|
|
|
|
|
|
|
size = PropertiesReadKiCadUnitFrac( aProperties, "SIZE" + sid );
|
|
|
|
rotation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ROTATION" + sid, 0 );
|
|
|
|
|
|
|
|
italic = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ITALIC" + sid, false );
|
|
|
|
bold = ALTIUM_PARSER::PropertiesReadBool( aProperties, "BOLD" + sid, false );
|
|
|
|
underline = ALTIUM_PARSER::PropertiesReadBool( aProperties, "UNDERLINE" + sid, false );
|
|
|
|
}
|
|
|
|
|
2020-10-17 13:35:22 +00:00
|
|
|
wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
|
|
|
|
{
|
|
|
|
// From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
|
|
|
|
switch( aSheetSize )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case ASCH_SHEET_SIZE::A4:
|
|
|
|
return { 1150, 760 };
|
|
|
|
case ASCH_SHEET_SIZE::A3:
|
|
|
|
return { 1550, 1110 };
|
|
|
|
case ASCH_SHEET_SIZE::A2:
|
|
|
|
return { 2230, 1570 };
|
|
|
|
case ASCH_SHEET_SIZE::A1:
|
|
|
|
return { 3150, 2230 };
|
|
|
|
case ASCH_SHEET_SIZE::A0:
|
|
|
|
return { 4460, 3150 };
|
|
|
|
case ASCH_SHEET_SIZE::A:
|
|
|
|
return { 950, 750 };
|
|
|
|
case ASCH_SHEET_SIZE::B:
|
|
|
|
return { 1500, 950 };
|
|
|
|
case ASCH_SHEET_SIZE::C:
|
|
|
|
return { 2000, 1500 };
|
|
|
|
case ASCH_SHEET_SIZE::D:
|
|
|
|
return { 3200, 2000 };
|
|
|
|
case ASCH_SHEET_SIZE::E:
|
|
|
|
return { 4200, 3200 };
|
|
|
|
case ASCH_SHEET_SIZE::LETTER:
|
|
|
|
return { 1100, 850 };
|
|
|
|
case ASCH_SHEET_SIZE::LEGAL:
|
|
|
|
return { 1400, 850 };
|
|
|
|
case ASCH_SHEET_SIZE::TABLOID:
|
|
|
|
return { 1700, 1100 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_A:
|
|
|
|
return { 990, 790 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_B:
|
|
|
|
return { 1540, 990 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_C:
|
|
|
|
return { 2060, 1560 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_D:
|
|
|
|
return { 3260, 2060 };
|
|
|
|
case ASCH_SHEET_SIZE::ORCAD_E:
|
|
|
|
return { 4280, 3280 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-17 12:33:30 +00:00
|
|
|
ASCH_SHEET::ASCH_SHEET( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET );
|
|
|
|
|
|
|
|
int fontidcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "FONTIDCOUNT", 0 );
|
|
|
|
for( int i = 1; i <= fontidcount; i++ )
|
|
|
|
{
|
|
|
|
fonts.emplace_back( aProperties, i );
|
|
|
|
}
|
2020-10-17 13:35:22 +00:00
|
|
|
|
|
|
|
sheetSize = PropertiesReadEnum<ASCH_SHEET_SIZE>(
|
2020-10-17 13:47:11 +00:00
|
|
|
aProperties, "SHEETSTYLE", 0, 17, ASCH_SHEET_SIZE::A4 );
|
2020-10-17 13:35:22 +00:00
|
|
|
sheetOrientation = PropertiesReadEnum<ASCH_SHEET_WORKSPACEORIENTATION>(
|
|
|
|
aProperties, "WORKSPACEORIENTATION", 0, 1, ASCH_SHEET_WORKSPACEORIENTATION::LANDSCAPE );
|
2020-10-17 12:33:30 +00:00
|
|
|
}
|
2020-10-09 15:21:27 +00:00
|
|
|
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2020-10-27 14:51:19 +00:00
|
|
|
ASCH_SHEET_NAME::ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_NAME );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
|
|
|
|
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
|
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
isHidden = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISHIDDEN", false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::FILE_NAME );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
|
|
|
|
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
|
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
isHidden = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISHIDDEN", false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-23 19:01:08 +00:00
|
|
|
ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::DESIGNATOR );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
|
|
|
|
|
|
|
|
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
|
2020-10-26 17:26:49 +00:00
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
2020-08-23 19:01:08 +00:00
|
|
|
|
2020-10-10 14:30:13 +00:00
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
2020-10-17 14:03:46 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 17:26:49 +00:00
|
|
|
|
2020-10-17 14:03:46 +00:00
|
|
|
ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BUS_ENTRY );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
corner = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "CORNER.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "CORNER.Y" ) );
|
2020-10-26 17:26:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProperties )
|
|
|
|
{
|
|
|
|
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PARAMETER );
|
|
|
|
|
|
|
|
ownerindex =
|
|
|
|
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
|
|
|
|
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
|
|
|
|
|
|
|
|
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
|
|
|
|
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
|
|
|
|
|
|
|
|
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
|
|
|
|
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
|
|
|
|
|
|
|
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
|
|
|
|
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
|
|
|
|
|
|
|
|
isHidden = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISHIDDEN", false );
|
|
|
|
isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false );
|
|
|
|
isShowName = ALTIUM_PARSER::PropertiesReadBool( aProperties, "SHOWNAME", false );
|
2021-06-10 14:10:55 +00:00
|
|
|
}
|