Subgroup: Abstract

Class: QgsAbstractVectorLayerLabeling

class qgis.core.QgsAbstractVectorLayerLabeling

Bases: sip.wrapper

Default constructor

Abstract base class - its implementations define different approaches to the labeling of a vector layer.

New in version 3.0: Methods

clone Return a new copy of the object
create Try to create instance of an implementation based on the XML data
requiresAdvancedEffects 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.
save Return labeling configuration as XML element
setSettings Set pal settings for a specific provider (takes ownership).
settings Get associated label settings.
subProviders Get list of sub-providers within the layer’s labeling.
toSld Writes the SE 1.
type Unique type string of the labeling configuration implementation
writeTextSymbolizer Writes a TextSymbolizer element contents based on the provided labeling settings

Signals

Attributes

clone(self) → QgsAbstractVectorLayerLabeling

Return a new copy of the object

create(element: QDomElement, context: QgsReadWriteContext) → QgsAbstractVectorLayerLabeling

Try to create instance of an implementation based on the XML data

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.

save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement

Return labeling configuration as XML element

setSettings(self, settings: QgsPalLayerSettings, providerId: str = '')

Set pal settings for a specific provider (takes ownership).

Parameters:
  • settings – Pal layer settings
  • providerId – The id of the provider

New in version 3.0.

settings(self, providerId: str = '') → QgsPalLayerSettings

Get 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)

subProviders(self) → List[str]

Get list of sub-providers within the layer’s labeling.

toSld(self, parent: QDomNode, props: Dict[str, str])

Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings

type(self) → str

Unique type string of the labeling configuration implementation

writeTextSymbolizer(self, parent: QDomNode, settings: QgsPalLayerSettings, props: Dict[str, str])

Writes a TextSymbolizer element contents based on the provided labeling settings

Parameters:
  • parent – the node that will have the text symbolizer element added to it
  • settings – the settings getting translated to a TextSymbolizer
  • props – a open ended set of properties that can drive/inform the SLD encoding