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
//-- Build URL
QNetworkRequest request;
QString url = _getURL(type, x, y, zoom, networkManager);
if(url.isEmpty())
if(url.isEmpty()) {
return request;
}
request.setUrl(QUrl(url));
request.setRawHeader("Accept", "*/*");
switch (type) {
......@@ -433,7 +434,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
int y_min = 22 * pow(2, gap);
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);
}
else {
......@@ -453,7 +457,10 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
int y_min = 22 * pow(2, gap);
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);
}
else {
......
......@@ -75,7 +75,12 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec)
{
//-- Build URL
QNetworkRequest request = getQGCMapEngine()->urlFactory()->getTileURL((UrlFactory::MapType)spec.mapId(), spec.x(), spec.y(), spec.zoom(), _networkManager);
return new QGeoTiledMapReplyQGC(_networkManager, request, spec);
if ( ! request.url().isEmpty() ) {
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