Class: QgsAbstractLabelingEngineRuleDistanceFromFeature¶
Base class for labeling engine rules which prevent labels being placed too close or too far from features from a different layer.
Added in version 3.40.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: QgsAbstractLabelingEngineRule.clone()
, QgsAbstractLabelingEngineRule.displayType()
, QgsAbstractLabelingEngineRule.id()
Class Hierarchy¶
Base classes¶
Abstract base class for labeling engine rules. |
Subclasses¶
A labeling engine rule which prevents labels being placed too far from features from a different layer. |
|
A labeling engine rule which prevents labels being placed too close to features from a different layer. |
Methods
Returns the penalty cost incurred when the rule is violated. |
|
Returns the acceptable distance threshold between labels and the features from the |
|
Returns the units for the distance between labels and the features from the |
|
Returns the scaling for the distance between labels and the features from the |
|
Returns the layer providing the labels. |
|
Sets the penalty cost incurred when the rule is violated. |
|
Sets the acceptable distance threshold between labels and the features from the |
|
Sets the unit for the distance between labels and the features from the |
|
Sets the scale for the distance between labels and the features from the |
|
Sets the layer providing the labels. |
|
Sets the layer providing the features which labels must be distant from (or close to). |
|
Returns the layer providing the features which labels must be distant from (or close to). |
- class qgis.core.QgsAbstractLabelingEngineRuleDistanceFromFeature[source]¶
Bases:
QgsAbstractLabelingEngineRule
- cost(self) float [source]¶
Returns the penalty cost incurred when the rule is violated.
This is a value between 0 and 10, where 10 indicates that the rule must never be violated, and 1-9 = nice to have if possible, where higher numbers will try harder to avoid violating the rule.
See also
- Return type:
float
- distance(self) float [source]¶
Returns the acceptable distance threshold between labels and the features from the
targetLayer()
.See also
See also
- Return type:
float
- distanceUnit(self) Qgis.RenderUnit [source]¶
Returns the units for the distance between labels and the features from the
targetLayer()
.See also
See also
- Return type:
- distanceUnitScale(self) QgsMapUnitScale ¶
Returns the scaling for the distance between labels and the features from the
targetLayer()
.See also
See also
- Return type:
- labeledLayer(self) QgsMapLayer | None [source]¶
Returns the layer providing the labels.
See also
- Return type:
Optional[QgsMapLayer]
- setCost(self, cost: float)[source]¶
Sets the penalty
cost
incurred when the rule is violated.This is a value between 0 and 10, where 10 indicates that the rule must never be violated, and 1-9 = nice to have if possible, where higher numbers will try harder to avoid violating the rule.
See also
- Parameters:
cost (float)
- setDistance(self, distance: float)[source]¶
Sets the acceptable
distance
threshold between labels and the features from thetargetLayer()
.See also
See also
- Parameters:
distance (float)
- setDistanceUnit(self, unit: Qgis.RenderUnit)[source]¶
Sets the
unit
for the distance between labels and the features from thetargetLayer()
.See also
See also
- Parameters:
unit (Qgis.RenderUnit)
- setDistanceUnitScale(self, scale: QgsMapUnitScale)[source]¶
Sets the
scale
for the distance between labels and the features from thetargetLayer()
.See also
See also
- Parameters:
scale (QgsMapUnitScale)
- setLabeledLayer(self, layer: QgsMapLayer | None)[source]¶
Sets the
layer
providing the labels.See also
- Parameters:
layer (Optional[QgsMapLayer])
- setTargetLayer(self, layer: QgsVectorLayer | None)[source]¶
Sets the
layer
providing the features which labels must be distant from (or close to).See also
- Parameters:
layer (Optional[QgsVectorLayer])
- targetLayer(self) QgsVectorLayer | None [source]¶
Returns the layer providing the features which labels must be distant from (or close to).
See also
- Return type:
Optional[QgsVectorLayer]