Class: QgsLabelObstacleSettings¶
- class qgis.core.QgsLabelObstacleSettings¶
Bases:
sip.wrapper
Contains settings related to how the label engine treats features as obstacles
New in version 3.10.2:
Methods
Returns the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels, > 1.0 less likely to be covered
Returns
True
if the features are obstacles to labels of other layers.Returns the label's obstacle geometry, if different to the feature geometry.
Sets the obstacle
factor
, where 1.0 = default, < 1.0 more likely to be covered by labels, > 1.0 less likely to be coveredSets whether features are obstacles to labels of other layers.
Sets the label's obstacle geometry, if different to the feature geometry.
Controls how features act as obstacles for labels.
Returns how features act as obstacles for labels.
Updates the obstacle settings to respect any data defined properties set within the specified
properties
collection.Attributes
- class ObstacleType¶
Bases:
int
- PolygonBoundary = 1¶
- PolygonInterior = 0¶
- PolygonWhole = 2¶
- factor(self) float ¶
Returns the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels, > 1.0 less likely to be covered
See also
See also
See also
- Return type:
float
- isObstacle(self) bool ¶
Returns
True
if the features are obstacles to labels of other layers.See also
See also
See also
- Return type:
bool
- obstacleGeometry(self) QgsGeometry ¶
Returns the label’s obstacle geometry, if different to the feature geometry.
See also
- Return type:
- setFactor(self, factor: float)¶
Sets the obstacle
factor
, where 1.0 = default, < 1.0 more likely to be covered by labels, > 1.0 less likely to be coveredSee also
See also
See also
- Parameters:
factor (float) –
- setIsObstacle(self, isObstacle: bool)¶
Sets whether features are obstacles to labels of other layers.
See also
See also
See also
- Parameters:
isObstacle (bool) –
- setObstacleGeometry(self, obstacleGeom: QgsGeometry)¶
Sets the label’s obstacle geometry, if different to the feature geometry. This can be used to override the shape of the feature for obstacle detection, e.g., to buffer around a point geometry to prevent labels being placed too close to the point itself. It not set, the feature’s geometry is used for obstacle detection.
See also
- Parameters:
obstacleGeom (QgsGeometry) –
- setType(self, type: QgsLabelObstacleSettings.ObstacleType)¶
Controls how features act as obstacles for labels.
See also
See also
See also
- Parameters:
- type(self) QgsLabelObstacleSettings.ObstacleType ¶
Returns how features act as obstacles for labels.
See also
See also
See also
- Return type:
- updateDataDefinedProperties(self, properties: QgsPropertyCollection, context: QgsExpressionContext)¶
Updates the obstacle settings to respect any data defined properties set within the specified
properties
collection.- Parameters:
properties (QgsPropertyCollection) –
context (QgsExpressionContext) –