diff --git a/src/map/wmts.cpp b/src/map/wmts.cpp index d65f03d9..089f8de4 100644 --- a/src/map/wmts.cpp +++ b/src/map/wmts.cpp @@ -243,6 +243,8 @@ bool WMTS::getCapabilities(const QString &url, const QString &file) bool WMTS::load(const QString &file, const QString &url, const QString &layer, const QString &set) { + QMap::const_iterator it; + if (!QFileInfo(file).exists()) if (!getCapabilities(url, file)) return false; @@ -257,6 +259,12 @@ bool WMTS::load(const QString &file, const QString &url, const QString &layer, _errorString = "No tile matrix found"; return false; } + for (it = _zooms.constBegin(); it != _zooms.constEnd(); ++it) { + if (!it->isValid()) { + _errorString = it->id + ": invalid tile matrix definition"; + return false; + } + } return true; } diff --git a/src/map/wmts.h b/src/map/wmts.h index 98e4030c..4bab87eb 100644 --- a/src/map/wmts.h +++ b/src/map/wmts.h @@ -20,8 +20,12 @@ public: QSize matrix; QRect limits; + Zoom() : scaleDenominator(0) {} bool operator<(const Zoom &other) const {return this->scaleDenominator > other.scaleDenominator;} + bool isValid() const + {return scaleDenominator > 0 && !id.isEmpty() && tile.isValid() + && matrix.isValid();} }; bool load(const QString &path, const QString &url, const QString &layer,