diff --git a/src/offlinemap.cpp b/src/offlinemap.cpp index 8c534917..b208733a 100644 --- a/src/offlinemap.cpp +++ b/src/offlinemap.cpp @@ -177,14 +177,8 @@ bool OfflineMap::getImageInfo(const QString &path) return true; } -bool OfflineMap::getTileInfo(const QStringList &tiles, - const QString &path) +bool OfflineMap::getTileInfo(const QStringList &tiles, const QString &path) { - if (!_size.isValid()) { - qWarning("%s: missing total image size (IWH)", qPrintable(_name)); - return false; - } - if (tiles.isEmpty()) { qWarning("%s: empty tile set", qPrintable(_name)); return false; @@ -235,6 +229,15 @@ bool OfflineMap::mapLoaded(int res) return true; } +bool OfflineMap::totalSizeSet() +{ + if (!_size.isValid()) { + qWarning("%s: missing total image size (IWH)", qPrintable(_name)); + return false; + } else + return true; +} + OfflineMap::OfflineMap(const QString &path, QObject *parent) : Map(parent) { int errorLine = -2; @@ -280,11 +283,15 @@ OfflineMap::OfflineMap(const QString &path, QObject *parent) : Map(parent) computeResolution(points); if (_tar.isOpen()) { + if (!totalSizeSet()) + return; if (!getTileInfo(_tar.files())) return; } else { QDir set(fi.absoluteFilePath() + "/" + "set"); if (set.exists()) { + if (!totalSizeSet()) + return; if (!getTileInfo(set.entryList(), set.canonicalPath())) return; _imgPath = QString(); @@ -322,7 +329,8 @@ OfflineMap::OfflineMap(Tar &tar, const QString &path, QObject *parent) } if (!mapLoaded(errorLine)) return; - + if (!totalSizeSet()) + return; if (!computeTransformation(points)) return; computeResolution(points); diff --git a/src/offlinemap.h b/src/offlinemap.h index 4cb8afb8..c3524932 100644 --- a/src/offlinemap.h +++ b/src/offlinemap.h @@ -42,6 +42,7 @@ private: int parseMapFile(QIODevice &device, QList &points); bool mapLoaded(int res); + bool totalSizeSet(); bool computeTransformation(const QList &points); bool computeResolution(QList &points); bool getTileInfo(const QStringList &tiles, const QString &path = QString());