45#include <QTextDocument>
46#include <QTextFragment>
56 mName = layerName.isEmpty() ?
layer->id() : layerName;
68 if (
mSettings.lineSettings().mergeLines() && !
mSettings.lineSettings().addDirectionSymbol() )
75 mVectorLabelProvider = std::make_unique<QgsVectorLayerLabelProvider>(
106 mVectorLabelProvider->setEngine(
mEngine );
131 std::unique_ptr< QgsLabelFeature > label =
mSettings.registerFeatureWithDetails( feature, context, obstacleGeometry, symbol );
132 QList< QgsLabelFeature * > res;
148 mVectorLabelProvider->drawLabel( context, label );
QgsLabelObstacleSettings::ObstacleType mObstacleType
Type of the obstacle of feature geometries.
QString mName
Name of the layer.
virtual void stopRender(QgsRenderContext &context)
To be called after rendering is complete.
double mPriority
Default priority of labels. 0 = highest priority, 1 = lowest priority.
const QgsLabelingEngine * mEngine
Associated labeling engine.
QgsMapLayer * layer() const
Returns the associated layer, or nullptr if no layer is associated with the provider.
Flags mFlags
Flags altering drawing and registration of features.
virtual void startRender(QgsRenderContext &context)
To be called before rendering of labels begins.
Qgis::LabelPlacement mPlacement
Placement strategy.
@ MergeConnectedLines
Whether adjacent lines (with the same label text) should be merged.
@ DrawLabels
Whether the labels should be rendered.
@ CentroidMustBeInside
Whether location of centroid must be inside of polygons.
QgsWeakMapLayerPointer mLayer
Weak pointer to source layer.
Qgis::UpsideDownLabelHandling mUpsidedownLabels
How to handle labels that would be upside down.
QString providerId() const
Returns provider ID - useful in case there is more than one label provider within a layer (e....
QgsAbstractLabelProvider(QgsMapLayer *layer, const QString &providerId=QString())
Construct the provider with default values.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
@ PolygonWhole
Avoid placing labels over ANY part of polygon. Where PolygonInterior will prefer to place labels with...
Contains configuration for rendering maps.
const QgsPalLayerSettings & settings() const
Returns the layer's settings.
QgsCoordinateReferenceSystem mCrs
Layer's CRS.
QgsMeshLayerLabelProvider(QgsMeshLayer *layer, const QString &providerId, const QgsPalLayerSettings *settings, const QString &layerName=QString(), bool labelFaces=false)
Convenience constructor to initialize the provider from given mesh layer.
bool labelFaces() const
Returns false if labeling mesh vertices, true if labeling mesh faces.
void stopRender(QgsRenderContext &context) override
To be called after rendering is complete.
void init()
initialization method - called from constructors
virtual QList< QgsLabelFeature * > registerFeature(const QgsFeature &feature, QgsRenderContext &context, const QgsGeometry &obstacleGeometry=QgsGeometry(), const QgsSymbol *symbol=nullptr)
Register a feature for labeling as one or more QgsLabelFeature objects stored into mLabels.
QList< QgsLabelFeature * > mLabels
List of generated.
~QgsMeshLayerLabelProvider() override
QgsPalLayerSettings mSettings
Layer's labeling configuration.
void startRender(QgsRenderContext &context) override
To be called before rendering of labels begins.
QList< QgsLabelFeature * > labelFeatures(QgsRenderContext &context) override
Returns list of label features (they are owned by the provider and thus deleted on its destruction).
void drawLabel(QgsRenderContext &context, pal::LabelPosition *label) const override
Draw this label at the position determined by the labeling engine.
virtual bool prepare(QgsRenderContext &context, QSet< QString > &attributeNames)
Prepare for registration of features.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Contains settings for how a map layer will be labeled.
Contains information about the context of a rendering operation.
Abstract base class for all rendered symbols.
LabelPosition is a candidate feature label position.