QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
16 #ifndef QGSLABELINGENGINE_H
17 #define QGSLABELINGENGINE_H
21 #include "qgis_core.h"
62 DrawAllLabels = 1 << 2,
63 MergeConnectedLines = 1 << 3,
64 CentroidMustBeInside = 1 << 4,
66 Q_DECLARE_FLAGS( Flags, Flag )
90 virtual
void drawUnplacedLabel(
QgsRenderContext &context,
pal::LabelPosition *label ) const;
104 virtual
void drawLabelBackground(
QgsRenderContext &context,
pal::LabelPosition *label ) const;
124 QString
name()
const {
return mName; }
140 Flags
flags()
const {
return mFlags; }
239 QList< QgsMapLayer * > participatingLayers()
const;
245 QStringList participatingLayerIds()
const;
302 void drawLabels(
QgsRenderContext &context,
const QString &layerId = QString() );
320 std::unique_ptr< pal::Pal >
mPal;
379 void renderLabelsForLayer(
QgsRenderContext &context,
const QString &layerId );
407 static QString encodePredefinedPositionOrder(
const QVector< QgsPalLayerSettings::PredefinedPointPosition > &positions );
415 static QVector< QgsPalLayerSettings::PredefinedPointPosition > decodePredefinedPositionOrder(
const QString &positionString );
421 static QString encodeLinePlacementFlags( QgsLabeling::LinePlacementFlags flags );
427 static QgsLabeling::LinePlacementFlags decodeLinePlacementFlags(
const QString &
string );
431 #endif // QGSLABELINGENGINE_H
Contains helper utilities for working with QGIS' labeling engine.
Flags mFlags
Flags altering drawing and registration of features.
QString layerId() const
Returns ID of associated layer, or empty string if no layer is associated with the provider.
std::unique_ptr< pal::Pal > mPal
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels() const
How to handle labels that would be upside down.
QList< QgsAbstractLabelProvider * > mProviders
List of providers (the are owned by the labeling engine)
A QgsLabelingEngine implementation, which only calculates the labeling solution during its run() meth...
QString mName
Name of the layer.
Class that stores computed placement from labeling engine.
QgsLabelObstacleSettings::ObstacleType obstacleType() const
How the feature geometries will work as obstacles.
QList< pal::LabelPosition * > mUnlabeled
Contains information about the context of a rendering operation.
Default QgsLabelingEngine implementation, which completes the whole labeling operation (including lab...
QgsStagedRenderLabelingEngine(const QgsStagedRenderLabelingEngine &rh)=delete
QgsStagedRenderLabelingEngine cannot be copied.
QList< QgsAbstractLabelProvider * > mSubProviders
QgsDefaultLabelingEngine & operator=(const QgsDefaultLabelingEngine &rh)=delete
QgsDefaultLabelingEngine cannot be copied.
double priority() const
Default priority of labels (may be overridden by individual labels)
QString mProviderId
Associated provider ID (one layer may have multiple providers, e.g. in rule-based labeling)
QgsPalLayerSettings::Placement placement() const
What placement strategy to use for the labels.
const QgsLabelingEngineSettings & engineSettings() const
Gets associated labeling engine settings.
QgsStagedRenderLabelingEngine & operator=(const QgsStagedRenderLabelingEngine &rh)=delete
QgsStagedRenderLabelingEngine cannot be copied.
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels
How to handle labels that would be upside down.
Placement
Placement modes which determine how label candidates are generated for a feature.
QString mLayerId
Associated layer's ID, if applicable.
The QgsAbstractLabelProvider class is an interface class.
Stores global configuration for labeling engine.
void setEngine(const QgsLabelingEngine *engine)
Associate provider with a labeling engine (should be only called internally from QgsLabelingEngine)
QString name() const
Name of the layer (for statistics, debugging etc.) - does not need to be unique.
virtual ~QgsAbstractLabelProvider()=default
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
virtual void run(QgsRenderContext &context)=0
Runs the labeling job.
QgsLabelingEngine & operator=(const QgsLabelingEngine &rh)=delete
QgsLabelingEngine cannot be copied.
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
QString providerId() const
Returns provider ID - useful in case there is more than one label provider within a layer (e....
QgsWeakMapLayerPointer mLayer
Weak pointer to source layer.
std::unique_ptr< pal::Problem > mProblem
The QgsLabelingEngine class provides map labeling functionality.
QgsLabelingEngine(const QgsLabelingEngine &rh)=delete
QgsLabelingEngine cannot be copied.
const QgsMapSettings & mapSettings() const
Gets associated map settings.
QgsLabelingResults * results() const
For internal use by the providers.
Base class for all map layer types.
std::unique_ptr< QgsLabelingResults > mResults
Resulting labeling layout.
QgsMapSettings mMapSettings
Associated map settings instance.
QgsMapLayer * layer() const
Returns the associated layer, or nullptr if no layer is associated with the provider.
Flags flags() const
Flags associated with the provider.
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels.
The QgsLabelFeature class describes a feature that should be used within the labeling engine.
The QgsMapSettings class contains configuration for rendering of the map.
QgsDefaultLabelingEngine(const QgsDefaultLabelingEngine &rh)=delete
QgsDefaultLabelingEngine cannot be copied.
QgsPalLayerSettings::Placement mPlacement
Placement strategy.
double mPriority
Default priority of labels.
QList< pal::LabelPosition * > mLabels