QgsAbstractVectorLayerLabeling class

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

Derived classes

class QgsRuleBasedLabeling
class QgsVectorLayerSimpleLabeling
Basic implementation of the labeling interface.

Public static functions

static auto create(const QDomElement& element, const QgsReadWriteContext& context) -> QgsAbstractVectorLayerLabeling*
Try to create instance of an implementation based on the XML data.

Constructors, destructors, conversion operators

QgsAbstractVectorLayerLabeling() defaulted
Default constructor.

Public functions

auto clone() const -> QgsAbstractVectorLayerLabeling* pure virtual
Returns a new copy of the object.
auto provider(QgsVectorLayer* layer) const -> QgsVectorLayerLabelProvider* virtual
Factory for label provider implementation.
auto requiresAdvancedEffects() const -> bool pure virtual
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.
auto save(QDomDocument& doc, const QgsReadWriteContext& context) const -> QDomElement pure virtual
Returns labeling configuration as XML element.
void setSettings(QgsPalLayerSettings* settings, const QString& providerId = QString()) pure virtual
Set pal settings for a specific provider (takes ownership).
auto settings(const QString& providerId = QString()) const -> QgsPalLayerSettings pure virtual
Gets associated label settings.
auto subProviders() const -> QStringList virtual
Gets list of sub-providers within the layer's labeling.
void toSld(QDomNode& parent, const QgsStringMap& props) const virtual
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings.
auto type() const -> QString pure virtual
Unique type string of the labeling configuration implementation.

Protected functions

void writeTextSymbolizer(QDomNode& parent, QgsPalLayerSettings& settings, const QgsStringMap& props) const virtual
Writes a TextSymbolizer element contents based on the provided labeling settings.

Function documentation

QgsVectorLayerLabelProvider* QgsAbstractVectorLayerLabeling::provider(QgsVectorLayer* layer) const virtual

Factory for label provider implementation.

bool QgsAbstractVectorLayerLabeling::requiresAdvancedEffects() const pure virtual

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.

void QgsAbstractVectorLayerLabeling::setSettings(QgsPalLayerSettings* settings, const QString& providerId = QString()) pure virtual

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

Parameters
settings Pal layer settings
providerId The id of the provider

QgsPalLayerSettings QgsAbstractVectorLayerLabeling::settings(const QString& providerId = QString()) const pure virtual

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)

void QgsAbstractVectorLayerLabeling::writeTextSymbolizer(QDomNode& parent, QgsPalLayerSettings& settings, const QgsStringMap& props) const virtual protected

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