QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Tile download manager handles downloads of map tiles for the purpose of map rendering. More...
#include <qgstiledownloadmanager.h>
Classes | |
class | Stats |
Encapsulates any statistics we would like to keep about requests. More... | |
Public Member Functions | |
QgsTileDownloadManager () | |
~QgsTileDownloadManager () | |
QgsTileDownloadManagerReply * | get (const QNetworkRequest &request) |
Starts a request. More... | |
bool | hasPendingRequests () const |
Returns whether there are any pending requests in the queue. More... | |
bool | hasWorkerThreadRunning () const |
Returns whether the worker thread is running currently (it may be stopped if there were no requests recently. More... | |
void | resetStatistics () |
Resets statistics of numbers of queries handled by this class. More... | |
void | setIdleThreadTimeout (int timeoutMs) |
Sets after how many milliseconds the idle worker therad should terminate. More... | |
void | shutdown () |
Asks the worker thread to stop and blocks until it is not stopped. More... | |
Stats | statistics () |
Returns basic statistics of the queries handled by this class. More... | |
bool | waitForPendingRequests (int msec=-1) |
Blocks the current thread until the queue is empty. More... | |
Friends | |
class | QgsTileDownloadManagerReply |
class | QgsTileDownloadManagerReplyWorkerObject |
class | QgsTileDownloadManagerWorker |
Tile download manager handles downloads of map tiles for the purpose of map rendering.
The purpose of this class is to handle a couple of situations that may happen:
At this point, it is not recommended to use this class for other scenarios than map rendering: using it elsewhere could slow down map rendering or have some unexpected negative effects.
How do things work:
Definition at line 185 of file qgstiledownloadmanager.h.
QgsTileDownloadManager::QgsTileDownloadManager | ( | ) |
Definition at line 146 of file qgstiledownloadmanager.cpp.
QgsTileDownloadManager::~QgsTileDownloadManager | ( | ) |
Definition at line 153 of file qgstiledownloadmanager.cpp.
QgsTileDownloadManagerReply * QgsTileDownloadManager::get | ( | const QNetworkRequest & | request | ) |
Starts a request.
Returns a new object that should be deleted by the caller when not needed anymore.
Definition at line 159 of file qgstiledownloadmanager.cpp.
bool QgsTileDownloadManager::hasPendingRequests | ( | ) | const |
Returns whether there are any pending requests in the queue.
Definition at line 204 of file qgstiledownloadmanager.cpp.
bool QgsTileDownloadManager::hasWorkerThreadRunning | ( | ) | const |
Returns whether the worker thread is running currently (it may be stopped if there were no requests recently.
Definition at line 254 of file qgstiledownloadmanager.cpp.
void QgsTileDownloadManager::resetStatistics | ( | ) |
Resets statistics of numbers of queries handled by this class.
Definition at line 259 of file qgstiledownloadmanager.cpp.
|
inline |
Sets after how many milliseconds the idle worker therad should terminate.
This function is meant mainly for unit testing.
Definition at line 258 of file qgstiledownloadmanager.h.
void QgsTileDownloadManager::shutdown | ( | ) |
Asks the worker thread to stop and blocks until it is not stopped.
Definition at line 229 of file qgstiledownloadmanager.cpp.
|
inline |
Returns basic statistics of the queries handled by this class.
Definition at line 261 of file qgstiledownloadmanager.h.
bool QgsTileDownloadManager::waitForPendingRequests | ( | int | msec = -1 | ) |
Blocks the current thread until the queue is empty.
This should not be used in production code, it is however useful for auto tests
Definition at line 211 of file qgstiledownloadmanager.cpp.
|
friend |
Definition at line 267 of file qgstiledownloadmanager.h.
|
friend |
Definition at line 268 of file qgstiledownloadmanager.h.
|
friend |
Definition at line 266 of file qgstiledownloadmanager.h.