Skip to content

Commit

Permalink
[pal] reverse iterate through layers
Browse files Browse the repository at this point in the history
We want the highest layers in the layer tree to be handled first
  • Loading branch information
nyalldawson committed Jan 31, 2025
1 parent 27a2846 commit 31df6fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/pal/pal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ std::unique_ptr<Problem> Pal::extractProblem( const QgsRectangle &extent, const
candidateProfile = std::make_unique< QgsScopedRuntimeProfile >( QObject::tr( "Generating label candidates" ), QStringLiteral( "rendering" ) );
}

for ( const auto &it : mLayers )
for ( auto it = mLayers.rbegin(); it != mLayers.rend(); ++it )
{
index++;
if ( feedback )
feedback->setProgress( index * step );

Layer *layer = it.second.get();
Layer *layer = it->second.get();
if ( !layer )
{
// invalid layer name
Expand All @@ -181,12 +181,12 @@ std::unique_ptr<Problem> Pal::extractProblem( const QgsRectangle &extent, const
continue;

if ( feedback )
feedback->emit candidateCreationAboutToBegin( it.first );
feedback->emit candidateCreationAboutToBegin( it->first );

std::unique_ptr< QgsScopedRuntimeProfile > layerProfile;
if ( context.flags() & Qgis::RenderContextFlag::RecordProfile )
{
layerProfile = std::make_unique< QgsScopedRuntimeProfile >( it.first->providerId(), QStringLiteral( "rendering" ) );
layerProfile = std::make_unique< QgsScopedRuntimeProfile >( it->first->providerId(), QStringLiteral( "rendering" ) );
}

// check for connected features with the same label text and join them
Expand Down Expand Up @@ -338,7 +338,7 @@ std::unique_ptr<Problem> Pal::extractProblem( const QgsRectangle &extent, const
previousObstacleCount = obstacleCount;

if ( feedback )
feedback->emit candidateCreationFinished( it.first );
feedback->emit candidateCreationFinished( it->first );
}

candidateProfile.reset();
Expand Down

0 comments on commit 31df6fa

Please sign in to comment.