mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 11:52:08 +01:00
Improved error handling
This commit is contained in:
parent
c1844f9557
commit
7fd30bbda3
@ -177,14 +177,8 @@ bool OfflineMap::getImageInfo(const QString &path)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OfflineMap::getTileInfo(const QStringList &tiles,
|
bool OfflineMap::getTileInfo(const QStringList &tiles, const QString &path)
|
||||||
const QString &path)
|
|
||||||
{
|
{
|
||||||
if (!_size.isValid()) {
|
|
||||||
qWarning("%s: missing total image size (IWH)", qPrintable(_name));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tiles.isEmpty()) {
|
if (tiles.isEmpty()) {
|
||||||
qWarning("%s: empty tile set", qPrintable(_name));
|
qWarning("%s: empty tile set", qPrintable(_name));
|
||||||
return false;
|
return false;
|
||||||
@ -235,6 +229,15 @@ bool OfflineMap::mapLoaded(int res)
|
|||||||
return true;
|
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)
|
OfflineMap::OfflineMap(const QString &path, QObject *parent) : Map(parent)
|
||||||
{
|
{
|
||||||
int errorLine = -2;
|
int errorLine = -2;
|
||||||
@ -280,11 +283,15 @@ OfflineMap::OfflineMap(const QString &path, QObject *parent) : Map(parent)
|
|||||||
computeResolution(points);
|
computeResolution(points);
|
||||||
|
|
||||||
if (_tar.isOpen()) {
|
if (_tar.isOpen()) {
|
||||||
|
if (!totalSizeSet())
|
||||||
|
return;
|
||||||
if (!getTileInfo(_tar.files()))
|
if (!getTileInfo(_tar.files()))
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
QDir set(fi.absoluteFilePath() + "/" + "set");
|
QDir set(fi.absoluteFilePath() + "/" + "set");
|
||||||
if (set.exists()) {
|
if (set.exists()) {
|
||||||
|
if (!totalSizeSet())
|
||||||
|
return;
|
||||||
if (!getTileInfo(set.entryList(), set.canonicalPath()))
|
if (!getTileInfo(set.entryList(), set.canonicalPath()))
|
||||||
return;
|
return;
|
||||||
_imgPath = QString();
|
_imgPath = QString();
|
||||||
@ -322,7 +329,8 @@ OfflineMap::OfflineMap(Tar &tar, const QString &path, QObject *parent)
|
|||||||
}
|
}
|
||||||
if (!mapLoaded(errorLine))
|
if (!mapLoaded(errorLine))
|
||||||
return;
|
return;
|
||||||
|
if (!totalSizeSet())
|
||||||
|
return;
|
||||||
if (!computeTransformation(points))
|
if (!computeTransformation(points))
|
||||||
return;
|
return;
|
||||||
computeResolution(points);
|
computeResolution(points);
|
||||||
|
@ -42,6 +42,7 @@ private:
|
|||||||
|
|
||||||
int parseMapFile(QIODevice &device, QList<ReferencePoint> &points);
|
int parseMapFile(QIODevice &device, QList<ReferencePoint> &points);
|
||||||
bool mapLoaded(int res);
|
bool mapLoaded(int res);
|
||||||
|
bool totalSizeSet();
|
||||||
bool computeTransformation(const QList<ReferencePoint> &points);
|
bool computeTransformation(const QList<ReferencePoint> &points);
|
||||||
bool computeResolution(QList<ReferencePoint> &points);
|
bool computeResolution(QList<ReferencePoint> &points);
|
||||||
bool getTileInfo(const QStringList &tiles, const QString &path = QString());
|
bool getTileInfo(const QStringList &tiles, const QString &path = QString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user