7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-02 00:26:45 +00:00

router: fix regression in optimization of head lines

This commit is contained in:
Tomasz Wlostowski 2024-12-28 17:34:34 +01:00
parent 58f5e61186
commit 3ab59dfa67
3 changed files with 6 additions and 8 deletions

View File

@ -991,8 +991,6 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai
if( m_shove->HeadsModified() )
newHead = m_shove->GetModifiedHead( 0 );
OPTIMIZER optimizer( m_currentNode );
if( newHead.EndsWithVia() )
{
PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-preopt" );
@ -1005,9 +1003,8 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai
if( newHead.EndsWithVia() )
aNewHead.AppendVia( newHead.Via() );
optimizer.SetEffortLevel( effort );
optimizer.SetCollisionMask( ITEM::ANY_T );
optimizer.Optimize( &aNewHead );
OPTIMIZER::Optimize( &aNewHead, effort, m_currentNode );
PNS_DBG( Dbg(), AddItem, aNewHead.Clone(), GREEN, 1000000, "head-sh-postopt" );
return true;
}

View File

@ -1103,7 +1103,7 @@ bool OPTIMIZER::runSmartPads( LINE* aLine )
}
bool OPTIMIZER::Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV )
bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV )
{
OPTIMIZER opt( aWorld );
@ -1113,7 +1113,8 @@ bool OPTIMIZER::Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld, con
if( aEffortLevel & OPTIMIZER::PRESERVE_VERTEX )
opt.SetPreserveVertex( aV );
return opt.Optimize( aLine );
LINE tmp( *aLine );
return opt.Optimize( &tmp, aLine );
}

View File

@ -113,7 +113,7 @@ public:
~OPTIMIZER();
///< A quick shortcut to optimize a line without creating and setting up an optimizer.
static bool Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld,
static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld,
const VECTOR2I& aV = VECTOR2I(0, 0) );
bool Optimize( const LINE* aLine, LINE* aResult = nullptr, LINE* aRoot = nullptr );