BingMapProvider.cpp 1.93 KB
Newer Older
Cosmin Marc's avatar
Cosmin Marc committed
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2019 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

Pierre TILAK's avatar
Pierre TILAK committed
10
#include "BingMapProvider.h"
Cosmin Marc's avatar
Cosmin Marc committed
11 12 13 14 15 16 17 18 19 20 21

BingMapProvider::BingMapProvider(const QString &imageFormat, const quint32 averageSize,
                                 const QGeoMapType::MapStyle mapType, QObject* parent)
    : MapProvider(QStringLiteral("https://www.bing.com/maps/"), imageFormat, averageSize, mapType, parent) {}

static const QString RoadMapUrl = QStringLiteral("http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4");

QString BingRoadMapProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager)
    const QString key = _tileXYToQuadKey(x, y, zoom);
    return RoadMapUrl.arg(QString::number(_getServerNum(x, y, 4)), key, _versionBingMaps, _language);
Pierre TILAK's avatar
Pierre TILAK committed
22 23
}

Cosmin Marc's avatar
Cosmin Marc committed
24 25 26 27 28 29
static const QString SatteliteMapUrl = QStringLiteral("http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4");

QString BingSatelliteMapProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager)
    const QString key = _tileXYToQuadKey(x, y, zoom);
    return SatteliteMapUrl.arg(QString::number(_getServerNum(x, y, 4)) ,key ,_versionBingMaps ,_language);
Pierre TILAK's avatar
Pierre TILAK committed
30 31
}

Cosmin Marc's avatar
Cosmin Marc committed
32 33 34 35 36 37
static const QString HybridMapUrl = QStringLiteral("http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4");

QString BingHybridMapProvider::_getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager)
    const QString key = _tileXYToQuadKey(x, y, zoom);
    return HybridMapUrl.arg(QString::number(_getServerNum(x, y, 4)), key, _versionBingMaps, _language);
Pierre TILAK's avatar
Pierre TILAK committed
38 39
}