Unverified Commit ecdb5841 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #6736 from stmoon/vworld

create new vworld map for Korea
parents 8aba4456 cf6089d0
......@@ -55,7 +55,11 @@ stQGeoTileCacheQGCMapTypes kMapTypes[] = {
{"Bing Satellite Map", UrlFactory::BingSatellite},
{"Bing Hybrid Map", UrlFactory::BingHybrid},
{"Statkart Terrain Map", UrlFactory::StatkartTopo},
{"ENIRO Terrain Map", UrlFactory::EniroTopo}
{"ENIRO Terrain Map", UrlFactory::EniroTopo},
{"VWorld Satellite Map", UrlFactory::VWorldSatellite},
{"VWorld Street Map", UrlFactory::VWorldStreet}
/*
{"MapQuest Street Map", UrlFactory::MapQuestMap},
{"MapQuest Satellite Map", UrlFactory::MapQuestSat}
......@@ -508,6 +512,9 @@ QGCMapEngine::concurrentDownloads(UrlFactory::MapType type)
case UrlFactory::EsriWorldSatellite:
case UrlFactory::EsriTerrain:
case UrlFactory::AirmapElevation:
case UrlFactory::VWorldMap:
case UrlFactory::VWorldSatellite:
case UrlFactory::VWorldStreet:
return 12;
/*
case UrlFactory::MapQuestMap:
......
......@@ -125,6 +125,12 @@ UrlFactory::getImageFormat(MapType type, const QByteArray& image)
case AirmapElevation:
format = "bin";
break;
case VWorldStreet :
format = "png";
break;
case VWorldSatellite :
format = "jpg";
break;
default:
qWarning("UrlFactory::getImageFormat() Unknown map id %d", type);
break;
......@@ -141,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) {
......@@ -419,6 +426,49 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
}
break;
case VWorldStreet :
{
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 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 {
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);
}
}
break;
case VWorldSatellite :
{
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 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 {
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);
}
}
break;
default:
qWarning("Unknown map id %d\n", type);
break;
......
......@@ -56,6 +56,10 @@ public:
MapQuestSat = 701,
*/
VWorldMap = 800,
VWorldSatellite = 801,
VWorldStreet = 802,
MapboxStreets = 6000,
MapboxLight = 6001,
MapboxDark = 6002,
......
......@@ -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);
if ( ! request.url().isEmpty() ) {
return new QGeoTiledMapReplyQGC(_networkManager, request, spec);
}
else {
return NULL;
}
}
//-----------------------------------------------------------------------------
......
......@@ -133,6 +133,10 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
mapTypes << QGCGEOMAPTYPE(QGeoMapType::SatelliteMapDay, "Esri Satellite Map", "ArcGIS Online World Imagery", true, false, UrlFactory::EsriWorldSatellite);
mapTypes << QGCGEOMAPTYPE(QGeoMapType::TerrainMap, "Esri Terrain Map", "World Terrain Base", false, false, UrlFactory::EsriTerrain);
// VWorld
mapTypes << QGCGEOMAPTYPE(QGeoMapType::SatelliteMapDay, "VWorld Satellite Map", "VWorld Satellite Map", false, false, UrlFactory::VWorldSatellite);
mapTypes << QGCGEOMAPTYPE(QGeoMapType::StreetMap, "VWorld Street Map", "VWorld Street Map", false, false, UrlFactory::VWorldStreet);
/* See: https://wiki.openstreetmap.org/wiki/Tile_usage_policy
mapTypes << QGCGEOMAPTYPE(QGeoMapType::StreetMap, "Open Street Map", "Open Street map", false, false, UrlFactory::OpenStreetMap);
*/
......
......@@ -3,8 +3,8 @@
"name": "MapProvider",
"shortDescription": "Currently selected map provider for flight maps",
"type": "uint32",
"enumStrings": "Bing,Google,Statkart,Mapbox,Esri,Eniro",
"enumValues": "0,1,2,3,4,5",
"enumStrings": "Bing,Google,Statkart,Mapbox,Esri,Eniro,VWorld",
"enumValues": "0,1,2,3,4,5,6",
"defaultValue": 0
},
{
......
......@@ -119,6 +119,9 @@ void FlightMapSettings::_newMapProvider(QVariant value)
case mapProviderEsri:
_removeEnumValue(mapTypeHybrid, enumStrings, enumValues);
break;
case mapProviderVWorld:
_removeEnumValue(mapTypeHybrid, enumStrings, enumValues);
_removeEnumValue(mapTypeTerrain, enumStrings, enumValues);
}
metaData->setEnumInfo(enumStrings, enumValues);
emit mapTypeChanged();
......
......@@ -26,7 +26,8 @@ public:
mapProviderStarkart,
mapProviderMapbox,
mapProviderEsri,
mapProviderEniro
mapProviderEniro,
mapProviderVWorld
} MapProvider_t;
// This enum must match the json meta data
......
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