Fix unnecessary calculations performed when a layer is set not to be an obstacle for other labels

This commit is contained in:
Nyall Dawson 2019-07-30 17:21:30 +10:00
parent 5931933b41
commit fc79502763
2 changed files with 3 additions and 3 deletions

View File

@ -199,7 +199,7 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
addedFeature = true;
}
if ( !featureGeomIsObstacleGeom )
if ( lf->isObstacle() && !featureGeomIsObstacleGeom )
{
//do the same for the obstacle geometry
simpleGeometries.reset( Util::unmulti( lf->obstacleGeometry() ) );

View File

@ -1964,7 +1964,7 @@ void QgsPalLayerSettings::registerFeature( const QgsFeature &f, QgsRenderContext
}
geos::unique_ptr geosObstacleGeomClone;
if ( !obstacleGeometry.isNull() )
if ( isObstacle && !obstacleGeometry.isNull() )
{
geosObstacleGeomClone = QgsGeos::asGeos( obstacleGeometry );
}
@ -2442,7 +2442,7 @@ void QgsPalLayerSettings::registerFeature( const QgsFeature &f, QgsRenderContext
( *labelFeature )->setIsObstacle( isObstacle );
double featObstacleFactor = obstacleFactor;
if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::ObstacleFactor ) )
if ( isObstacle && mDataDefinedProperties.isActive( QgsPalLayerSettings::ObstacleFactor ) )
{
context.expressionContext().setOriginalValueVariable( featObstacleFactor );
exprVal = mDataDefinedProperties.value( QgsPalLayerSettings::ObstacleFactor, context.expressionContext() );