Class: QgsAbstractVectorLayerLabeling¶
- class qgis.core.QgsAbstractVectorLayerLabeling¶
Bases:
sip.wrapper
Abstract base class - its implementations define different approaches to the labeling of a vector layer.
New in version 3.0.
QgsAbstractVectorLayerLabeling() Default constructor
Methods
Accepts the specified symbology
visitor
, causing it to visit all symbols associated with the labeling.Returns a new copy of the object
Try to create instance of an implementation based on the XML data
Returns the default layer settings to use for the specified vector
layer
.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.Returns labeling configuration as XML element
Set pal settings for a specific provider (takes ownership).
Gets associated label settings.
Gets list of sub-providers within the layer's labeling.
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings
Unique type string of the labeling configuration implementation
Writes a TextSymbolizer element contents based on the provided labeling settings
- accept(self, visitor: QgsStyleEntityVisitorInterface) bool ¶
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.New in version 3.10.
- Parameters:
visitor (QgsStyleEntityVisitorInterface) –
- Return type:
bool
- clone(self) QgsAbstractVectorLayerLabeling ¶
Returns a new copy of the object
- Return type:
- create(element: QDomElement, context: QgsReadWriteContext) QgsAbstractVectorLayerLabeling ¶
Try to create instance of an implementation based on the XML data
- Parameters:
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type:
- defaultSettingsForLayer(layer: QgsVectorLayer) QgsPalLayerSettings ¶
Returns the default layer settings to use for the specified vector
layer
.New in version 3.20.
- Parameters:
layer (QgsVectorLayer) –
- Return type:
- requiresAdvancedEffects(self) bool ¶
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.New in version 3.0.
- Return type:
bool
- save(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
Returns labeling configuration as XML element
- Parameters:
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
QDomElement
- setSettings(self, settings: QgsPalLayerSettings, providerId: str = '')¶
Set pal settings for a specific provider (takes ownership).
- Parameters:
settings (QgsPalLayerSettings) – Pal layer settings
providerId (str = '') – The id of the provider
New in version 3.0.
- settings(self, providerId: str = '') QgsPalLayerSettings ¶
Gets associated label settings. In case of multiple sub-providers with different settings, they are identified by their ID (e.g. in case of rule-based labeling, provider ID == rule key)
- Parameters:
providerId (str = '') –
- Return type:
- subProviders(self) List[str] ¶
Gets list of sub-providers within the layer’s labeling.
- Return type:
List[str]
- toSld(self, parent: QDomNode, props: Dict[str, Any])¶
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings
- Parameters:
parent (QDomNode) –
props (Dict[str) –
- type(self) str ¶
Unique type string of the labeling configuration implementation
- Return type:
str
- writeTextSymbolizer(self, parent: QDomNode, settings: QgsPalLayerSettings, props: Dict[str, Any])¶
Writes a TextSymbolizer element contents based on the provided labeling settings
- Parameters:
parent (QDomNode) – the node that will have the text symbolizer element added to it
settings (QgsPalLayerSettings) – the settings getting translated to a TextSymbolizer
props (Dict[str) – a open ended set of properties that can drive/inform the SLD encoding