mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
Fix obstacle factor is ignored when a layer is set to blocking mode
It was only correctly being respected for fully labeled layers
This commit is contained in:
parent
7f4226d209
commit
bee6ab846e
@ -2624,6 +2624,26 @@ void QgsPalLayerSettings::registerObstacleFeature( const QgsFeature &f, QgsRende
|
||||
*obstacleFeature = new QgsLabelFeature( f.id(), std::move( geos_geom_clone ), QSizeF( 0, 0 ) );
|
||||
( *obstacleFeature )->setIsObstacle( true );
|
||||
( *obstacleFeature )->setFeature( f );
|
||||
|
||||
double featObstacleFactor = obstacleFactor;
|
||||
if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::ObstacleFactor ) )
|
||||
{
|
||||
context.expressionContext().setOriginalValueVariable( featObstacleFactor );
|
||||
QVariant exprVal = mDataDefinedProperties.value( QgsPalLayerSettings::ObstacleFactor, context.expressionContext() );
|
||||
if ( exprVal.isValid() )
|
||||
{
|
||||
bool ok;
|
||||
double factorD = exprVal.toDouble( &ok );
|
||||
if ( ok )
|
||||
{
|
||||
factorD = qBound( 0.0, factorD, 10.0 );
|
||||
factorD = factorD / 5.0 + 0.0001; // convert 0 -> 10 to 0.0001 -> 2.0
|
||||
featObstacleFactor = factorD;
|
||||
}
|
||||
}
|
||||
}
|
||||
( *obstacleFeature )->setObstacleFactor( featObstacleFactor );
|
||||
|
||||
mFeatsRegPal++;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user