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