QGIS API Documentation 3.31.0-Master (9f23a2c1dc)
qgsvectortiledataprovider.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectortiledataprovider.h
3 --------------------------------------
4 Date : March 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 QGSVECTORTILEDATAPROVIDER_H
17#define QGSVECTORTILEDATAPROVIDER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgsdataprovider.h"
22#include "qgstiles.h"
23
24#include <QCache>
25#include <QReadWriteLock>
26
28class QgsTileXYZ;
31
32#define SIP_NO_FILE
33
43{
44 public:
46
53
57 void storeCachedTileData( const QgsVectorTileRawData &data );
58
59 QCache< QgsTileXYZ, QgsVectorTileRawData > mTileCache;
60
61 QReadWriteLock mMutex;
62
63};
64
74{
75 Q_OBJECT
76
77 public:
78
82 QgsVectorTileDataProvider( const QString &uri,
83 const QgsDataProvider::ProviderOptions &providerOptions,
84 QgsDataProvider::ReadFlags flags );
85
90
95
100 virtual Qgis::VectorTileProviderFlags providerFlags() const;
101
106 virtual Qgis::VectorTileProviderCapabilities providerCapabilities() const;
107
108 QgsRectangle extent() const override;
109 bool renderInPreview( const QgsDataProvider::PreviewContext &context ) override;
110
114 virtual QString sourcePath() const = 0;
115
120
124 virtual const QgsVectorTileMatrixSet &tileMatrixSet() const = 0;
125
131 virtual bool supportsAsync() const;
132
136 virtual QgsVectorTileRawData readTile( const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, QgsFeedback *feedback = nullptr ) const = 0;
137
141 virtual QList<QgsVectorTileRawData> readTiles( const QgsTileMatrixSet &tileMatrixSet, const QVector<QgsTileXYZ> &tiles, QgsFeedback *feedback = nullptr ) const = 0;
142
148 virtual QNetworkRequest tileRequest( const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, Qgis::RendererUsage usage ) const;
149
156 virtual QVariantMap styleDefinition() const;
157
164 virtual QString styleUrl() const;
165
172 virtual QVariantMap spriteDefinition() const;
173
179 virtual QImage spriteImage() const;
180
185 virtual QString htmlMetadata() const;
186
187 protected:
188
189 std::shared_ptr<QgsVectorTileDataProviderSharedData> mShared;
190
191};
192
193
194
195#endif // QGSVECTORTILEDATAPROVIDER_H
RendererUsage
Usage of the renderer.
Definition: qgis.h:2320
Abstract base class for spatial data provider implementations.
virtual bool renderInPreview(const QgsDataProvider::PreviewContext &context)
Returns whether the layer must be rendered in preview jobs.
virtual QgsRectangle extent() const =0
Returns the extent of the layer.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Defines a set of tile matrices for multiple zoom levels.
Definition: qgstiles.h:250
Stores coordinates of a tile in a tile matrix set.
Definition: qgstiles.h:38
Shared data class for vector tile layer data providers.
void storeCachedTileData(const QgsVectorTileRawData &data)
Stores raw tile data in the shared cache.
QCache< QgsTileXYZ, QgsVectorTileRawData > mTileCache
bool getCachedTileData(QgsVectorTileRawData &data, QgsTileXYZ id)
Retrieves previously cached raw tile data for a tile with matching id.
QReadWriteLock mMutex
Access to all data members is guarded by the mutex.
Base class for vector tile layer data providers.
virtual QString sourcePath() const =0
Returns the source path for the data.
virtual QgsVectorTileDataProvider * clone() const =0
Returns a clone of the data provider.
QgsVectorTileDataProvider & operator=(const QgsVectorTileDataProvider &other)=delete
QgsVectorTileDataProvider cannot be assigned.
virtual const QgsVectorTileMatrixSet & tileMatrixSet() const =0
Returns the tile matrix set associated with the provider.
virtual QList< QgsVectorTileRawData > readTiles(const QgsTileMatrixSet &tileMatrixSet, const QVector< QgsTileXYZ > &tiles, QgsFeedback *feedback=nullptr) const =0
Returns raw tile data for a range of tiles.
virtual QgsVectorTileRawData readTile(const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, QgsFeedback *feedback=nullptr) const =0
Returns raw tile data for a single tile.
std::shared_ptr< QgsVectorTileDataProviderSharedData > mShared
Mutable data shared between provider instances.
Encapsulates properties of a vector tile matrix set, including tile origins and scaling information.
Keeps track of raw tile data that need to be decoded.
#define SIP_FACTORY
Definition: qgis_sip.h:76
Stores settings related to the context in which a preview job runs.
Setting options for creating vector data providers.