altium: parse bus-entry

This commit is contained in:
Thomas Pointhuber 2020-10-17 16:03:46 +02:00
parent 5793c899dd
commit 39e55d8559
4 changed files with 35 additions and 0 deletions

View File

@ -518,4 +518,14 @@ ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aPropertie
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
}
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" ) );
}

View File

@ -484,4 +484,13 @@ struct ASCH_DESIGNATOR
explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProperties );
};
struct ASCH_BUS_ENTRY
{
wxPoint location;
wxPoint corner;
explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProperties );
};
#endif //ALTIUM_PARSER_SCH_H

View File

@ -375,6 +375,7 @@ void SCH_ALTIUM_PLUGIN::Parse( const CFB::CompoundFileReader& aReader )
ParseDesignator( properties );
break;
case ALTIUM_SCH_RECORD::BUS_ENTRY:
ParseBusEntry( properties );
break;
case ALTIUM_SCH_RECORD::TEMPLATE:
break;
@ -1354,3 +1355,17 @@ void SCH_ALTIUM_PLUGIN::ParseDesignator( const std::map<wxString, wxString>& aPr
text->SetTextAngle( elem.orientation * 90. );
text->SetText( elem.name ); // TODO: use variable
}
void SCH_ALTIUM_PLUGIN::ParseBusEntry( const std::map<wxString, wxString>& aProperties )
{
ASCH_BUS_ENTRY elem( aProperties );
SCH_BUS_WIRE_ENTRY* busWireEntry = new SCH_BUS_WIRE_ENTRY( elem.location + m_sheetOffset );
wxPoint vector = elem.corner - elem.location;
busWireEntry->SetSize( { vector.x, vector.y } );
busWireEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busWireEntry );
}

View File

@ -118,6 +118,7 @@ private:
void ParseJunction( const std::map<wxString, wxString>& aProperties );
void ParseSheet( const std::map<wxString, wxString>& aProperties );
void ParseDesignator( const std::map<wxString, wxString>& aProperties );
void ParseBusEntry( const std::map<wxString, wxString>& aProperties );
private:
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..