Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 committed Jan 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e928b88 commit 1f91240
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 1f91240

Please sign in to comment.