mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Avoid unused expression context updates in more places
This commit is contained in:
parent
e4ab1a6763
commit
24fb28f7bb
@ -710,10 +710,11 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
|
||||
mSymbolRenderContext->setGeometryPartCount( segmentizedGeometry.constGet()->partCount() );
|
||||
mSymbolRenderContext->setGeometryPartNum( 1 );
|
||||
|
||||
bool needsExpressionContext = hasDataDefinedProperties();
|
||||
ExpressionContextScopePopper scopePopper;
|
||||
if ( mSymbolRenderContext->expressionContextScope() )
|
||||
{
|
||||
if ( hasDataDefinedProperties() )
|
||||
if ( needsExpressionContext )
|
||||
{
|
||||
// this is somewhat nasty - by appending this scope here it's now owned
|
||||
// by both mSymbolRenderContext AND context.expressionContext()
|
||||
@ -835,7 +836,8 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
|
||||
for ( int i = 0; i < mp.numGeometries(); ++i )
|
||||
{
|
||||
mSymbolRenderContext->setGeometryPartNum( i + 1 );
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
if ( needsExpressionContext )
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
|
||||
const QgsPoint &point = static_cast< const QgsPoint & >( *mp.geometryN( i ) );
|
||||
const QPointF pt = _getPoint( context, point );
|
||||
@ -864,7 +866,8 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
|
||||
for ( unsigned int i = 0; i < num; ++i )
|
||||
{
|
||||
mSymbolRenderContext->setGeometryPartNum( i + 1 );
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
if ( needsExpressionContext )
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
|
||||
context.setGeometry( geomCollection.geometryN( i ) );
|
||||
const QgsCurve &curve = dynamic_cast<const QgsCurve &>( *geomCollection.geometryN( i ) );
|
||||
@ -922,7 +925,8 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
|
||||
{
|
||||
const unsigned i = listPartIndex[idx];
|
||||
mSymbolRenderContext->setGeometryPartNum( i + 1 );
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
if ( needsExpressionContext )
|
||||
mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) );
|
||||
|
||||
context.setGeometry( geomCollection.geometryN( i ) );
|
||||
const QgsPolygon &polygon = dynamic_cast<const QgsPolygon &>( *geomCollection.geometryN( i ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user