diff options
author | Aaron McCarthy <mccarthy.aaron@gmail.com> | 2015-01-23 15:25:15 +1000 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-28 14:00:53 +0000 |
commit | baae1926455d9b69b1405cc1683d1be0f3565338 (patch) | |
tree | 16adae7e3a0bf6a57f2ee011df3233efaa03ca96 /src/plugins/geoservices/osm/qgeotilefetcherosm.cpp | |
parent | 74573e89ad818145609ea1f56a1c2695a088746a (diff) | |
download | qtlocation-baae1926455d9b69b1405cc1683d1be0f3565338.tar.gz |
Add support for more tile types to OSM plugin.
In addition to the existing MapQuest tile set make the ThunderForest
tile set also available as additional supported map types.
This change adds the following map types to the OSM plugin:
StreetMap - from MapQuest
SatelliteMapDay - from MapQueset
CycleMap - from ThunderForest
TransitMap (day) - from ThunderForest
TransitMap (night) - from ThunderForest
TerrainMap - from ThunderForest
PedestrianMap - from ThunderForeset
Change-Id: I663b275689ee55929d0afa7da20ed3c57c78e037
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/osm/qgeotilefetcherosm.cpp')
-rw-r--r-- | src/plugins/geoservices/osm/qgeotilefetcherosm.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp b/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp index 32f05030..10fd1709 100644 --- a/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp +++ b/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp @@ -56,25 +56,38 @@ QGeoTiledMapReply *QGeoTileFetcherOsm::getTileImage(const QGeoTileSpec &spec) QNetworkRequest request; request.setRawHeader("User-Agent", m_userAgent); + QString urlPrefix; + switch (spec.mapId()) { - case 1: - // opensteetmap.org street map - request.setUrl(QUrl(QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/map/") + - QString::number(spec.zoom()) + QLatin1Char('/') + - QString::number(spec.x()) + QLatin1Char('/') + - QString::number(spec.y()) + QStringLiteral(".png"))); - break; - case 2: - // opensteetmap.org satellite map - request.setUrl(QUrl(QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/sat/") + - QString::number(spec.zoom()) + QLatin1Char('/') + - QString::number(spec.x()) + QLatin1Char('/') + - QString::number(spec.y()) + QStringLiteral(".png"))); - break; - default: - qWarning("Unknown map id %d\n", spec.mapId()); + case 1: + urlPrefix = QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/map/"); + break; + case 2: + urlPrefix = QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/sat/"); + break; + case 3: + urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/cycle/"); + break; + case 4: + urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/transport/"); + break; + case 5: + urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/transport-dark/"); + break; + case 6: + urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/landscape/"); + break; + case 7: + urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/outdoors/"); + break; + default: + qWarning("Unknown map id %d\n", spec.mapId()); } + request.setUrl(QUrl(urlPrefix + QString::number(spec.zoom()) + QLatin1Char('/') + + QString::number(spec.x()) + QLatin1Char('/') + + QString::number(spec.y()) + QStringLiteral(".png"))); + QNetworkReply *reply = m_networkManager->get(request); return new QGeoMapReplyOsm(reply, spec); |