QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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 // cannot use a read/write lock here -- see https://bugreports.qt.io/browse/QTBUG-19794
62 QMutex mMutex;
63
64};
65
75{
76 Q_OBJECT
77
78 public:
79
83 QgsVectorTileDataProvider( const QString &uri,
84 const QgsDataProvider::ProviderOptions &providerOptions,
85 QgsDataProvider::ReadFlags flags );
86
91
96
101 virtual Qgis::VectorTileProviderFlags providerFlags() const;
102
107 virtual Qgis::VectorTileProviderCapabilities providerCapabilities() const;
108
109 QgsRectangle extent() const override;
110 bool renderInPreview( const QgsDataProvider::PreviewContext &context ) override;
111
115 virtual QString sourcePath() const = 0;
116
121
125 virtual const QgsVectorTileMatrixSet &tileMatrixSet() const = 0;
126
132 virtual bool supportsAsync() const;
133
137 virtual QgsVectorTileRawData readTile( const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, QgsFeedback *feedback = nullptr ) const = 0;
138
142 virtual QList<QgsVectorTileRawData> readTiles( const QgsTileMatrixSet &tileMatrixSet, const QVector<QgsTileXYZ> &tiles, QgsFeedback *feedback = nullptr, Qgis::RendererUsage usage = Qgis::RendererUsage::Unknown ) const = 0;
143
149 virtual QNetworkRequest tileRequest( const QgsTileMatrixSet &tileMatrixSet, const QgsTileXYZ &id, Qgis::RendererUsage usage ) const;
150
157 virtual QVariantMap styleDefinition() const;
158
165 virtual QString styleUrl() const;
166
173 virtual QVariantMap spriteDefinition() const;
174
180 virtual QImage spriteImage() const;
181
186 virtual QString htmlMetadata() const;
187
188 protected:
189
190 std::shared_ptr<QgsVectorTileDataProviderSharedData> mShared;
191
192};
193
194
195
196#endif // QGSVECTORTILEDATAPROVIDER_H
RendererUsage
Usage of the renderer.
Definition qgis.h:2548
@ Unknown
Renderer used for unknown usage.
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.
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.
QMutex 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.
virtual QList< QgsVectorTileRawData > readTiles(const QgsTileMatrixSet &tileMatrixSet, const QVector< QgsTileXYZ > &tiles, QgsFeedback *feedback=nullptr, Qgis::RendererUsage usage=Qgis::RendererUsage::Unknown) const =0
Returns raw tile data for a range of tiles.
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 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.