47#include <QTextDocument>
48#include <QTextFragment>
55 , mLabelFaces( labelFaces )
56 , mCrs( layer->
crs() )
77 mVectorLabelProvider = std::make_unique<QgsVectorLayerLabelProvider>(
108 mVectorLabelProvider->setEngine(
mEngine );
134 QList< QgsLabelFeature * > res;
150 mVectorLabelProvider->drawLabel( context, label );
The QgsAbstractLabelProvider class is an interface class.
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.
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.
bool addDirectionSymbol() const
Returns true if '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) w...
bool mergeLines() const
Returns true if connected line features with identical label text should be merged prior to generatin...
ObstacleType type() const
Returns how features act as obstacles for labels.
@ PolygonWhole
Avoid placing labels over ANY part of polygon. Where PolygonInterior will prefer to place labels with...
const QgsMapSettings & mapSettings() const
Gets associated map settings.
The QgsMapSettings class contains configuration for rendering of the map.
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.
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.
const QgsLabelObstacleSettings & obstacleSettings() const
Returns the label obstacle settings.
std::unique_ptr< QgsLabelFeature > registerFeatureWithDetails(const QgsFeature &feature, QgsRenderContext &context, QgsGeometry obstacleGeometry=QgsGeometry(), const QgsSymbol *symbol=nullptr)
Registers a feature for labeling.
void startRender(QgsRenderContext &context)
Prepares the label settings for rendering.
Qgis::LabelPlacement placement
Label placement mode.
bool drawLabels
Whether to draw labels for this layer.
bool centroidInside
true if centroid positioned labels must be placed inside their corresponding feature polygon,...
int priority
Label priority.
bool prepare(QgsRenderContext &context, QSet< QString > &attributeNames, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs)
Prepare for registration of features.
const QgsLabelLineSettings & lineSettings() const
Returns the label line settings, which contain settings related to how the label engine places and fo...
Qgis::UpsideDownLabelHandling upsidedownLabels
Controls whether upside down labels are displayed and how they are handled.
void stopRender(QgsRenderContext &context)
Finalises the label settings after use.
Contains information about the context of a rendering operation.
Abstract base class for all rendered symbols.
LabelPosition is a candidate feature label position.
const QgsCoordinateReferenceSystem & crs