QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsAbstractVectorLayerLabeling Class Referenceabstract

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

#include <qgsvectorlayerlabeling.h>

Inheritance diagram for QgsAbstractVectorLayerLabeling:
Inheritance graph
[legend]

Public Member Functions

 QgsAbstractVectorLayerLabeling ()=default
 Default constructor. More...
 
virtual ~QgsAbstractVectorLayerLabeling ()=default
 
virtual bool accept (QgsStyleEntityVisitorInterface *visitor) const
 Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling. More...
 
virtual QgsAbstractVectorLayerLabelingclone () const =0
 Returns a new copy of the object. More...
 
virtual QgsVectorLayerLabelProviderprovider (QgsVectorLayer *layer) const
 Factory for label provider implementation. More...
 
virtual bool requiresAdvancedEffects () const =0
 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. More...
 
virtual QDomElement save (QDomDocument &doc, const QgsReadWriteContext &context) const =0
 Returns labeling configuration as XML element. More...
 
virtual void setSettings (QgsPalLayerSettings *settings, const QString &providerId=QString())=0
 Set pal settings for a specific provider (takes ownership). More...
 
virtual QgsPalLayerSettings settings (const QString &providerId=QString()) const =0
 Gets associated label settings. More...
 
virtual QStringList subProviders () const
 Gets list of sub-providers within the layer's labeling. More...
 
virtual void toSld (QDomNode &parent, const QVariantMap &props) const
 Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings. More...
 
virtual QString type () const =0
 Unique type string of the labeling configuration implementation. More...
 

Static Public Member Functions

static QgsAbstractVectorLayerLabelingcreate (const QDomElement &element, const QgsReadWriteContext &context)
 Try to create instance of an implementation based on the XML data. More...
 
static QgsPalLayerSettings defaultSettingsForLayer (const QgsVectorLayer *layer)
 Returns the default layer settings to use for the specified vector layer. More...
 

Protected Member Functions

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

Detailed Description

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

Since
QGIS 3.0

Definition at line 41 of file qgsvectorlayerlabeling.h.

Constructor & Destructor Documentation

◆ QgsAbstractVectorLayerLabeling()

QgsAbstractVectorLayerLabeling::QgsAbstractVectorLayerLabeling ( )
default

Default constructor.

◆ ~QgsAbstractVectorLayerLabeling()

virtual QgsAbstractVectorLayerLabeling::~QgsAbstractVectorLayerLabeling ( )
virtualdefault

Member Function Documentation

◆ accept()

bool QgsAbstractVectorLayerLabeling::accept ( QgsStyleEntityVisitorInterface visitor) const
virtual

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, or false if visiting should be canceled.

Since
QGIS 3.10

Reimplemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

Definition at line 44 of file qgsvectorlayerlabeling.cpp.

◆ clone()

virtual QgsAbstractVectorLayerLabeling* QgsAbstractVectorLayerLabeling::clone ( ) const
pure virtual

Returns a new copy of the object.

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ create()

QgsAbstractVectorLayerLabeling * QgsAbstractVectorLayerLabeling::create ( const QDomElement &  element,
const QgsReadWriteContext context 
)
static

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

Definition at line 27 of file qgsvectorlayerlabeling.cpp.

◆ defaultSettingsForLayer()

QgsPalLayerSettings QgsAbstractVectorLayerLabeling::defaultSettingsForLayer ( const QgsVectorLayer layer)
static

Returns the default layer settings to use for the specified vector layer.

Since
QGIS 3.20

Definition at line 49 of file qgsvectorlayerlabeling.cpp.

◆ provider()

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

Factory for label provider implementation.

Note
not available in Python bindings

Reimplemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

Definition at line 70 of file qgsvectorlayerlabeling.h.

◆ requiresAdvancedEffects()

virtual 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.

Since
QGIS 3.0

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ save()

virtual QDomElement QgsAbstractVectorLayerLabeling::save ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const
pure virtual

Returns labeling configuration as XML element.

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ setSettings()

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

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

Parameters
settingsPal layer settings
providerIdThe id of the provider
Since
QGIS 3.0

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ settings()

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

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ subProviders()

virtual QStringList QgsAbstractVectorLayerLabeling::subProviders ( ) const
inlinevirtual

Gets list of sub-providers within the layer's labeling.

Reimplemented in QgsRuleBasedLabeling.

Definition at line 76 of file qgsvectorlayerlabeling.h.

◆ toSld()

virtual void QgsAbstractVectorLayerLabeling::toSld ( QDomNode &  parent,
const QVariantMap &  props 
) const
inlinevirtual

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

Reimplemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

Definition at line 110 of file qgsvectorlayerlabeling.h.

◆ type()

virtual QString QgsAbstractVectorLayerLabeling::type ( ) const
pure virtual

Unique type string of the labeling configuration implementation.

Implemented in QgsVectorLayerSimpleLabeling, and QgsRuleBasedLabeling.

◆ writeTextSymbolizer()

void QgsAbstractVectorLayerLabeling::writeTextSymbolizer ( QDomNode &  parent,
QgsPalLayerSettings settings,
const QVariantMap &  props 
) const
protectedvirtual

Writes a TextSymbolizer element contents based on the provided labeling settings.

Parameters
parentthe node that will have the text symbolizer element added to it
settingsthe settings getting translated to a TextSymbolizer
propsa open ended set of properties that can drive/inform the SLD encoding

Definition at line 277 of file qgsvectorlayerlabeling.cpp.


The documentation for this class was generated from the following files: