QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsvectortilemvtencoder.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectortilemvtencoder.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 QGSVECTORTILEMVTENCODER_H
17 #define QGSVECTORTILEMVTENCODER_H
18 
19 #define SIP_NO_FILE
20 
21 #include "qgstiles.h"
22 #include "qgsvectortilerenderer.h"
23 #include "vector_tile.pb.h"
24 
25 
40 class CORE_EXPORT QgsVectorTileMVTEncoder
41 {
42  public:
44  explicit QgsVectorTileMVTEncoder( QgsTileXYZ tileID );
45 
47  int resolution() const { return mResolution; }
49  void setResolution( int extent ) { mResolution = extent; }
50 
52  int tileBuffer() const { return mBuffer; }
54  void setTileBuffer( int buffer ) { mBuffer = buffer; }
55 
57  void setTransformContext( const QgsCoordinateTransformContext &transformContext ) { mTransformContext = transformContext; }
58 
64  void addLayer( QgsVectorLayer *layer, QgsFeedback *feedback = nullptr, QString filterExpression = QString(), QString layerName = QString() );
65 
67  QByteArray encode() const;
68 
69  private:
70  void addFeature( vector_tile::Tile_Layer *tileLayer, const QgsFeature &f );
71 
72  private:
73  QgsTileXYZ mTileID;
74  int mResolution = 4096;
75  int mBuffer = 256;
76  QgsCoordinateTransformContext mTransformContext;
77 
78  QgsRectangle mTileExtent;
79 
80  QgsVectorTileFeatures mFeatures;
81 
82  vector_tile::Tile tile;
83 
84  QMap<QVariant, int> mKnownValues;
85 
86 };
87 
88 #endif // QGSVECTORTILEMVTENCODER_H
qgsvectortilerenderer.h
QgsCoordinateTransformContext
Definition: qgscoordinatetransformcontext.h:57
QgsTileXYZ
Definition: qgstiles.h:32
QgsRectangle
Definition: qgsrectangle.h:41
QgsVectorTileMVTEncoder::tileBuffer
int tileBuffer() const
Returns size of the buffer zone around tile edges in integer tile coordinates. The default is 256 (~6...
Definition: qgsvectortilemvtencoder.h:52
QgsVectorTileMVTEncoder::setResolution
void setResolution(int extent)
Sets the resolution of coordinates of geometries within the tile.
Definition: qgsvectortilemvtencoder.h:49
QgsFeedback
Definition: qgsfeedback.h:43
QgsVectorTileMVTEncoder::setTransformContext
void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets coordinate transform context for transforms between layers and tile matrix CRS.
Definition: qgsvectortilemvtencoder.h:57
QgsVectorTileMVTEncoder::setTileBuffer
void setTileBuffer(int buffer)
Sets size of the buffer zone around tile edges in integer tile coordinates.
Definition: qgsvectortilemvtencoder.h:54
qgstiles.h
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsVectorTileMVTEncoder
Definition: qgsvectortilemvtencoder.h:40
QgsFeature
Definition: qgsfeature.h:55
QgsVectorTileFeatures
QMap< QString, QVector< QgsFeature > > QgsVectorTileFeatures
Features of a vector tile, grouped by sub-layer names (key of the map)
Definition: qgsvectortilerenderer.h:25
QgsVectorTileMVTEncoder::resolution
int resolution() const
Returns resolution of coordinates of geometries within the tile. The default is 4096.
Definition: qgsvectortilemvtencoder.h:47