Commit cf6089d0 authored by stmoon's avatar stmoon

fix the bug in case of non-supported level

parent 9d9276b2
...@@ -147,8 +147,9 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag ...@@ -147,8 +147,9 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
//-- Build URL //-- Build URL
QNetworkRequest request; QNetworkRequest request;
QString url = _getURL(type, x, y, zoom, networkManager); QString url = _getURL(type, x, y, zoom, networkManager);
if(url.isEmpty()) if(url.isEmpty()) {
return request; return request;
}
request.setUrl(QUrl(url)); request.setUrl(QUrl(url));
request.setRawHeader("Accept", "*/*"); request.setRawHeader("Accept", "*/*");
switch (type) { switch (type) {
...@@ -433,7 +434,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager* ...@@ -433,7 +434,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
int y_min = 22 * pow(2, gap); int y_min = 22 * pow(2, gap);
int y_max = 26 * pow(2, gap) + (2*gap - 1); int y_max = 26 * pow(2, gap) + (2*gap - 1);
if ( zoom > 5 && x >= x_min && x <= x_max && y >= y_min && y <= y_max ) { if ( zoom > 19 ) {
return QString("");
}
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); return QString("http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png").arg(zoom).arg(x).arg(y);
} }
else { else {
...@@ -453,7 +457,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager* ...@@ -453,7 +457,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
int y_min = 22 * pow(2, gap); int y_min = 22 * pow(2, gap);
int y_max = 26 * pow(2, gap) + (2*gap - 1); int y_max = 26 * pow(2, gap) + (2*gap - 1);
if ( zoom > 5 && x >= x_min && x <= x_max && y >= y_min && y <= y_max ) { if ( zoom > 19 ) {
return QString("");
}
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); return QString("http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/%2/%3.jpeg").arg(zoom).arg(x).arg(y);
} }
else { else {
......
...@@ -75,7 +75,12 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec) ...@@ -75,7 +75,12 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec)
{ {
//-- Build URL //-- Build URL
QNetworkRequest request = getQGCMapEngine()->urlFactory()->getTileURL((UrlFactory::MapType)spec.mapId(), spec.x(), spec.y(), spec.zoom(), _networkManager); QNetworkRequest request = getQGCMapEngine()->urlFactory()->getTileURL((UrlFactory::MapType)spec.mapId(), spec.x(), spec.y(), spec.zoom(), _networkManager);
if ( ! request.url().isEmpty() ) {
return new QGeoTiledMapReplyQGC(_networkManager, request, spec); return new QGeoTiledMapReplyQGC(_networkManager, request, spec);
}
else {
return NULL;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment