Formatting.

This commit is contained in:
Jeff Young 2021-07-06 19:44:06 +01:00
parent 9d348d7e6d
commit 190b0ecdeb
3 changed files with 120 additions and 162 deletions

View File

@ -139,14 +139,14 @@ public:
static int32_t ConvertToKicadUnit( const double aValue ); static int32_t ConvertToKicadUnit( const double aValue );
static int PropertiesReadInt( static int PropertiesReadInt( const std::map<wxString, wxString>& aProperties,
const std::map<wxString, wxString>& aProperties, const wxString& aKey, int aDefault ); const wxString& aKey, int aDefault );
static double PropertiesReadDouble( const std::map<wxString, wxString>& aProperties, static double PropertiesReadDouble( const std::map<wxString, wxString>& aProperties,
const wxString& aKey, double aDefault ); const wxString& aKey, double aDefault );
static bool PropertiesReadBool( static bool PropertiesReadBool( const std::map<wxString, wxString>& aProperties,
const std::map<wxString, wxString>& aProperties, const wxString& aKey, bool aDefault ); const wxString& aKey, bool aDefault );
static int32_t PropertiesReadKicadUnit( const std::map<wxString, wxString>& aProperties, static int32_t PropertiesReadKicadUnit( const std::map<wxString, wxString>& aProperties,
const wxString& aKey, const wxString& aDefault ); const wxString& aKey, const wxString& aDefault );

View File

@ -68,6 +68,18 @@ int PropertiesReadKiCadUnitFrac1( const std::map<wxString, wxString>& aPropertie
} }
int PropertiesReadOwnerIndex( const std::map<wxString, wxString>& aProperties )
{
return ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
}
int PropertiesReadOwnerPartId( const std::map<wxString, wxString>& aProperties )
{
return ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
}
template <typename T> template <typename T>
T PropertiesReadEnum( const std::map<wxString, wxString>& aProperties, const wxString& aKey, T PropertiesReadEnum( const std::map<wxString, wxString>& aProperties, const wxString& aKey,
int aLower, int aUpper, T aDefault ) int aLower, int aUpper, T aDefault )
@ -121,12 +133,9 @@ ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PIN ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PIN );
ownerindex = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE",
0 );
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" ); name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" ); text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
@ -204,10 +213,8 @@ ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LABEL ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LABEL );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -251,14 +258,12 @@ ASCH_BEZIER::ASCH_BEZIER( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BEZIER ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::BEZIER );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 ); int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationCount; i++ ) for( int i = 1; i <= locationCount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
@ -274,14 +279,12 @@ ASCH_POLYLINE::ASCH_POLYLINE( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYLINE ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYLINE );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 ); int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationCount; i++ ) for( int i = 1; i <= locationCount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
@ -304,14 +307,12 @@ ASCH_POLYGON::ASCH_POLYGON( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYGON ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POLYGON );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 ); int locationCount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationCount; i++ ) for( int i = 1; i <= locationCount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
@ -331,12 +332,9 @@ ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>&
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -359,12 +357,9 @@ ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ARC ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ARC );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
center = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), center = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -381,12 +376,9 @@ ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LINE ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::LINE );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
point1 = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), point1 = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -401,12 +393,9 @@ ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProperties
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::RECTANGLE ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::RECTANGLE );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ownerpartdisplaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
ownerpartdisplaymode =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), bottomLeft = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -426,7 +415,6 @@ ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aPrope
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
size = wxSize( PropertiesReadKiCadUnitFrac( aProperties, "XSIZE" ), size = wxSize( PropertiesReadKiCadUnitFrac( aProperties, "XSIZE" ),
@ -443,10 +431,8 @@ ASCH_SHEET_ENTRY::ASCH_SHEET_ENTRY( const std::map<wxString, wxString>& aPropert
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_ENTRY ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_ENTRY );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
// some magic, because it stores those infos in a different unit?? // some magic, because it stores those infos in a different unit??
distanceFromTop = PropertiesReadKiCadUnitFrac1( aProperties, "DISTANCEFROMTOP" ); distanceFromTop = PropertiesReadKiCadUnitFrac1( aProperties, "DISTANCEFROMTOP" );
@ -467,11 +453,11 @@ ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aPropertie
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POWER_PORT ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::POWER_PORT );
ownerpartid = ownerpartid = PropertiesReadOwnerPartId( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>( orientation = PropertiesReadEnum<ASCH_RECORD_ORIENTATION>(
aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS ); aProperties, "ORIENTATION", 0, 3, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
@ -486,8 +472,7 @@ ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PORT ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PORT );
ownerpartid = ownerpartid = PropertiesReadOwnerPartId( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", ALTIUM_COMPONENT_NONE );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -537,6 +522,7 @@ ASCH_BUS::ASCH_BUS( const std::map<wxString, wxString>& aProperties )
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 ); indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 ); int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationcount; i++ ) for( int i = 1; i <= locationcount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
@ -563,6 +549,7 @@ ASCH_WIRE::ASCH_WIRE( const std::map<wxString, wxString>& aProperties )
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 ); indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 ); int locationcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "LOCATIONCOUNT", 0 );
for( int i = 1; i <= locationcount; i++ ) for( int i = 1; i <= locationcount; i++ )
{ {
const wxString si = std::to_string( i ); const wxString si = std::to_string( i );
@ -578,7 +565,7 @@ ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::JUNCTION ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::JUNCTION );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", -1 ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
@ -590,7 +577,7 @@ ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProperties )
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMAGE ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMAGE );
indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 ); indexinsheet = ALTIUM_PARSER::PropertiesReadInt( aProperties, "INDEXINSHEET", 0 );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", -1 ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
filename = ALTIUM_PARSER::PropertiesReadString( aProperties, "FILENAME", "" ); filename = ALTIUM_PARSER::PropertiesReadString( aProperties, "FILENAME", "" );
@ -626,42 +613,24 @@ wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
switch( aSheetSize ) switch( aSheetSize )
{ {
default: default:
case ASCH_SHEET_SIZE::A4: case ASCH_SHEET_SIZE::A4: return { 1150, 760 };
return { 1150, 760 }; case ASCH_SHEET_SIZE::A3: return { 1550, 1110 };
case ASCH_SHEET_SIZE::A3: case ASCH_SHEET_SIZE::A2: return { 2230, 1570 };
return { 1550, 1110 }; case ASCH_SHEET_SIZE::A1: return { 3150, 2230 };
case ASCH_SHEET_SIZE::A2: case ASCH_SHEET_SIZE::A0: return { 4460, 3150 };
return { 2230, 1570 }; case ASCH_SHEET_SIZE::A: return { 950, 750 };
case ASCH_SHEET_SIZE::A1: case ASCH_SHEET_SIZE::B: return { 1500, 950 };
return { 3150, 2230 }; case ASCH_SHEET_SIZE::C: return { 2000, 1500 };
case ASCH_SHEET_SIZE::A0: case ASCH_SHEET_SIZE::D: return { 3200, 2000 };
return { 4460, 3150 }; case ASCH_SHEET_SIZE::E: return { 4200, 3200 };
case ASCH_SHEET_SIZE::A: case ASCH_SHEET_SIZE::LETTER: return { 1100, 850 };
return { 950, 750 }; case ASCH_SHEET_SIZE::LEGAL: return { 1400, 850 };
case ASCH_SHEET_SIZE::B: case ASCH_SHEET_SIZE::TABLOID: return { 1700, 1100 };
return { 1500, 950 }; case ASCH_SHEET_SIZE::ORCAD_A: return { 990, 790 };
case ASCH_SHEET_SIZE::C: case ASCH_SHEET_SIZE::ORCAD_B: return { 1540, 990 };
return { 2000, 1500 }; case ASCH_SHEET_SIZE::ORCAD_C: return { 2060, 1560 };
case ASCH_SHEET_SIZE::D: case ASCH_SHEET_SIZE::ORCAD_D: return { 3260, 2060 };
return { 3200, 2000 }; case ASCH_SHEET_SIZE::ORCAD_E: return { 4280, 3280 };
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 };
} }
} }
@ -671,10 +640,9 @@ ASCH_SHEET::ASCH_SHEET( const std::map<wxString, wxString>& aProperties )
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET );
int fontidcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "FONTIDCOUNT", 0 ); int fontidcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "FONTIDCOUNT", 0 );
for( int i = 1; i <= fontidcount; i++ ) for( int i = 1; i <= fontidcount; i++ )
{
fonts.emplace_back( aProperties, i ); fonts.emplace_back( aProperties, i );
}
sheetSize = PropertiesReadEnum<ASCH_SHEET_SIZE>( sheetSize = PropertiesReadEnum<ASCH_SHEET_SIZE>(
aProperties, "SHEETSTYLE", 0, 17, ASCH_SHEET_SIZE::A4 ); aProperties, "SHEETSTYLE", 0, 17, ASCH_SHEET_SIZE::A4 );
@ -687,9 +655,8 @@ ASCH_SHEET_NAME::ASCH_SHEET_NAME( const std::map<wxString, wxString>& aPropertie
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_NAME ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::SHEET_NAME );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" ); text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
@ -707,9 +674,8 @@ ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProperties
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::FILE_NAME ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::FILE_NAME );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" ); text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
@ -727,9 +693,8 @@ ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aPropertie
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::DESIGNATOR ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::DESIGNATOR );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" ); name = ALTIUM_PARSER::PropertiesReadString( aProperties, "NAME", "" );
text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" ); text = ALTIUM_PARSER::PropertiesReadString( aProperties, "TEXT", "" );
@ -746,9 +711,10 @@ ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aP
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMPLEMENTATION ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMPLEMENTATION );
// "OWNERINDEX" points to unknown item. Use ASCH_IMPLEMENTATION_LIST -> OWNERINDEX prior in order to get real ownerindex for this particular implementation // "OWNERINDEX" points to unknown item. Use ASCH_IMPLEMENTATION_LIST -> OWNERINDEX prior
//ownerindex = // in order to get real ownerindex for this particular implementation
// ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); //ownerindex = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX",
// ALTIUM_COMPONENT_NONE );
name = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELNAME", "" ); name = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELNAME", "" );
type = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELTYPE", "" ); type = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELTYPE", "" );
libname = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELDATAFILE0", "" ); libname = ALTIUM_PARSER::PropertiesReadString( aProperties, "MODELDATAFILE0", "" );
@ -756,12 +722,12 @@ ASCH_IMPLEMENTATION::ASCH_IMPLEMENTATION( const std::map<wxString, wxString>& aP
} }
ASCH_IMPLEMENTATION_LIST::ASCH_IMPLEMENTATION_LIST( const std::map<wxString, wxString>& aProperties ) ASCH_IMPLEMENTATION_LIST::ASCH_IMPLEMENTATION_LIST( const std::map<wxString,
wxString>& aProperties )
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::IMPLEMENTATION_LIST );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE );
} }
ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProperties ) ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProperties )
@ -779,9 +745,8 @@ ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProperties
{ {
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PARAMETER ); wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::PARAMETER );
ownerindex = ownerindex = PropertiesReadOwnerIndex( aProperties );
ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); ownerpartid = PropertiesReadOwnerPartId( aProperties );
ownerpartid = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERPARTID", 0 );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );

View File

@ -233,13 +233,6 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
} }
/*wxString SCH_EAGLE_PLUGIN::fixSymbolName( const wxString& aName )
{
wxString ret = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_SCH );
return ret;
}*/
void SCH_ALTIUM_PLUGIN::ParseAltiumSch( const wxString& aFileName ) void SCH_ALTIUM_PLUGIN::ParseAltiumSch( const wxString& aFileName )
{ {
// Open file // Open file
@ -2303,11 +2296,11 @@ void SCH_ALTIUM_PLUGIN::ParseImplementation( const std::map<wxString, wxString>&
return; return;
} }
const auto& component = m_symbols.at( libSymbolIt->first ); SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
if( elem.libname != "" ) if( elem.libname != "" )
component->SetFootprint( elem.libname + wxT( ":" ) + elem.name ); symbol->SetFootprint( elem.libname + wxT( ":" ) + elem.name );
else else
component->SetFootprint( elem.name ); symbol->SetFootprint( elem.name );
} }
} }