Skip to content

Commit

Permalink
[pal] Only truncate the feature candidate list after we've pruned all…
Browse files Browse the repository at this point in the history
… hard conflicts

Avoids throwing away potentially good candidates too early
  • Loading branch information
nyalldawson committed Dec 15, 2019
1 parent da5cd52 commit c235652
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/core/pal/pal.cpp
Expand Up @@ -307,14 +307,6 @@ std::unique_ptr<Problem> Pal::extract( const QgsRectangle &extent, const QgsGeom
if ( isCanceled() )
return nullptr;

// only keep the 'max_p' best candidates
while ( feat->candidates.size() > max_p )
{
// TODO remove from index
feat->candidates.back()->removeFromIndex( prob->mAllCandidatesIndex );
feat->candidates.pop_back();
}

switch ( mPlacementVersion )
{
case QgsLabelingEngineSettings::PlacementEngineVersion1:
Expand Down Expand Up @@ -347,6 +339,13 @@ std::unique_ptr<Problem> Pal::extract( const QgsRectangle &extent, const QgsGeom
}
}

// only keep the 'max_p' best candidates
while ( feat->candidates.size() > max_p )
{
feat->candidates.back()->removeFromIndex( prob->mAllCandidatesIndex );
feat->candidates.pop_back();
}

if ( isCanceled() )
return nullptr;

Expand Down

0 comments on commit c235652

Please sign in to comment.