QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsvectortileloader.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectortileloader.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 QGSVECTORTILELOADER_H
17#define QGSVECTORTILELOADER_H
18
19#define SIP_NO_FILE
20
21#include "qgstiles.h"
22
23class QgsFeedback;
26
27class QByteArray;
28class QNetworkReply;
29class QEventLoop;
30
37class CORE_EXPORT QgsVectorTileRawData
38{
39 public:
41 QgsVectorTileRawData( QgsTileXYZ tileID = QgsTileXYZ(), const QByteArray &raw = QByteArray() )
42 : id( tileID ), tileGeometryId( tileID ), data( raw ) {}
43
46
56
58 QByteArray data;
59};
60
61
68class CORE_EXPORT QgsVectorTileLoader : public QObject
69{
70 Q_OBJECT
71 public:
72
74 static QList<QgsVectorTileRawData> blockingFetchTileRawData(
75 const QgsVectorTileDataProvider *provider,
76 const QgsTileMatrixSet &tileMatrixSet,
77 const QPointF &viewCenter,
78 const QgsTileRange &range,
79 int zoomLevel,
80 QgsFeedback *feedback = nullptr,
82
83 //
84 // non-static stuff
85 //
86
88 QgsVectorTileLoader( const QgsVectorTileDataProvider *provider, const QgsTileMatrixSet &tileMatrixSet, const QgsTileRange &range, int zoomLevel, const QPointF &viewCenter,
89 QgsFeedback *feedback, Qgis::RendererUsage usage );
91
93 void downloadBlocking();
94
96 QString error() const;
97
98 private:
99 void loadFromNetworkAsync( const QgsTileXYZ &id, const QgsTileMatrixSet &tileMatrixSet, const QgsVectorTileDataProvider *provider, Qgis::RendererUsage usage );
100
101 private slots:
102 void tileReplyFinished();
103 void canceled();
104
105 signals:
108
109 private:
111 std::unique_ptr<QEventLoop> mEventLoop;
113 QgsFeedback *mFeedback;
114
116 QList<QgsTileDownloadManagerReply *> mReplies;
117
118 QString mError;
119};
120
121#endif // QGSVECTORTILELOADER_H
RendererUsage
Usage of the renderer.
Definition qgis.h:2548
@ Unknown
Renderer used for unknown usage.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:45
Reply object for tile download manager requests returned from calls to QgsTileDownloadManager::get().
Defines a set of tile matrices for multiple zoom levels.
Definition qgstiles.h:250
Range of tiles in a tile matrix to be rendered.
Definition qgstiles.h:97
Stores coordinates of a tile in a tile matrix set.
Definition qgstiles.h:38
Base class for vector tile layer data providers.
The loader class takes care of loading raw vector tile data from a tile source.
void tileRequestFinished(const QgsVectorTileRawData &rawTile)
Emitted when a tile request has finished. If a tile request has failed, the returned raw tile byte ar...
Keeps track of raw tile data that need to be decoded.
QgsVectorTileRawData(QgsTileXYZ tileID=QgsTileXYZ(), const QByteArray &raw=QByteArray())
Constructs a raw tile object.
QByteArray data
Raw tile data.
QgsTileXYZ id
Tile position in tile matrix set.
QgsTileXYZ tileGeometryId
Tile id associated with the raw tile data.