Commit 89753977 authored by Pierre TILAK's avatar Pierre TILAK

Fix Cache Map

parent b691567d
...@@ -287,15 +287,15 @@ QGCMapEngine::cacheTile(QString type, const QString& hash, const QByteArray& ima ...@@ -287,15 +287,15 @@ QGCMapEngine::cacheTile(QString type, const QString& hash, const QByteArray& ima
QString QString
QGCMapEngine::getTileHash(QString type, int x, int y, int z) 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 QString
QGCMapEngine::hashToType(const QString& hash) QGCMapEngine::hashToType(const QString& hash)
{ {
QString type = hash.mid(0,4); QString type = hash.mid(0,9);
return static_cast<QString>(type.toInt()); return urlFactory()->getTypeFromId(type.toInt());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -38,22 +38,6 @@ public: ...@@ -38,22 +38,6 @@ public:
// VWorldSatellite = 801, // VWorldSatellite = 801,
// VWorldStreet = 802, // 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 // AirmapElevation = 8001
// }; // };
......
...@@ -448,7 +448,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask) ...@@ -448,7 +448,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask)
query.addBindValue(task->tileSet()->bottomRightLon()); query.addBindValue(task->tileSet()->bottomRightLon());
query.addBindValue(task->tileSet()->minZoom()); query.addBindValue(task->tileSet()->minZoom());
query.addBindValue(task->tileSet()->maxZoom()); 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(task->tileSet()->totalTileCount());
query.addBindValue(QDateTime::currentDateTime().toTime_t()); query.addBindValue(QDateTime::currentDateTime().toTime_t());
if(!query.exec()) { if(!query.exec()) {
...@@ -476,7 +476,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask) ...@@ -476,7 +476,7 @@ QGCCacheWorker::_createTileSet(QGCMapTask *mtask)
query.prepare("INSERT OR IGNORE INTO TilesDownload(setID, hash, type, x, y, z, state) VALUES(?, ?, ?, ?, ? ,? ,?)"); query.prepare("INSERT OR IGNORE INTO TilesDownload(setID, hash, type, x, y, z, state) VALUES(?, ?, ?, ?, ? ,? ,?)");
query.addBindValue(setID); query.addBindValue(setID);
query.addBindValue(hash); query.addBindValue(hash);
query.addBindValue(type); query.addBindValue(getQGCMapEngine()->urlFactory()->getIdFromType(type));
query.addBindValue(x); query.addBindValue(x);
query.addBindValue(y); query.addBindValue(y);
query.addBindValue(z); query.addBindValue(z);
...@@ -897,7 +897,7 @@ QGCCacheWorker::_exportSets(QGCMapTask* mtask) ...@@ -897,7 +897,7 @@ QGCCacheWorker::_exportSets(QGCMapTask* mtask)
exportQuery.addBindValue(set->bottomRightLon()); exportQuery.addBindValue(set->bottomRightLon());
exportQuery.addBindValue(set->minZoom()); exportQuery.addBindValue(set->minZoom());
exportQuery.addBindValue(set->maxZoom()); exportQuery.addBindValue(set->maxZoom());
exportQuery.addBindValue(set->type()); exportQuery.addBindValue(getQGCMapEngine()->urlFactory()->getIdFromType(set->type()));
exportQuery.addBindValue(set->totalTileCount()); exportQuery.addBindValue(set->totalTileCount());
exportQuery.addBindValue(set->defaultSet()); exportQuery.addBindValue(set->defaultSet());
exportQuery.addBindValue(QDateTime::currentDateTime().toTime_t()); exportQuery.addBindValue(QDateTime::currentDateTime().toTime_t());
......
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