QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGeoTileFetcherQGC.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtLocation/private/qgeotilefetcher_p.h>
4#include <QtNetwork/QNetworkRequest>
5
8class QGeoTileSpec;
9class QNetworkAccessManager;
10
11class QGeoTileFetcherQGC : public QGeoTileFetcher
12{
13 Q_OBJECT
14
15public:
16 explicit QGeoTileFetcherQGC(QNetworkAccessManager *networkManager, const QVariantMap &parameters, QGeoTiledMappingManagerEngineQGC *parent = nullptr);
18
19 static QNetworkRequest getNetworkRequest(int mapId, int x, int y, int zoom);
20 /* Note: QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol.
21 * Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination. */
22 static uint32_t concurrentDownloads(const QString &type) { Q_UNUSED(type); return 6; }
23
24private:
25 QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec) final;
26 bool initialized() const final;
27 bool fetchingEnabled() const final;
28 void timerEvent(QTimerEvent *event) final;
29 void handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec &spec) final;
30
31 QNetworkAccessManager *m_networkManager = nullptr;
32
33#if defined Q_OS_MACOS
34 static constexpr const char* s_userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14.5; rv:125.0) Gecko/20100101 Firefox/125.0";
35#elif defined Q_OS_WIN
36 static constexpr const char* s_userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/112.0";
37#elif defined Q_OS_ANDROID
38 static constexpr const char* s_userAgent = "Mozilla/5.0 (Android 13; Tablet; rv:68.0) Gecko/68.0 Firefox/112.0";
39#elif defined Q_OS_LINUX
40 // TODO: Detect Wayland vs X11
41 static constexpr const char* s_userAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0";
42#else
43 static constexpr const char* s_userAgent = "Qt Location based application";
44#endif
45};
static uint32_t concurrentDownloads(const QString &type)
static QNetworkRequest getNetworkRequest(int mapId, int x, int y, int zoom)