mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
LTspice import: adapt label spin when multiple wires connected
(cherry picked from commit 37103c6e157686b46293ccf9940b57fb8aff5211)
This commit is contained in:
parent
496fc3b6bf
commit
c737bd392e
@ -934,6 +934,8 @@ SCH_IO_LTSPICE_PARSER::CreateSCH_LABEL( KICAD_T aType, const VECTOR2I& aOffset,
|
||||
label->SetVisible( true );
|
||||
}
|
||||
|
||||
std::vector<SPIN_STYLE> preferredSpins;
|
||||
|
||||
for( LTSPICE_SCHEMATIC::WIRE& wire : aWires )
|
||||
{
|
||||
if( aOffset == wire.Start )
|
||||
@ -941,16 +943,16 @@ SCH_IO_LTSPICE_PARSER::CreateSCH_LABEL( KICAD_T aType, const VECTOR2I& aOffset,
|
||||
if( wire.Start.x == wire.End.x )
|
||||
{
|
||||
if( wire.Start.y < wire.End.y )
|
||||
label->SetSpinStyle( SPIN_STYLE::UP );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::UP );
|
||||
else if( wire.Start.y > wire.End.y )
|
||||
label->SetSpinStyle( SPIN_STYLE::BOTTOM );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::BOTTOM );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wire.Start.x < wire.End.x )
|
||||
label->SetSpinStyle( SPIN_STYLE::LEFT );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::LEFT );
|
||||
else if( wire.Start.x > wire.End.x )
|
||||
label->SetSpinStyle( SPIN_STYLE::RIGHT );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::RIGHT );
|
||||
}
|
||||
}
|
||||
else if( aOffset == wire.End )
|
||||
@ -958,20 +960,23 @@ SCH_IO_LTSPICE_PARSER::CreateSCH_LABEL( KICAD_T aType, const VECTOR2I& aOffset,
|
||||
if( wire.Start.x == wire.End.x )
|
||||
{
|
||||
if( wire.Start.y > wire.End.y )
|
||||
label->SetSpinStyle( SPIN_STYLE::UP );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::UP );
|
||||
else if( wire.Start.y < wire.End.y )
|
||||
label->SetSpinStyle( SPIN_STYLE::BOTTOM );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::BOTTOM );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wire.Start.x > wire.End.x )
|
||||
label->SetSpinStyle( SPIN_STYLE::LEFT );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::LEFT );
|
||||
else if( wire.Start.x < wire.End.x )
|
||||
label->SetSpinStyle( SPIN_STYLE::RIGHT );
|
||||
preferredSpins.emplace_back( SPIN_STYLE::RIGHT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( preferredSpins.size() == 1 )
|
||||
label->SetSpinStyle( preferredSpins.front() );
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user