diff --git a/src/QtLocationPlugin/QGCMapEngine.cpp b/src/QtLocationPlugin/QGCMapEngine.cpp index 3893dc674551d34c80854b887e6d16e15f0564c2..926c52839db68d3620f6a3afffb2677b0796b7b2 100644 --- a/src/QtLocationPlugin/QGCMapEngine.cpp +++ b/src/QtLocationPlugin/QGCMapEngine.cpp @@ -287,15 +287,15 @@ QGCMapEngine::cacheTile(QString type, const QString& hash, const QByteArray& ima QString QGCMapEngine::getTileHash(QString type, int x, int y, int z) { - return QString().sprintf("%04d%08d%08d%03d", getQGCMapEngine()->urlFactory()->getIdFromType(type), x, y, z); + return QString().sprintf("%09d%08d%08d%03d", getQGCMapEngine()->urlFactory()->getIdFromType(type), x, y, z); } //----------------------------------------------------------------------------- QString QGCMapEngine::hashToType(const QString& hash) { - QString type = hash.mid(0,4); - return static_cast(type.toInt()); + QString type = hash.mid(0,9); + return urlFactory()->getTypeFromId(type.toInt()); } //----------------------------------------------------------------------------- diff --git a/src/QtLocationPlugin/QGCMapUrlEngine.h b/src/QtLocationPlugin/QGCMapUrlEngine.h index a4522af54d5e9a2e8744a830fc2160d09d3cb4d3..80dd4c6c54837e505fdd39a052040b34e75a2ca3 100644 --- a/src/QtLocationPlugin/QGCMapUrlEngine.h +++ b/src/QtLocationPlugin/QGCMapUrlEngine.h @@ -38,22 +38,6 @@ public: // VWorldSatellite = 801, // VWorldStreet = 802, // -// MapboxStreets = 6000, -// MapboxLight = 6001, -// MapboxDark = 6002, -// MapboxSatellite = 6003, -// MapboxHybrid = 6004, -// MapboxWheatPaste = 6005, -// MapboxStreetsBasic = 6006, -// MapboxComic = 6007, -// MapboxOutdoors = 6008, -// MapboxRunBikeHike = 6009, -// MapboxPencil = 6010, -// MapboxPirates = 6011, -// MapboxEmerald = 6012, -// MapboxHighContrast = 6013, -// -// // AirmapElevation = 8001 // }; diff --git a/src/QtLocationPlugin/QGCTileCacheWorker.cpp b/src/QtLocationPlugin/QGCTileCacheWorker.cpp index 500138598a5be76dab1349678dd964f5de86a79a..f42c32edf5d78ace69650577db06d3d3f9b99459 100644 --- a/src/QtLocationPlugin/QGCTileCacheWorker.cpp +++ b/src/QtLocationPlugin/QGCTileCacheWorker.cpp @@ -448,7 +448,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask) query.addBindValue(task->tileSet()->bottomRightLon()); query.addBindValue(task->tileSet()->minZoom()); query.addBindValue(task->tileSet()->maxZoom()); - query.addBindValue(task->tileSet()->type()); + query.addBindValue(getQGCMapEngine()->urlFactory()->getIdFromType(task->tileSet()->type())); query.addBindValue(task->tileSet()->totalTileCount()); query.addBindValue(QDateTime::currentDateTime().toTime_t()); if(!query.exec()) { @@ -476,7 +476,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask) query.prepare("INSERT OR IGNORE INTO TilesDownload(setID, hash, type, x, y, z, state) VALUES(?, ?, ?, ?, ? ,? ,?)"); query.addBindValue(setID); query.addBindValue(hash); - query.addBindValue(type); + query.addBindValue(getQGCMapEngine()->urlFactory()->getIdFromType(type)); query.addBindValue(x); query.addBindValue(y); query.addBindValue(z); @@ -897,7 +897,7 @@ QGCCacheWorker::_exportSets(QGCMapTask* mtask) exportQuery.addBindValue(set->bottomRightLon()); exportQuery.addBindValue(set->minZoom()); exportQuery.addBindValue(set->maxZoom()); - exportQuery.addBindValue(set->type()); + exportQuery.addBindValue(getQGCMapEngine()->urlFactory()->getIdFromType(set->type())); exportQuery.addBindValue(set->totalTileCount()); exportQuery.addBindValue(set->defaultSet()); exportQuery.addBindValue(QDateTime::currentDateTime().toTime_t());