Skip to content
Permalink
Browse files

Fix setting atlas variables in main map canvas for previewing atlas

renders
  • Loading branch information
nyalldawson committed Sep 7, 2015
1 parent 2fe6d8c commit a45ead116f2b79858aa40f0459dce4f89a35f89d
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/app/composer/qgscomposer.cpp
@@ -1033,6 +1033,14 @@ void QgsComposer::atlasFeatureChanged( QgsFeature *feature )
mAtlasPageComboBox->setEditText( QString::number( mComposition->atlasComposition().currentFeatureNumber() + 1 ) );
}
mAtlasPageComboBox->blockSignals( false );

//update expression context variables in map canvas to allow for previewing atlas feature based renderering
mapCanvas()->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( "atlas_featurenumber", mComposition->atlasComposition().currentFeatureNumber() + 1, true ) );
mapCanvas()->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( "atlas_pagename", mComposition->atlasComposition().currentPageName(), true ) );
QgsFeature atlasFeature = mComposition->atlasComposition().feature();
mapCanvas()->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( "atlas_feature", QVariant::fromValue( atlasFeature ), true ) );
mapCanvas()->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( "atlas_featureid", atlasFeature.id(), true ) );
mapCanvas()->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( "atlas_geometry", QVariant::fromValue( *atlasFeature.constGeometry() ), true ) );
}

void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )

0 comments on commit a45ead1

Please sign in to comment.
You can’t perform that action at this time.