Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added @zoom_level variable for data-defined styling
  • Loading branch information
wonder-sk authored and nyalldawson committed Apr 14, 2020
1 parent 1f55462 commit a3807cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/vectortile/qgsvectortilelayerrenderer.cpp
Expand Up @@ -113,6 +113,11 @@ bool QgsVectorTileLayerRenderer::render()
if ( ctx.renderingStopped() )
return false;

// add @zoom_level variable which can be used in styling
QgsExpressionContextScope *scope = new QgsExpressionContextScope( QObject::tr( "Tiles" ) ); // will be deleted by popper
scope->setVariable( "zoom_level", mTileZoom, true );
QgsExpressionContextScopePopper popper( ctx.expressionContext(), scope );

mRenderer->startRender( *renderContext(), mTileZoom, mTileRange );

QMap<QString, QSet<QString> > requiredFields = mRenderer->usedAttributes( ctx );
Expand Down

0 comments on commit a3807cf

Please sign in to comment.