GenericMapProvider.cpp 3.42 KB
Newer Older
1
#include "GenericMapProvider.h"
Pierre TILAK's avatar
Pierre TILAK committed
2
#include "QGCMapEngine.h"
Pierre TILAK's avatar
Pierre TILAK committed
3 4 5 6 7 8 9 10 11 12 13

QString StatkartMapProvider::_getURL(int x, int y, int zoom,
                                     QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    return QString("http://opencache.statkart.no/gatekeeper/gk/"
                   "gk.open_gmaps?layers=topo4&zoom=%1&x=%2&y=%3")
        .arg(zoom)
        .arg(x)
        .arg(y);
}

14 15 16 17 18 19 20 21 22
QString EniroMapProvider::_getURL(int x, int y, int zoom,
                                  QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    return QString("http://map.eniro.com/geowebcache/service/tms1.0.0/map/%1/"
                   "%2/%3.png")
        .arg(zoom)
        .arg(x)
        .arg((1 << zoom) - 1 - y);
}
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

QString MapQuestMapMapProvider::_getURL(int x, int y, int zoom,
                                        QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    char letter = "1234"[_getServerNum(x, y, 4)];
    return QString("http://otile%1.mqcdn.com/tiles/1.0.0/map/%2/%3/%4.jpg")
        .arg(letter)
        .arg(zoom)
        .arg(x)
        .arg(y);
}

QString MapQuestSatMapProvider::_getURL(int x, int y, int zoom,
                                        QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    char letter = "1234"[_getServerNum(x, y, 4)];
    return QString("http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg")
        .arg(letter)
        .arg(zoom)
        .arg(x)
        .arg(y);
}

QString
VWorldStreetMapProvider::_getURL(int x, int y, int zoom,
                                 QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    int gap   = zoom - 6;
    int x_min = 53 * pow(2, gap);
    int x_max = 55 * pow(2, gap) + (2 * gap - 1);
    int y_min = 22 * pow(2, gap);
    int y_max = 26 * pow(2, gap) + (2 * gap - 1);

    if (zoom > 19) {
        return {};
    } else if (zoom > 5 && x >= x_min && x <= x_max && y >= y_min &&
               y <= y_max) {
        return QString(
                   "http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png")
            .arg(zoom)
            .arg(x)
            .arg(y);
    } else {
        QString key = _tileXYToQuadKey(x, y, zoom);
        return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/"
                       "r%2.png?g=%3&mkt=%4")
            .arg(_getServerNum(x, y, 4))
            .arg(key)
            .arg(_versionBingMaps)
            .arg(_language);
    }
}

QString VWorldSatMapProvider::_getURL(int x, int y, int zoom,
                                      QNetworkAccessManager* networkManager) {
    Q_UNUSED(networkManager);
    int gap   = zoom - 6;
    int x_min = 53 * pow(2, gap);
    int x_max = 55 * pow(2, gap) + (2 * gap - 1);
    int y_min = 22 * pow(2, gap);
    int y_max = 26 * pow(2, gap) + (2 * gap - 1);

    if (zoom > 19) {
        return {};
    } else if (zoom > 5 && x >= x_min && x <= x_max && y >= y_min &&
               y <= y_max) {
        return QString("http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/"
                       "%2/%3.jpeg")
            .arg(zoom)
            .arg(x)
            .arg(y);
    } else {
        QString key = _tileXYToQuadKey(x, y, zoom);
        return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/"
                       "a%2.jpeg?g=%3&mkt=%4")
            .arg(_getServerNum(x, y, 4))
            .arg(key)
            .arg(_versionBingMaps)
            .arg(_language);
    }
}