QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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"
20 
22 
23 class QgsVectorTileLayer;
25 
26 #ifndef SIP_RUN
27 
34 {
35  public:
38 
40  virtual QMap<QString, QSet<QString> > usedAttributes( const QgsRenderContext &context, int tileZoom ) const = 0;
41 
43  virtual void setFields( const QMap<QString, QgsFields> &perLayerFields ) = 0;
44 
46  virtual void registerTileFeatures( const QgsVectorTileRendererData &tile, QgsRenderContext &context ) = 0;
47 };
48 
49 #endif
50 
57 class CORE_EXPORT QgsVectorTileLabeling
58 {
59 
60 #ifdef SIP_RUN
62 
63  const QString type = sipCpp->type();
64 
65  if ( type == QStringLiteral( "basic" ) )
66  sipType = sipType_QgsVectorTileBasicLabeling;
67  else
68  sipType = 0;
69  SIP_END
70 #endif
71 
72  public:
73  virtual ~QgsVectorTileLabeling() = default;
74 
76  virtual QString type() const = 0;
77 
79  virtual QgsVectorTileLabeling *clone() const = 0 SIP_FACTORY;
80 
85  virtual QgsVectorTileLabelProvider *provider( QgsVectorTileLayer *layer ) const SIP_SKIP { Q_UNUSED( layer ) return nullptr; }
86 
88  virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0;
90  virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
92  virtual void resolveReferences( const QgsProject &project ) { Q_UNUSED( project ) }
93 
94 };
95 
96 #endif // QGSVECTORTILELABELING_H
QgsVectorTileLayer
Definition: qgsvectortilelayer.h:83
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsVectorTileLabelProvider
Definition: qgsvectortilelabeling.h:33
QgsVectorTileLabeling::resolveReferences
virtual void resolveReferences(const QgsProject &project)
Resolves references to other objects - second phase of loading - after readXml()
Definition: qgsvectortilelabeling.h:92
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsVectorTileRendererData
Definition: qgsvectortilerenderer.h:37
QgsVectorLayerLabelProvider
The QgsVectorLayerLabelProvider class implements a label provider for vector layers....
Definition: qgsvectorlayerlabelprovider.h:40
QgsProject
Definition: qgsproject.h:92
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsVectorTileLabeling::provider
virtual QgsVectorTileLabelProvider * provider(QgsVectorTileLayer *layer) const SIP_SKIP
Factory for label provider implementation.
Definition: qgsvectortilelabeling.h:85
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsVectorTileLabelProvider::setFields
virtual void setFields(const QMap< QString, QgsFields > &perLayerFields)=0
Sets fields for each sub-layer.
QgsVectorTileLabelProvider::usedAttributes
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.
QgsVectorTileLabelProvider::registerTileFeatures
virtual void registerTileFeatures(const QgsVectorTileRendererData &tile, QgsRenderContext &context)=0
Registers label features for given tile to the labeling engine.
QgsAbstractLabelProvider::layer
QgsMapLayer * layer() const
Returns the associated layer, or nullptr if no layer is associated with the provider.
Definition: qgslabelingengine.h:130
qgsvectorlayerlabelprovider.h
QgsVectorTileLabeling
Definition: qgsvectortilelabeling.h:57
QgsVectorTileLabelProvider::QgsVectorTileLabelProvider
QgsVectorTileLabelProvider(QgsVectorTileLayer *layer)
Constructs base label provider class for the given vector tile layer.
Definition: qgsvectortilelabeling.cpp:20
SIP_END
#define SIP_END
Definition: qgis_sip.h:189