mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +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,
|
bool WMTS::load(const QString &file, const QString &url, const QString &layer,
|
||||||
const QString &set)
|
const QString &set)
|
||||||
{
|
{
|
||||||
|
QMap<QString, Zoom>::const_iterator it;
|
||||||
|
|
||||||
if (!QFileInfo(file).exists())
|
if (!QFileInfo(file).exists())
|
||||||
if (!getCapabilities(url, file))
|
if (!getCapabilities(url, file))
|
||||||
return false;
|
return false;
|
||||||
@ -257,6 +259,12 @@ bool WMTS::load(const QString &file, const QString &url, const QString &layer,
|
|||||||
_errorString = "No tile matrix found";
|
_errorString = "No tile matrix found";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
for (it = _zooms.constBegin(); it != _zooms.constEnd(); ++it) {
|
||||||
|
if (!it->isValid()) {
|
||||||
|
_errorString = it->id + ": invalid tile matrix definition";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,12 @@ public:
|
|||||||
QSize matrix;
|
QSize matrix;
|
||||||
QRect limits;
|
QRect limits;
|
||||||
|
|
||||||
|
Zoom() : scaleDenominator(0) {}
|
||||||
bool operator<(const Zoom &other) const
|
bool operator<(const Zoom &other) const
|
||||||
{return this->scaleDenominator > other.scaleDenominator;}
|
{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,
|
bool load(const QString &path, const QString &url, const QString &layer,
|
||||||
|
Loading…
Reference in New Issue
Block a user