mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Fixed crash on error introduced with the latest error handling changes
(+ ignore broken tiles rather than terminate parsing)
This commit is contained in:
parent
67a1f7e108
commit
f61d9fcd55
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#define CACHE_SIZE 8388608 /* 8MB */
|
#define CACHE_SIZE 8388608 /* 8MB */
|
||||||
|
|
||||||
|
typedef QMap<QString, VectorTile*> TileMap;
|
||||||
|
|
||||||
struct CTX
|
struct CTX
|
||||||
{
|
{
|
||||||
CTX(const RectC &rect, int bits, QList<IMG::Poly> *polygons,
|
CTX(const RectC &rect, int bits, QList<IMG::Poly> *polygons,
|
||||||
@ -49,7 +51,7 @@ IMG::IMG(const QString &fileName)
|
|||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, VectorTile*> tileMap;
|
TileMap tileMap;
|
||||||
QString typFile;
|
QString typFile;
|
||||||
|
|
||||||
if (!_file.open(QFile::ReadOnly)) {
|
if (!_file.open(QFile::ReadOnly)) {
|
||||||
@ -78,6 +80,7 @@ IMG::IMG(const QString &fileName)
|
|||||||
_blockSize = 1 << (e1 + e2);
|
_blockSize = 1 << (e1 + e2);
|
||||||
_blockCache.setMaxCost(CACHE_SIZE / _blockSize);
|
_blockCache.setMaxCost(CACHE_SIZE / _blockSize);
|
||||||
|
|
||||||
|
|
||||||
// Read the FAT table
|
// Read the FAT table
|
||||||
quint8 flag;
|
quint8 flag;
|
||||||
quint64 offset = 0x200;
|
quint64 offset = 0x200;
|
||||||
@ -149,21 +152,30 @@ IMG::IMG(const QString &fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create tile tree
|
// Create tile tree
|
||||||
for (QMap<QString, VectorTile*>::iterator it = tileMap.begin();
|
for (TileMap::iterator it = tileMap.begin(); it != tileMap.end(); ++it) {
|
||||||
it != tileMap.end(); ++it) {
|
VectorTile *tile = it.value();
|
||||||
CHECK((*it)->init());
|
|
||||||
|
if (!tile->init()) {
|
||||||
|
qWarning("%s: %s: Invalid map tile", qPrintable(_file.fileName()),
|
||||||
|
qPrintable(it.key()));
|
||||||
|
delete tile;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double min[2], max[2];
|
double min[2], max[2];
|
||||||
min[0] = (*it)->bounds().left();
|
min[0] = tile->bounds().left();
|
||||||
min[1] = (*it)->bounds().bottom();
|
min[1] = tile->bounds().bottom();
|
||||||
max[0] = (*it)->bounds().right();
|
max[0] = tile->bounds().right();
|
||||||
max[1] = (*it)->bounds().top();
|
max[1] = tile->bounds().top();
|
||||||
_tileTree.Insert(min, max, *it);
|
_tileTree.Insert(min, max, tile);
|
||||||
|
|
||||||
_bounds |= (*it)->bounds();
|
_bounds |= tile->bounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
_valid = true;
|
if (!_tileTree.Count())
|
||||||
|
_errorString = "No usable map tile found";
|
||||||
|
else
|
||||||
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMG::~IMG()
|
IMG::~IMG()
|
||||||
|
Loading…
Reference in New Issue
Block a user