Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix missing map settings expression variables in composer maps
Missing map extent related variables were causing stacking order
issues with the 25d renderer (fix #14604)
- Loading branch information
Showing
with
11 additions
and
0 deletions.
-
+8
−0
src/core/composer/qgscomposermap.cpp
-
+3
−0
src/core/qgsexpressioncontext.cpp
|
@@ -2151,6 +2151,14 @@ QgsExpressionContext* QgsComposerMap::createExpressionContext() const |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_id", QgsComposerItem::id(), true ) ); |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_rotation", mMapRotation, true ) ); |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_scale", scale(), true ) ); |
|
|
|
|
|
QgsRectangle extent( *currentMapExtent() ); |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", extent.width(), true ) ); |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", extent.height(), true ) ); |
|
|
QgsGeometry* centerPoint = QgsGeometry::fromPoint( extent.center() ); |
|
|
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_center", QVariant::fromValue( *centerPoint ), true ) ); |
|
|
delete centerPoint; |
|
|
|
|
|
context->appendScope( scope ); |
|
|
|
|
|
return context; |
|
|
|
@@ -713,6 +713,9 @@ void QgsExpressionContextUtils::setLayerVariables( QgsMapLayer* layer, const Qgs |
|
|
|
|
|
QgsExpressionContextScope* QgsExpressionContextUtils::mapSettingsScope( const QgsMapSettings& mapSettings ) |
|
|
{ |
|
|
// IMPORTANT: ANY CHANGES HERE ALSO NEED TO BE MADE TO QgsComposerMap::createExpressionContext() |
|
|
// (rationale is described in QgsComposerMap::createExpressionContext() ) |
|
|
|
|
|
QgsExpressionContextScope* scope = new QgsExpressionContextScope( QObject::tr( "Map Settings" ) ); |
|
|
|
|
|
//add known map settings context variables |
|
|