QGIS API Documentation 3.41.0-Master (25ec5511245)
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
31
38class CORE_EXPORT QgsVectorTileRawData
39{
40 public:
42 QgsVectorTileRawData( QgsTileXYZ tileID = QgsTileXYZ(), const QByteArray &data = QByteArray() )
43 : id( tileID ), tileGeometryId( tileID ), data( { { QString(), data } } ) {}
44
46 QgsVectorTileRawData( QgsTileXYZ tileID, const QMap<QString, QByteArray> &data )
47 : id( tileID ), tileGeometryId( tileID ), data( data ) {}
48
51
61
63 QMap<QString, QByteArray> data;
64};
65
66
73class CORE_EXPORT QgsVectorTileLoader : public QObject
74{
75 Q_OBJECT
76 public:
77
79 static QList<QgsVectorTileRawData> blockingFetchTileRawData(
80 const QgsVectorTileDataProvider *provider,
81 const QgsTileMatrixSet &tileMatrixSet,
82 const QPointF &viewCenter,
83 const QgsTileRange &range,
84 int zoomLevel,
85 QgsFeedback *feedback = nullptr,
87
88 //
89 // non-static stuff
90 //
91
93 QgsVectorTileLoader( const QgsVectorTileDataProvider *provider, const QgsTileMatrixSet &tileMatrixSet, const QgsTileRange &range, int zoomLevel, const QPointF &viewCenter,
94 QgsFeedback *feedback, Qgis::RendererUsage usage );
96
98 void downloadBlocking();
99
101 QString error() const;
102
103 private:
104 void loadFromNetworkAsync( const QgsTileXYZ &id, const QgsTileMatrixSet &tileMatrixSet, const QgsVectorTileDataProvider *provider, Qgis::RendererUsage usage );
105
106 private slots:
107 void tileReplyFinished();
108 void canceled();
109
110 signals:
113
114 private:
116 std::unique_ptr<QEventLoop> mEventLoop;
118 QgsFeedback *mFeedback;
119
121 QHash<QgsTileXYZ, QList<QgsTileDownloadManagerReply *>> mReplies;
122
124 QHash<QgsTileXYZ, QMap<QString, QByteArray>> mPendingRawData;
125
126 QString mError;
127};
128
129#endif // QGSVECTORTILELOADER_H
RendererUsage
Usage of the renderer.
Definition qgis.h:3188
@ 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:44
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:252
Range of tiles in a tile matrix to be rendered.
Definition qgstiles.h:99
Stores coordinates of a tile in a tile matrix set.
Definition qgstiles.h:40
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 from one or more sources that need to be decoded.
QMap< QString, QByteArray > data
Raw tile data by source ID.
QgsVectorTileRawData(QgsTileXYZ tileID=QgsTileXYZ(), const QByteArray &data=QByteArray())
Constructs a raw tile object for single source.
QgsTileXYZ id
Tile position in tile matrix set.
QgsTileXYZ tileGeometryId
Tile id associated with the raw tile data.
QgsVectorTileRawData(QgsTileXYZ tileID, const QMap< QString, QByteArray > &data)
Constructs a raw tile object for one or more sources.