|
|
@ -54,6 +54,7 @@ |
|
|
|
#include "TerrainTile.h" |
|
|
|
#include "TerrainTile.h" |
|
|
|
|
|
|
|
|
|
|
|
int QGeoTiledMapReplyQGC::_requestCount = 0; |
|
|
|
int QGeoTiledMapReplyQGC::_requestCount = 0; |
|
|
|
|
|
|
|
QByteArray QGeoTiledMapReplyQGC::_bingNoTileImage; |
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager, const QNetworkRequest &request, const QGeoTileSpec &spec, QObject *parent) |
|
|
|
QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager, const QNetworkRequest &request, const QGeoTileSpec &spec, QObject *parent) |
|
|
@ -62,6 +63,12 @@ QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager |
|
|
|
, _request(request) |
|
|
|
, _request(request) |
|
|
|
, _networkManager(networkManager) |
|
|
|
, _networkManager(networkManager) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (_bingNoTileImage.count() == 0) { |
|
|
|
|
|
|
|
QFile file(":/res/BingNoTileBytes.dat"); |
|
|
|
|
|
|
|
file.open(QFile::ReadOnly); |
|
|
|
|
|
|
|
_bingNoTileImage = file.readAll(); |
|
|
|
|
|
|
|
file.close(); |
|
|
|
|
|
|
|
} |
|
|
|
if(_request.url().isEmpty()) { |
|
|
|
if(_request.url().isEmpty()) { |
|
|
|
if(!_badMapbox.size()) { |
|
|
|
if(!_badMapbox.size()) { |
|
|
|
QFile b(":/res/notile.png"); |
|
|
|
QFile b(":/res/notile.png"); |
|
|
@ -135,12 +142,20 @@ QGeoTiledMapReplyQGC::networkReplyFinished() |
|
|
|
} |
|
|
|
} |
|
|
|
emit terrainDone(a, QNetworkReply::NoError); |
|
|
|
emit terrainDone(a, QNetworkReply::NoError); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (a == _bingNoTileImage) { |
|
|
|
|
|
|
|
// Bing doesn't return an error if you request a tile above supported zoom level
|
|
|
|
|
|
|
|
// It instead returns an image of a missing tile graphic. We need to detect that
|
|
|
|
|
|
|
|
// and error out so Qt will deal with zooming correctly even if it doesn't have the tile.
|
|
|
|
|
|
|
|
// This allows us to zoom up to level 23 even though the tiles don't actually exist
|
|
|
|
|
|
|
|
setError(QGeoTiledMapReply::CommunicationError, "Bing tile above zoom level"); |
|
|
|
|
|
|
|
} else { |
|
|
|
//-- This is a map tile. Process and cache it if valid.
|
|
|
|
//-- This is a map tile. Process and cache it if valid.
|
|
|
|
setMapImageData(a); |
|
|
|
setMapImageData(a); |
|
|
|
if(!format.isEmpty()) { |
|
|
|
if(!format.isEmpty()) { |
|
|
|
setMapImageFormat(format); |
|
|
|
setMapImageFormat(format); |
|
|
|
getQGCMapEngine()->cacheTile(getQGCMapEngine()->urlFactory()->getTypeFromId(tileSpec().mapId()), tileSpec().x(), tileSpec().y(), tileSpec().zoom(), a, format); |
|
|
|
getQGCMapEngine()->cacheTile(getQGCMapEngine()->urlFactory()->getTypeFromId(tileSpec().mapId()), tileSpec().x(), tileSpec().y(), tileSpec().zoom(), a, format); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
setFinished(true); |
|
|
|
setFinished(true); |
|
|
|
} |
|
|
|
} |
|
|
|
_clearReply(); |
|
|
|
_clearReply(); |
|
|
|