CADSTAR Schematic: Fix orientation of net labels and sheet pins
This commit is contained in:
parent
5a74fb9bb1
commit
6494e0bf25
|
@ -722,7 +722,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getHierarchicalLabel = [&]( NETELEMENT_ID aNode ) -> SCH_HIERLABEL*
|
auto getHierarchicalLabel =
|
||||||
|
[&]( NETELEMENT_ID aNode ) -> SCH_HIERLABEL*
|
||||||
{
|
{
|
||||||
if( aNode.Contains( "BLKT" ) )
|
if( aNode.Contains( "BLKT" ) )
|
||||||
{
|
{
|
||||||
|
@ -905,7 +906,21 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we can load the wires
|
auto fixNetLabelsAndSheetPins =
|
||||||
|
[&]( double aWireAngleDeciDeg, NETELEMENT_ID& aNetEleID )
|
||||||
|
{
|
||||||
|
LABEL_SPIN_STYLE spin = getSpinStyleDeciDeg( aWireAngleDeciDeg );
|
||||||
|
|
||||||
|
if( netlabels.find( aNetEleID ) != netlabels.end() )
|
||||||
|
netlabels.at( aNetEleID )->SetLabelSpinStyle( spin.RotateCW().RotateCW() );
|
||||||
|
|
||||||
|
SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID );
|
||||||
|
|
||||||
|
if( sheetPin )
|
||||||
|
sheetPin->SetLabelSpinStyle( spin.MirrorX() );
|
||||||
|
};
|
||||||
|
|
||||||
|
// Now we can load the wires and fix the label orientations
|
||||||
for( const VECTOR2I& pt : wireChain.CPoints() )
|
for( const VECTOR2I& pt : wireChain.CPoints() )
|
||||||
{
|
{
|
||||||
if( firstPt )
|
if( firstPt )
|
||||||
|
@ -924,17 +939,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
wxPoint kiLast = last;
|
wxPoint kiLast = last;
|
||||||
wxPoint kiCurrent = (wxPoint) pt;
|
wxPoint kiCurrent = (wxPoint) pt;
|
||||||
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
|
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
|
||||||
LABEL_SPIN_STYLE spin = getSpinStyleDeciDeg( wireangleDeciDeg );
|
fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.StartNode );
|
||||||
|
|
||||||
if( netlabels.find( conn.StartNode ) != netlabels.end() )
|
|
||||||
{
|
|
||||||
netlabels.at( conn.StartNode )->SetLabelSpinStyle( spin );
|
|
||||||
}
|
|
||||||
|
|
||||||
SCH_HIERLABEL* sheetPin = getHierarchicalLabel( conn.StartNode );
|
|
||||||
|
|
||||||
if( sheetPin )
|
|
||||||
sheetPin->SetLabelSpinStyle( spin );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wire = new SCH_LINE();
|
wire = new SCH_LINE();
|
||||||
|
@ -957,15 +962,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
wxPoint kiLast = wire->GetEndPoint();
|
wxPoint kiLast = wire->GetEndPoint();
|
||||||
wxPoint kiCurrent = wire->GetStartPoint();
|
wxPoint kiCurrent = wire->GetStartPoint();
|
||||||
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
|
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
|
||||||
LABEL_SPIN_STYLE spin = getSpinStyleDeciDeg( wireangleDeciDeg );
|
fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.EndNode );
|
||||||
|
|
||||||
if( netlabels.find( conn.EndNode ) != netlabels.end() )
|
|
||||||
netlabels.at( conn.EndNode )->SetLabelSpinStyle( spin );
|
|
||||||
|
|
||||||
SCH_HIERLABEL* sheetPin = getHierarchicalLabel( conn.EndNode );
|
|
||||||
|
|
||||||
if( sheetPin )
|
|
||||||
sheetPin->SetLabelSpinStyle( spin );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue