27 const QString
type = element.attribute( QStringLiteral(
"type" ) );
28 if (
type == QLatin1String(
"simple" ) )
56 , mLabelFaces( labelFaces )
62 return QStringLiteral(
"simple" );
77 QDomElement elem = doc.createElement( QStringLiteral(
"labeling" ) );
78 elem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"simple" ) );
79 elem.setAttribute( QStringLiteral(
"labelFaces" ), mLabelFaces ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
80 elem.appendChild( mSettings->writeXml( doc, context ) );
86 Q_UNUSED( providerId )
95 if ( !visitor->
visit( &entity ) )
103 return mSettings->containsAdvancedEffects();
108 const QDomElement settingsElem = element.firstChildElement( QStringLiteral(
"settings" ) );
109 if ( !settingsElem.isNull() )
113 const bool labelFaces = element.attribute( QStringLiteral(
"labelFaces" ), QStringLiteral(
"0" ) ).toInt();
123 format.multiplyOpacity( opacityFactor );
124 mSettings->setFormat( format );
129 Q_UNUSED( providerId )
Abstract base class - its implementations define different approaches to the labeling of a mesh layer...
static QgsPalLayerSettings defaultSettingsForLayer(const QgsMeshLayer *layer)
Returns the default layer settings to use for the specified mesh layer.
static QgsAbstractMeshLayerLabeling * create(const QDomElement &element, const QgsReadWriteContext &context)
Try to create instance of an implementation based on the XML data.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling...
virtual QString type() const =0
Unique type string of the labeling configuration implementation.
virtual QgsPalLayerSettings settings(const QString &providerId=QString()) const =0
Gets associated label settings.
QgsProject * project() const
Returns the parent project if this map layer is added to a project.
The QgsMeshLayerLabelProvider class implements a label provider for mesh layers.
Basic implementation of the labeling interface for mesh layer.
QgsMeshLayerLabelProvider * provider(QgsMeshLayer *layer) const override
QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) const override
Returns labeling configuration as XML element.
void setSettings(QgsPalLayerSettings *settings, const QString &providerId=QString()) override
Set pal settings (takes ownership).
QgsMeshLayerSimpleLabeling * clone() const override
Returns a new copy of the object.
void multiplyOpacity(double opacityFactor) override
Multiply opacity by opacityFactor.
static QgsMeshLayerSimpleLabeling * create(const QDomElement &element, const QgsReadWriteContext &context)
Create the instance from a DOM element with saved configuration.
bool requiresAdvancedEffects() const override
Returns true if drawing labels requires advanced effects like composition modes, which could prevent ...
QgsPalLayerSettings settings(const QString &providerId=QString()) const override
Gets associated label settings.
QgsMeshLayerSimpleLabeling(const QgsPalLayerSettings &settings, bool labelFaces=false)
Constructs simple labeling configuration with given initial settings.
QString type() const override
Unique type string of the labeling configuration implementation.
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling...
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Contains settings for how a map layer will be labeled.
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
The class is used as a container of context for various read/write operations on other objects.
An interface for classes which can visit style entity (e.g.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
A label settings entity for QgsStyle databases.
static QgsTextFormat defaultTextFormatForProject(QgsProject *project, QgsStyle::TextFormatContext context=QgsStyle::TextFormatContext::Labeling)
Returns the default text format to use for new text based objects for the specified project,...
Container for all settings relating to text rendering.