mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Added error checking
This commit is contained in:
parent
6e95d484cd
commit
fa3e6d8550
@ -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<QString, Zoom>::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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user