QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
qgsvectortilelabeling.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectortilelabeling.h
3 --------------------------------------
4 Date : April 2020
5 Copyright : (C) 2020 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSVECTORTILELABELING_H
17#define QGSVECTORTILELABELING_H
18
19#include "qgis_core.h"
21
22#include <QString>
23
24using namespace Qt::StringLiterals;
25
28
29#ifndef SIP_RUN
30
37{
38 public:
41
43 virtual QMap<QString, QSet<QString> > usedAttributes( const QgsRenderContext &context, int tileZoom ) const = 0;
44
45 //TODO QGIS 5.0 -- make pure virtual
46
56 virtual QSet< QString > requiredLayers( QgsRenderContext &context, int tileZoom ) const { Q_UNUSED( context ); Q_UNUSED( tileZoom ); return QSet< QString >() << QString(); }
57
59 virtual void setFields( const QMap<QString, QgsFields> &perLayerFields ) = 0;
60
62 virtual void registerTileFeatures( const QgsVectorTileRendererData &tile, QgsRenderContext &context ) = 0;
63};
64
65#endif
66
73class CORE_EXPORT QgsVectorTileLabeling
74{
75
76#ifdef SIP_RUN
78
79 const QString type = sipCpp->type();
80
81 if ( type == "basic"_L1 )
82 sipType = sipType_QgsVectorTileBasicLabeling;
83 else
84 sipType = 0;
86#endif
87
88 public:
89 virtual ~QgsVectorTileLabeling() = default;
90
92 virtual QString type() const = 0;
93
96
101 virtual QgsVectorTileLabelProvider *provider( QgsVectorTileLayer *layer ) const SIP_SKIP { Q_UNUSED( layer ) return nullptr; }
102
104 virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0;
106 virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
108 virtual void resolveReferences( const QgsProject &project ) { Q_UNUSED( project ) }
109
110};
111
112#endif // QGSVECTORTILELABELING_H
QgsMapLayer * layer() const
Returns the associated layer, or nullptr if no layer is associated with the provider.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:113
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
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.
Internal base class for implementation of label providers for vector tile labeling.
virtual QMap< QString, QSet< QString > > usedAttributes(const QgsRenderContext &context, int tileZoom) const =0
Returns field names for each sub-layer that are required for labeling.
virtual void setFields(const QMap< QString, QgsFields > &perLayerFields)=0
Sets fields for each sub-layer.
virtual QSet< QString > requiredLayers(QgsRenderContext &context, int tileZoom) const
Returns a list of the layers required for labeling.
virtual void registerTileFeatures(const QgsVectorTileRendererData &tile, QgsRenderContext &context)=0
Registers label features for given tile to the labeling engine.
QgsVectorTileLabelProvider(QgsVectorTileLayer *layer)
Constructs base label provider class for the given vector tile layer.
Base class for labeling configuration classes for vector tile layers.
virtual ~QgsVectorTileLabeling()=default
virtual QgsVectorTileLabelProvider * provider(QgsVectorTileLayer *layer) const SIP_SKIP
Factory for label provider implementation.
virtual QString type() const =0
Unique type string of the labeling configuration implementation.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads labeling properties from given XML element.
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes labeling properties to given XML element.
virtual QgsVectorTileLabeling * clone() const =0SIP_FACTORY
Returns a new copy of the object.
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml().
Implements a map layer that is dedicated to rendering of vector tiles.
Contains decoded features of a single vector tile and any other data necessary for rendering of it.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:199
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_FACTORY
Definition qgis_sip.h:84
#define SIP_END
Definition qgis_sip.h:216