Import HARNESS_TYPE as Hierarchical sheet name
This commit is contained in:
parent
15549364d5
commit
81a2fed5c5
|
@ -473,6 +473,27 @@ ASCH_HARNESS_ENTRY::ASCH_HARNESS_ENTRY( const std::map<wxString, wxString>& aPro
|
|||
}
|
||||
|
||||
|
||||
ASCH_HARNESS_TYPE::ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps )
|
||||
{
|
||||
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::HARNESS_TYPE );
|
||||
|
||||
//ownerindex = ReadOwnerIndex( aProps ); // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
|
||||
ownerpartid = ReadOwnerPartId( aProps );
|
||||
|
||||
text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
|
||||
|
||||
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
||||
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
||||
|
||||
isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
|
||||
ownerIndexAdditionalList = ALTIUM_PARSER::ReadBool( aProps, "OWNERINDEXADDITIONALLIST", true );
|
||||
|
||||
indexInSheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
|
||||
color = ALTIUM_PARSER::ReadInt( aProps, "COLOR", 0 );
|
||||
fontId = ALTIUM_PARSER::ReadInt( aProps, "TEXTFONTID", 0 );
|
||||
}
|
||||
|
||||
|
||||
ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps )
|
||||
{
|
||||
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::RECTANGLE );
|
||||
|
|
|
@ -101,7 +101,7 @@ enum class ALTIUM_SCH_RECORD
|
|||
COMPILE_MASK = 211,
|
||||
HARNESS_CONNECTOR = 215,
|
||||
HARNESS_ENTRY = 216,
|
||||
RECORD_217 = 217,
|
||||
HARNESS_TYPE = 217,
|
||||
SIGNAL_HARNESS = 218,
|
||||
RECORD_226 = 226,
|
||||
};
|
||||
|
@ -475,6 +475,26 @@ struct ASCH_HARNESS_ENTRY
|
|||
};
|
||||
|
||||
|
||||
struct ASCH_HARNESS_TYPE
|
||||
{
|
||||
//int ownerindex; // use SCH_ALTIUM_PLUGIN::m_harnessEntryParent instead!
|
||||
int ownerpartid; // Always -1, presumably safe to remuve
|
||||
|
||||
int color;
|
||||
int indexInSheet;
|
||||
int fontId;
|
||||
|
||||
bool isHidden;
|
||||
bool ownerIndexAdditionalList; // what is that?
|
||||
|
||||
VECTOR2I location;
|
||||
|
||||
wxString text;
|
||||
|
||||
explicit ASCH_HARNESS_TYPE( const std::map<wxString, wxString>& aProps );
|
||||
};
|
||||
|
||||
|
||||
struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
|
||||
{
|
||||
VECTOR2I bottomLeft;
|
||||
|
|
|
@ -381,7 +381,8 @@ void SCH_ALTIUM_PLUGIN::ParseAdditional( const ALTIUM_COMPOUND_FILE& aAltiumSchF
|
|||
case ALTIUM_SCH_RECORD::HARNESS_ENTRY:
|
||||
ParseHarnessEntry( properties );
|
||||
break;
|
||||
case ALTIUM_SCH_RECORD::RECORD_217:
|
||||
case ALTIUM_SCH_RECORD::HARNESS_TYPE:
|
||||
ParseHarnessType( properties );
|
||||
break;
|
||||
case ALTIUM_SCH_RECORD::SIGNAL_HARNESS:
|
||||
ParseSignalHarness( properties );
|
||||
|
@ -1576,6 +1577,37 @@ void SCH_ALTIUM_PLUGIN::ParseHarnessEntry( const std::map<wxString, wxString>& a
|
|||
}
|
||||
|
||||
|
||||
void SCH_ALTIUM_PLUGIN::ParseHarnessType( const std::map<wxString, wxString>& aProperties )
|
||||
{
|
||||
ASCH_HARNESS_TYPE elem( aProperties );
|
||||
|
||||
const auto& sheetIt = m_sheets.find( m_harnessEntryParent );
|
||||
|
||||
if( sheetIt == m_sheets.end() )
|
||||
{
|
||||
m_reporter->Report( wxString::Format( _( "Harness type's parent (%d) not found." ),
|
||||
m_harnessEntryParent ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
return;
|
||||
}
|
||||
|
||||
SCH_FIELD& sheetNameField = sheetIt->second->GetFields()[SHEETNAME];
|
||||
|
||||
sheetNameField.SetPosition( elem.location + m_sheetOffset );
|
||||
sheetNameField.SetText( elem.text );
|
||||
sheetNameField.SetVisible( true ); // Always set as visible so user is aware about ( !elem.isHidden );
|
||||
SetTextPositioning( &sheetNameField, ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT, ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
||||
sheetNameField.SetTextColor( GetColorFromInt( elem.color ) );
|
||||
|
||||
m_reporter->Report(
|
||||
wxString::Format( _( "Altium's Harness Connector (%s) was imported as "
|
||||
"Hierarchical sheet. Please review imported schematic, as "
|
||||
"KiCad does natively support these Altium elements." ),
|
||||
elem.text ),
|
||||
RPT_SEVERITY_WARNING );
|
||||
}
|
||||
|
||||
|
||||
void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aProperties )
|
||||
{
|
||||
ASCH_RECTANGLE elem( aProperties );
|
||||
|
|
|
@ -124,6 +124,7 @@ private:
|
|||
void ParseSignalHarness( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseHarnessConnector( int aIndex, const std::map<wxString, wxString>& aProperties );
|
||||
void ParseHarnessEntry( const std::map<wxString, wxString>& aProperties );
|
||||
void ParseHarnessType( 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 );
|
||||
|
|
Loading…
Reference in New Issue