Import HARNESS_CONNECTOR as Hierarchical sheet
This commit is contained in:
parent
b64f6ccc18
commit
14ceece4f6
|
@ -433,6 +433,21 @@ ASCH_SIGNAL_HARNESS::ASCH_SIGNAL_HARNESS( const std::map<wxString, wxString>& aP
|
|||
}
|
||||
|
||||
|
||||
ASCH_HARNESS_CONNECTOR::ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps )
|
||||
{
|
||||
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_CONNECTOR );
|
||||
|
||||
ownerpartid = ReadOwnerPartId( aProps );
|
||||
|
||||
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
||||
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
||||
size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ), ReadKiCadUnitFrac( aProps, "YSIZE" ) );
|
||||
|
||||
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
|
||||
areaColor = ALTIUM_PARSER::ReadInt( aProps, "AREACOLOR", 0 );
|
||||
}
|
||||
|
||||
|
||||
ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps )
|
||||
{
|
||||
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
|
||||
|
|
|
@ -99,7 +99,7 @@ enum class ALTIUM_SCH_RECORD
|
|||
RECORD_48 = 48,
|
||||
NOTE = 209,
|
||||
COMPILE_MASK = 211,
|
||||
RECORD_215 = 215,
|
||||
HARNESS_CONNECTOR = 215,
|
||||
RECORD_216 = 216,
|
||||
RECORD_217 = 217,
|
||||
SIGNAL_HARNESS = 218,
|
||||
|
@ -423,6 +423,26 @@ struct ASCH_SIGNAL_HARNESS
|
|||
};
|
||||
|
||||
|
||||
struct ASCH_HARNESS_CONNECTOR
|
||||
{
|
||||
int ownerpartid; // always -1, can be safely ignored I think
|
||||
|
||||
VECTOR2I location;
|
||||
wxSize size;
|
||||
|
||||
int areaColor;
|
||||
int color;
|
||||
int indexInSheet; // Keeps increasing nicely
|
||||
int lineWidth;
|
||||
//int locationX; // keep just in case
|
||||
//int locationY;
|
||||
int locationPrimaryConnectionPosition;
|
||||
//int xSize; // keep just in case
|
||||
//int ySize;
|
||||
|
||||
explicit ASCH_HARNESS_CONNECTOR( const std::map<wxString, wxString>& aProps );
|
||||
};
|
||||
|
||||
|
||||
struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
|
||||
{
|
||||
|
|
|
@ -375,7 +375,8 @@ void SCH_ALTIUM_PLUGIN::ParseAdditional( const ALTIUM_COMPOUND_FILE& aAltiumSchF
|
|||
// see: https://github.com/vadmium/python-altium/blob/master/format.md
|
||||
switch( record )
|
||||
{
|
||||
case ALTIUM_SCH_RECORD::RECORD_215:
|
||||
case ALTIUM_SCH_RECORD::HARNESS_CONNECTOR:
|
||||
ParseHarnessConnector( index, properties );
|
||||
break;
|
||||
case ALTIUM_SCH_RECORD::RECORD_216:
|
||||
break;
|
||||
|
@ -1483,6 +1484,46 @@ void SCH_ALTIUM_PLUGIN::ParseSignalHarness( const std::map<wxString, wxString>&
|
|||
}
|
||||
|
||||
|
||||
void SCH_ALTIUM_PLUGIN::ParseHarnessConnector( int aIndex, const std::map<wxString, wxString>& aProperties )
|
||||
{
|
||||
ASCH_HARNESS_CONNECTOR elem( aProperties );
|
||||
|
||||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
SCH_SHEET* sheet = new SCH_SHEET(
|
||||
/* aParent */ m_currentSheet,
|
||||
/* aPosition */ elem.location + m_sheetOffset,
|
||||
/* aSize */ elem.size );
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
|
||||
|
||||
sheet->SetBackgroundColor( GetColorFromInt( elem.areaColor ) );
|
||||
sheet->SetBorderColor( GetColorFromInt( elem.color ) );
|
||||
|
||||
sheet->SetScreen( screen );
|
||||
|
||||
sheet->SetFlags( IS_NEW );
|
||||
m_currentSheet->GetScreen()->Append( sheet );
|
||||
|
||||
SCH_SHEET_PATH sheetpath;
|
||||
m_rootSheet->LocatePathOfScreen( m_currentSheet->GetScreen(), &sheetpath );
|
||||
sheetpath.push_back( sheet );
|
||||
|
||||
sheet->AddInstance( sheetpath );
|
||||
sheet->SetPageNumber( sheetpath, "Harness #" );
|
||||
|
||||
m_harnessEntryParent = aIndex + m_harnessOwnerIndexOffset;
|
||||
m_sheets.insert( { m_harnessEntryParent, sheet } );
|
||||
}
|
||||
else
|
||||
{
|
||||
// I have no clue if this situation can ever exist
|
||||
m_reporter->Report(
|
||||
_( "Harness connector, belonging to the part is not currently supported." ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aProperties )
|
||||
{
|
||||
ASCH_RECTANGLE elem( aProperties );
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
void ParseArc( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseLine( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseSignalHarness( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseHarnessConnector( int aIndex, const std::map<wxString, wxString>& aProperties );
|
||||
void ParseRectangle( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseSheetSymbol( int aIndex, const std::map<wxString, wxString>& aProperties );
|
||||
void ParseSheetEntry( const std::map<wxString, wxString>& aProperties );
|
||||
|
@ -169,6 +170,9 @@ private:
|
|||
std::map<int, ASCH_SYMBOL> m_altiumComponents;
|
||||
std::map<int, int> m_altiumImplementationList;
|
||||
std::vector<ASCH_PORT> m_altiumPortsCurrentSheet; // we require all connections first
|
||||
|
||||
int m_harnessOwnerIndexOffset; // Add offset to all harness ownerIndex'es after parsing FileHeader
|
||||
int m_harnessEntryParent; // used to identify harness connector for harness entry element
|
||||
};
|
||||
|
||||
#endif // _SCH_ALTIUM_PLUGIN_H_
|
||||
|
|
Loading…
Reference in New Issue