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
nyalldawson authored and github-actions[bot] committed Jan 31, 2025
1 parent c8129bb commit 6546954
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
@@ -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
@@ -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
@@ -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();

0 comments on commit 6546954

Please sign in to comment.