QgsRenderContext QgsPointMarkerItem::renderContext( QPainter* painter ) { QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) << new QgsExpressionContextScope( mMapCanvas->expressionContextScope() ); } else { context << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } //context << QgsExpressionContextUtils::layerScope( mLayer ); context.setFeature( mFeature ); //setup render context QgsMapSettings ms = mMapCanvas->mapSettings(); ms.setExpressionContext( context ); QgsRenderContext rc = QgsRenderContext::fromMapSettings( ms ); rc.setPainter( painter ); return rc; }
QgsExpressionContext QgsGraduatedSymbolRendererWidget::createExpressionContext() const { QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope( QgsProject::instance() ) << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mContext.mapCanvas() ) { expContext << QgsExpressionContextUtils::mapSettingsScope( mContext.mapCanvas()->mapSettings() ) << new QgsExpressionContextScope( mContext.mapCanvas()->expressionContextScope() ); } else { expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } if ( vectorLayer() ) expContext << QgsExpressionContextUtils::layerScope( vectorLayer() ); // additional scopes Q_FOREACH ( const QgsExpressionContextScope& scope, mContext.additionalExpressionContextScopes() ) { expContext.appendScope( new QgsExpressionContextScope( scope ) ); } return expContext; }
static QgsExpressionContext _getExpressionContext( const void* context ) { QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::atlasScope( 0 ) //TODO - use actual map canvas settings << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); const QgsVectorLayer* layer = ( const QgsVectorLayer* ) context; if ( layer ) expContext << QgsExpressionContextUtils::layerScope( layer ); return expContext; }
static QList<QgsExpressionContextScope *> _globalProjectAtlasMapLayerScopes( QgsMapCanvas *mapCanvas, const QgsMapLayer *layer ) { QList<QgsExpressionContextScope *> scopes; scopes << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope( QgsProject::instance() ) << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mapCanvas ) { scopes << QgsExpressionContextUtils::mapSettingsScope( mapCanvas->mapSettings() ) << new QgsExpressionContextScope( mapCanvas->expressionContextScope() ); } else { scopes << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } scopes << QgsExpressionContextUtils::layerScope( layer ); return scopes; }
QList<QgsExpressionContextScope *> QgsSymbolWidgetContext::globalProjectAtlasMapLayerScopes( const QgsMapLayer* layer ) const { QList<QgsExpressionContextScope *> scopes; scopes << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope( QgsProject::instance() ) << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { scopes << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) << new QgsExpressionContextScope( mMapCanvas->expressionContextScope() ); } else { scopes << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } if ( layer ) scopes << QgsExpressionContextUtils::layerScope( layer ); return scopes; }
QgsExpressionContext QgsGraduatedSymbolRendererWidget::createExpressionContext() const { QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mapCanvas() ) { expContext << QgsExpressionContextUtils::mapSettingsScope( mapCanvas()->mapSettings() ) << new QgsExpressionContextScope( mapCanvas()->expressionContextScope() ); } else { expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } if ( vectorLayer() ) expContext << QgsExpressionContextUtils::layerScope( vectorLayer() ); return expContext; }
static QgsExpressionContext _getExpressionContext( const void* context ) { const QgsGraduatedSymbolRendererV2Widget* widget = ( const QgsGraduatedSymbolRendererV2Widget* ) context; QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { expContext << QgsExpressionContextUtils::mapSettingsScope( widget->mapCanvas()->mapSettings() ) << new QgsExpressionContextScope( widget->mapCanvas()->expressionContextScope() ); } else { expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } if ( widget->vectorLayer() ) expContext << QgsExpressionContextUtils::layerScope( widget->vectorLayer() ); return expContext; }
static QgsExpressionContext _getExpressionContext( const void* context ) { const QgsHeatmapRendererWidget* widget = reinterpret_cast< const QgsHeatmapRendererWidget* >( context ); QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { expContext << QgsExpressionContextUtils::mapSettingsScope( widget->mapCanvas()->mapSettings() ) << new QgsExpressionContextScope( widget->mapCanvas()->expressionContextScope() ); } else { expContext << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() ); } if ( widget->vectorLayer() ) expContext << QgsExpressionContextUtils::layerScope( widget->vectorLayer() ); return expContext; }