Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid recursive index calls
  • Loading branch information
nyalldawson committed Dec 10, 2019
1 parent 0362665 commit 7935b2e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/pal/problem.cpp
Expand Up @@ -210,14 +210,21 @@ void Problem::init_sol_falp()

lp->getBoundingBox( amin, amax );

mAllCandidatesIndex.intersects( QgsRectangle( amin[0], amin[1], amax[0], amax[1] ), [&list, lp, this]( const LabelPosition * lp2 ) ->bool
std::vector< const LabelPosition * > conflictingPositions;
mAllCandidatesIndex.intersects( QgsRectangle( amin[0], amin[1], amax[0], amax[1] ), [lp, &conflictingPositions]( const LabelPosition * lp2 ) ->bool
{
if ( lp->isInConflict( lp2 ) )
{
ignoreLabel( lp2, list, mAllCandidatesIndex );
conflictingPositions.emplace_back( lp2 );
}
return true;
} );

for ( const LabelPosition *conflict : conflictingPositions )
{
ignoreLabel( conflict, list, mAllCandidatesIndex );
}

mActiveCandidatesIndex.insert( lp, QgsRectangle( amin[0], amin[1], amax[0], amax[1] ) );
}

Expand Down

0 comments on commit 7935b2e

Please sign in to comment.