1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Improved error reporting

This commit is contained in:
Martin Tůma 2018-02-26 19:05:53 +01:00
parent 962310df7d
commit d1b0e2ef73
2 changed files with 15 additions and 15 deletions

View File

@ -12,9 +12,9 @@
Downloader *WMTS::_downloader = 0;
bool WMTS::createProjection(const QString &crs)
bool WMTS::createProjection()
{
QStringList list(crs.split(':'));
QStringList list(_crs.split(':'));
QString authority, code;
bool res;
int epsg;
@ -109,12 +109,8 @@ void WMTS::tileMatrixSet(QXmlStreamReader &reader, const QString &set, bool yx)
}
if (id == set) {
if (!createProjection(crs)) {
reader.raiseError("Invalid/unknown CRS");
return;
}
_matrixes.unite(matrixes);
_crs = crs;
_matrixes = matrixes;
}
}
@ -172,7 +168,7 @@ void WMTS::tileMatrixSetLink(QXmlStreamReader &reader, const QString &set)
}
if (id == set)
_limits.unite(limits);
_limits = limits;
}
RectC WMTS::wgs84BoundingBox(QXmlStreamReader &reader)
@ -316,12 +312,16 @@ bool WMTS::load(const QString &file, const WMTS::Setup &setup)
_tileUrl.replace("{TileCol}", "$x");
}
if (_matrixes.isEmpty()) {
_errorString = "No usable tile matrix found";
if (_crs.isNull()) {
_errorString = "Missing CRS definition";
return false;
}
if (_projection.isNull()) {
_errorString = "Missing CRS definition";
if (!createProjection()) {
_errorString = _crs + ": unknown CRS";
return false;
}
if (_matrixes.isEmpty()) {
_errorString = "No usable tile matrix found";
return false;
}
if (_tileUrl.isNull()) {

View File

@ -87,8 +87,7 @@ private:
{return !id.isEmpty() && rect.isValid();}
};
bool createProjection(const QString &crs);
bool createProjection();
RectC wgs84BoundingBox(QXmlStreamReader &reader);
MatrixLimits tileMatrixLimits(QXmlStreamReader &reader);
TileMatrix tileMatrix(QXmlStreamReader &reader, bool yx);
@ -108,6 +107,7 @@ private:
QSet<TileMatrix> _matrixes;
QSet<MatrixLimits> _limits;
RectC _bounds;
QString _crs;
Projection _projection;
QString _tileUrl;