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 ) )
112 || mSettings->format().hasNonDefaultCompositionMode();
117 const QDomElement settingsElem = element.firstChildElement( QStringLiteral(
"settings" ) );
118 if ( !settingsElem.isNull() )
121 settings.readXml( settingsElem, context );
122 const bool labelFaces = element.attribute( QStringLiteral(
"labelFaces" ), QStringLiteral(
"0" ) ).toInt();
133 mSettings->setFormat( format );
138 Q_UNUSED( providerId )
QgsAbstractMeshLayerLabeling()=default
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.
Implements a label provider for mesh layers.
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.
bool hasNonDefaultCompositionMode() const override
Returns true the labeling requires a non-default composition mode.
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.
@ FontBlendMode
Text blend mode.
bool containsAdvancedEffects() const
Returns true if any component of the label settings requires advanced effects such as blend modes,...
A container for the context for various read/write operations on 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.
void multiplyOpacity(double opacityFactor)
Multiply opacity by opacityFactor.