Class: QgsAbstractRasterLayerLabeling¶
Abstract base class for labeling settings for raster layers.
Added in version 3.42.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: clone()
, hasNonDefaultCompositionMode()
, requiresAdvancedEffects()
, save()
, type()
Class Hierarchy¶
Subclasses¶
Basic implementation of the labeling interface for raster layers. |
Abstract Methods
Returns a new copy of the object |
|
Returns |
|
Returns |
|
Saves the labeling configuration to an XML element. |
|
Unique type string of the labeling configuration implementation |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsAbstractRasterLayerLabeling. See the FAQ for more details.
Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling. |
|
Tests whether the labels should be visible at the specified scale. |
|
Multiply opacity by opacityFactor. |
|
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings |
Static Methods
Tries to create an instance of an implementation based on the XML data. |
|
Creates default labeling for a raster layer. |
- class qgis.core.QgsAbstractRasterLayerLabeling[source]¶
Bases:
object
- virtual accept(self, visitor: QgsStyleEntityVisitorInterface | None) bool [source]¶
Accepts the specified symbology
visitor
, causing it to visit all symbols associated with the labeling.Returns
True
if the visitor should continue visiting other objects, orFalse
if visiting should be canceled.- Parameters:
visitor (Optional[QgsStyleEntityVisitorInterface])
- Return type:
bool
- abstract clone(self) QgsAbstractRasterLayerLabeling | None [source]¶
Returns a new copy of the object
- Return type:
Optional[QgsAbstractRasterLayerLabeling]
- static createFromElement(element: QDomElement, context: QgsReadWriteContext) QgsAbstractRasterLayerLabeling | None [source]¶
Tries to create an instance of an implementation based on the XML data.
- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- Return type:
Optional[QgsAbstractRasterLayerLabeling]
- static defaultLabelingForLayer(layer: QgsRasterLayer | None) QgsAbstractRasterLayerLabeling | None [source]¶
Creates default labeling for a raster
layer
.- Parameters:
layer (Optional[QgsRasterLayer])
- Return type:
Optional[QgsAbstractRasterLayerLabeling]
- abstract hasNonDefaultCompositionMode(self) bool [source]¶
Returns
True
the labeling requires a non-default composition mode.This method is pessimistic, in that it will return
True
in cases where composition modes cannot be easily determined in advance (e.g. when data-defined overrides are in place for composition modes).The default composition mode is QPainter.CompositionMode_SourceOver.
Added in version 3.44.
- Return type:
bool
- virtual isInScaleRange(self, scale: float) bool [source]¶
Tests whether the labels should be visible at the specified
scale
. Thescale
value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.- Return type:
bool
- Returns:
True
if the labels are visible at the given scale.- Parameters:
scale (float)
- virtual multiplyOpacity(self, opacityFactor: float)[source]¶
Multiply opacity by
opacityFactor
.This method multiplies the opacity of the labeling elements (text, shadow, buffer etc.) by
opacity
effectively changing the opacity of the whole labeling elements.- Parameters:
opacityFactor (float)
- abstract requiresAdvancedEffects(self) bool [source]¶
Returns
True
if drawing labels requires advanced effects like composition modes, which could prevent it being used as an isolated cached image or exported to a vector format.- Return type:
bool
- abstract save(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement [source]¶
Saves the labeling configuration to an XML element.
See also
- Parameters:
doc (QDomDocument)
context (QgsReadWriteContext)
- Return type:
QDomElement