QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
Implementation class for QgsVectorTileBasicLabeling. More...
#include <qgsvectortilebasiclabeling.h>
Public Member Functions | |
QgsVectorTileBasicLabelProvider (QgsVectorTileLayer *layer, const QList< QgsVectorTileBasicLabelingStyle > &styles) | |
Constructs a label provider for the given vector tile layer and using styling from QgsVectorTileBasicLabeling. | |
bool | prepare (QgsRenderContext &context, QSet< QString > &attributeNames) override |
Prepare for registration of features. | |
void | registerTileFeatures (const QgsVectorTileRendererData &tile, QgsRenderContext &context) override |
Registers label features for given tile to the labeling engine. | |
QSet< QString > | requiredLayers (QgsRenderContext &context, int tileZoom) const override |
Returns a list of the layers required for labeling. | |
void | setFields (const QMap< QString, QgsFields > &perLayerFields) override |
Sets fields for each sub-layer. | |
QList< QgsAbstractLabelProvider * > | subProviders () override |
Returns list of child providers - useful if the provider needs to put labels into more layers with different configuration. | |
QMap< QString, QSet< QString > > | usedAttributes (const QgsRenderContext &context, int tileZoom) const override |
Returns field names for each sub-layer that are required for labeling. | |
Public Member Functions inherited from QgsVectorTileLabelProvider | |
QgsVectorTileLabelProvider (QgsVectorTileLayer *layer) | |
Constructs base label provider class for the given vector tile layer. | |
Public Member Functions inherited from QgsVectorLayerLabelProvider | |
QgsVectorLayerLabelProvider (Qgis::GeometryType geometryType, const QgsFields &fields, const QgsCoordinateReferenceSystem &crs, const QString &providerId, const QgsPalLayerSettings *settings, QgsMapLayer *layer, const QString &layerName=QString()) | |
Constructor to initialize the provider from any map layer (e.g. vector tile layer) | |
QgsVectorLayerLabelProvider (QgsVectorLayer *layer, const QString &providerId, bool withFeatureLoop, const QgsPalLayerSettings *settings, const QString &layerName=QString()) | |
Convenience constructor to initialize the provider from given vector layer. | |
~QgsVectorLayerLabelProvider () override | |
void | drawLabel (QgsRenderContext &context, pal::LabelPosition *label) const override |
Draw this label at the position determined by the labeling engine. | |
void | drawLabelBackground (QgsRenderContext &context, pal::LabelPosition *label) const override |
Draw the background for the specified label. | |
void | drawUnplacedLabel (QgsRenderContext &context, pal::LabelPosition *label) const override |
Draw an unplaced label. | |
QList< QgsLabelFeature * > | labelFeatures (QgsRenderContext &context) override |
Returns list of label features (they are owned by the provider and thus deleted on its destruction) | |
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. | |
void | setFields (const QgsFields &fields) |
Sets fields of this label provider. | |
const QgsPalLayerSettings & | settings () const |
Returns the layer's settings. | |
void | startRender (QgsRenderContext &context) override |
To be called before rendering of labels begins. | |
void | stopRender (QgsRenderContext &context) override |
To be called after rendering is complete. | |
Public Member Functions inherited from QgsAbstractLabelProvider | |
QgsAbstractLabelProvider (QgsMapLayer *layer, const QString &providerId=QString()) | |
Construct the provider with default values. | |
virtual | ~QgsAbstractLabelProvider ()=default |
Flags | flags () const |
Flags associated with the provider. | |
QgsMapLayer * | layer () const |
Returns the associated layer, or nullptr if no layer is associated with the provider. | |
QgsExpressionContextScope * | layerExpressionContextScope () const |
Returns the expression context scope created from the layer associated with this provider. | |
QString | layerId () const |
Returns ID of associated layer, or empty string if no layer is associated with the provider. | |
double | layerReferenceScale () const |
Returns the symbology reference scale of the layer associated with this provider. | |
QString | name () const |
Name of the layer (for statistics, debugging etc.) - does not need to be unique. | |
QgsLabelObstacleSettings::ObstacleType | obstacleType () const |
How the feature geometries will work as obstacles. | |
Qgis::LabelPlacement | placement () const |
What placement strategy to use for the labels. | |
double | priority () const |
Default priority of labels (may be overridden by individual labels). | |
QString | providerId () const |
Returns provider ID - useful in case there is more than one label provider within a layer (e.g. | |
void | setEngine (const QgsLabelingEngine *engine) |
Associate provider with a labeling engine (should be only called internally from QgsLabelingEngine) | |
Qgis::UpsideDownLabelHandling | upsidedownLabels () const |
How to handle labels that would be upside down. | |
Public Attributes | |
QMap< QString, QgsFields > | mPerLayerFields |
Names of required fields for each sub-layer (only valid between startRender/stopRender calls) | |
Additional Inherited Members | |
Public Types inherited from QgsAbstractLabelProvider | |
enum | Flag { DrawLabels = 1 << 1 , MergeConnectedLines = 1 << 3 , CentroidMustBeInside = 1 << 4 } |
typedef QFlags< Flag > | Flags |
Static Public Member Functions inherited from QgsVectorLayerLabelProvider | |
static QgsGeometry | getPointObstacleGeometry (QgsFeature &fet, QgsRenderContext &context, const QgsSymbolList &symbols) |
Returns the geometry for a point feature which should be used as an obstacle for labels. | |
Protected Member Functions inherited from QgsVectorLayerLabelProvider | |
void | drawLabelPrivate (pal::LabelPosition *label, QgsRenderContext &context, QgsPalLayerSettings &tmpLyr, Qgis::TextComponent drawType, double dpiRatio=1.0) const |
Internal label drawing method. | |
void | init () |
initialization method - called from constructors | |
Protected Attributes inherited from QgsVectorLayerLabelProvider | |
QgsCoordinateReferenceSystem | mCrs |
Layer's CRS. | |
QgsFields | mFields |
Layer's fields. | |
QList< QgsLabelFeature * > | mLabels |
List of generated. | |
Qgis::GeometryType | mLayerGeometryType |
Geometry type of layer. | |
QgsFeatureRenderer * | mRenderer = nullptr |
QgsPalLayerSettings | mSettings |
Layer's labeling configuration. | |
std::unique_ptr< QgsAbstractFeatureSource > | mSource |
Layer's feature source. | |
Protected Attributes inherited from QgsAbstractLabelProvider | |
const QgsLabelingEngine * | mEngine = nullptr |
Associated labeling engine. | |
Flags | mFlags = DrawLabels |
Flags altering drawing and registration of features. | |
QgsWeakMapLayerPointer | mLayer |
Weak pointer to source layer. | |
QString | mLayerId |
Associated layer's ID, if applicable. | |
QString | mName |
Name of the layer. | |
QgsLabelObstacleSettings::ObstacleType | mObstacleType = QgsLabelObstacleSettings::ObstacleType::PolygonBoundary |
Type of the obstacle of feature geometries. | |
Qgis::LabelPlacement | mPlacement = Qgis::LabelPlacement::AroundPoint |
Placement strategy. | |
double | mPriority = 0.5 |
Default priority of labels. 0 = highest priority, 1 = lowest priority. | |
QString | mProviderId |
Associated provider ID (one layer may have multiple providers, e.g. in rule-based labeling) | |
Qgis::UpsideDownLabelHandling | mUpsidedownLabels = Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels |
How to handle labels that would be upside down. | |
Implementation class for QgsVectorTileBasicLabeling.
Definition at line 184 of file qgsvectortilebasiclabeling.h.
QgsVectorTileBasicLabelProvider::QgsVectorTileBasicLabelProvider | ( | QgsVectorTileLayer * | layer, |
const QList< QgsVectorTileBasicLabelingStyle > & | styles | ||
) |
Constructs a label provider for the given vector tile layer and using styling from QgsVectorTileBasicLabeling.
Definition at line 111 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Prepare for registration of features.
Must be called after provider has been added to engine (uses its map settings)
context | render context. |
attributeNames | list of attribute names to which additional required attributes shall be added |
Reimplemented from QgsVectorLayerLabelProvider.
Definition at line 174 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Registers label features for given tile to the labeling engine.
Implements QgsVectorTileLabelProvider.
Definition at line 200 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Returns a list of the layers required for labeling.
Only layers which are labeled at the specified tileZoom should be included in this list.
An empty string present in the list indicates that all layer in the tiles are required.
Reimplemented from QgsVectorTileLabelProvider.
Definition at line 145 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Sets fields for each sub-layer.
Implements QgsVectorTileLabelProvider.
Definition at line 158 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Returns list of child providers - useful if the provider needs to put labels into more layers with different configuration.
Reimplemented from QgsAbstractLabelProvider.
Definition at line 163 of file qgsvectortilebasiclabeling.cpp.
|
overridevirtual |
Returns field names for each sub-layer that are required for labeling.
Implements QgsVectorTileLabelProvider.
Definition at line 126 of file qgsvectortilebasiclabeling.cpp.
QMap<QString, QgsFields> QgsVectorTileBasicLabelProvider::mPerLayerFields |
Names of required fields for each sub-layer (only valid between startRender/stopRender calls)
Definition at line 207 of file qgsvectortilebasiclabeling.h.