CADSTAR Schematic Archive Importer: Fix SIGLOC in JPT (Load labels in junctions)
Fixes but that refused to open file with a SIGLOC node in JPT
This commit is contained in:
parent
ffee24be63
commit
728792aa3c
|
@ -816,14 +816,30 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( std::pair<NETELEMENT_ID, NET::JUNCTION> juncPair : net.Junctions )
|
for( std::pair<NETELEMENT_ID, NET_SCH::JUNCTION_SCH> juncPair : net.Junctions )
|
||||||
{
|
{
|
||||||
NET::JUNCTION junc = juncPair.second;
|
NET_SCH::JUNCTION_SCH junc = juncPair.second;
|
||||||
|
|
||||||
SCH_JUNCTION* kiJunc = new SCH_JUNCTION();
|
SCH_JUNCTION* kiJunc = new SCH_JUNCTION();
|
||||||
|
|
||||||
kiJunc->SetPosition( getKiCadPoint( junc.Location ) );
|
kiJunc->SetPosition( getKiCadPoint( junc.Location ) );
|
||||||
mSheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
|
mSheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
|
||||||
|
|
||||||
|
if( junc.HasNetLabel )
|
||||||
|
{
|
||||||
|
// In CADSTAR the label can be placed anywhere, but in KiCad it has to be placed
|
||||||
|
// in the same location as the junction for it to be connected to it.
|
||||||
|
SCH_LABEL* label = new SCH_LABEL();
|
||||||
|
label->SetText( netName );
|
||||||
|
label->SetPosition( getKiCadPoint( junc.Location ) );
|
||||||
|
label->SetVisible( true );
|
||||||
|
|
||||||
|
double labelAngleDeciDeg = getAngleTenthDegree( junc.NetLabel.OrientAngle );
|
||||||
|
LABEL_SPIN_STYLE spin = getSpinStyleDeciDeg( labelAngleDeciDeg );
|
||||||
|
label->SetLabelSpinStyle( spin );
|
||||||
|
|
||||||
|
mSheetMap.at( junc.LayerID )->GetScreen()->Append( label );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1148,10 +1148,30 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SCHEMATIC::Parse( XNODE* aNode, PARSER_CONTEXT*
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
void CADSTAR_SCH_ARCHIVE_PARSER::NET_SCH::JUNCTION_SCH::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
||||||
{
|
{
|
||||||
CADSTAR_ARCHIVE_PARSER::NET::JUNCTION::Parse( aNode, aContext );
|
ParseIdentifiers( aNode, aContext );
|
||||||
|
|
||||||
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
|
TerminalCodeID = GetXmlAttributeIDString( aNode, 1 );
|
||||||
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
||||||
|
|
||||||
|
XNODE* cNode = aNode->GetChildren();
|
||||||
|
|
||||||
|
for( ; cNode; cNode = cNode->GetNext() )
|
||||||
|
{
|
||||||
|
if( ParseSubNode( cNode, aContext ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if( cNode->GetName() == wxT( "SIGLOC" ) )
|
||||||
|
{
|
||||||
|
NetLabel.Parse( cNode, aContext );
|
||||||
|
HasNetLabel = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,8 @@ public:
|
||||||
struct JUNCTION_SCH : CADSTAR_ARCHIVE_PARSER::NET::JUNCTION ///< "JPT" nodename.
|
struct JUNCTION_SCH : CADSTAR_ARCHIVE_PARSER::NET::JUNCTION ///< "JPT" nodename.
|
||||||
{
|
{
|
||||||
TERMINALCODE_ID TerminalCodeID; ///< Usually a circle, but size can be varied
|
TERMINALCODE_ID TerminalCodeID; ///< Usually a circle, but size can be varied
|
||||||
|
bool HasNetLabel = false;
|
||||||
|
SIGLOC NetLabel;
|
||||||
|
|
||||||
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue