1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00

Prefer loading speed over "NT maps not supported" reporting

This commit is contained in:
Martin Tůma 2019-09-10 19:45:06 +02:00
parent 33e3471ca3
commit c2abf2c146
3 changed files with 18 additions and 8 deletions

View File

@ -99,17 +99,19 @@ bool RGNFile::init()
&& readUInt32(hdl, _pointsOffset) && readUInt32(hdl, _pointsSize))) && readUInt32(hdl, _pointsOffset) && readUInt32(hdl, _pointsSize)))
return false; return false;
} }
if (hdrLen >= 0x7D) { if (hdrLen >= 0x7D) {
quint32 dictOffset, dictSize; quint32 dictOffset, dictSize;
if (!(seek(hdl, _gmpOffset + 0x71) && readUInt32(hdl, dictOffset) if (!(seek(hdl, _gmpOffset + 0x71) && readUInt32(hdl, dictOffset)
&& readUInt32(hdl, dictSize))) && readUInt32(hdl, dictSize)))
return false; return false;
if (dictSize || dictOffset) { // NT maps
qWarning("%s: NT compression not supported", qPrintable(fileName())); if (dictSize || dictOffset)
return false; return false;
} }
}
_init = true;
return true; return true;
} }
@ -418,6 +420,9 @@ void RGNFile::objects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl,
{ {
Handle rgnHdl, lblHdl, netHdl; Handle rgnHdl, lblHdl, netHdl;
if (!_init && !init())
return;
QVector<RGNFile::Segment> seg(segments(rgnHdl, subdiv)); QVector<RGNFile::Segment> seg(segments(rgnHdl, subdiv));
for (int i = 0; i < seg.size(); i++) { for (int i = 0; i < seg.size(); i++) {
switch (seg.at(i).type()) { switch (seg.at(i).type()) {
@ -447,6 +452,9 @@ void RGNFile::extObjects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl,
{ {
Handle rgnHdl, lblHdl; Handle rgnHdl, lblHdl;
if (!_init && !init())
return;
if (polygons && subdiv->polygonsOffset() != subdiv->polygonsEnd()) { if (polygons && subdiv->polygonsOffset() != subdiv->polygonsEnd()) {
quint32 start = _polygonsOffset + subdiv->polygonsOffset(); quint32 start = _polygonsOffset + subdiv->polygonsOffset();
quint32 end = subdiv->polygonsEnd() quint32 end = subdiv->polygonsEnd()

View File

@ -14,12 +14,10 @@ public:
RGNFile(IMG *img) RGNFile(IMG *img)
: SubFile(img), _offset(0), _size(0), _polygonsOffset(0), : SubFile(img), _offset(0), _size(0), _polygonsOffset(0),
_polygonsSize(0), _linesOffset(0), _linesSize(0), _pointsOffset(0), _polygonsSize(0), _linesOffset(0), _linesSize(0), _pointsOffset(0),
_pointsSize(0) {} _pointsSize(0), _init(false) {}
RGNFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _offset(0), RGNFile(SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _offset(0),
_size(0), _polygonsOffset(0), _polygonsSize(0), _linesOffset(0), _size(0), _polygonsOffset(0), _polygonsSize(0), _linesOffset(0),
_linesSize(0), _pointsOffset(0), _pointsSize(0) {} _linesSize(0), _pointsOffset(0), _pointsSize(0), _init(false) {}
bool init();
void objects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl, void objects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl,
NETFile *net, QList<IMG::Poly> *polygons, QList<IMG::Poly> *lines, NETFile *net, QList<IMG::Poly> *polygons, QList<IMG::Poly> *lines,
@ -75,6 +73,8 @@ private:
quint8 _data; quint8 _data;
}; };
bool init();
static bool sign(BitStream &bs, int &val); static bool sign(BitStream &bs, int &val);
static int bitSize(quint8 baseSize, bool variableSign, bool extraBit); static int bitSize(quint8 baseSize, bool variableSign, bool extraBit);
@ -103,6 +103,8 @@ private:
quint32 _linesSize; quint32 _linesSize;
quint32 _pointsOffset; quint32 _pointsOffset;
quint32 _pointsSize; quint32 _pointsSize;
bool _init;
}; };
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG

View File

@ -46,7 +46,7 @@ bool VectorTile::init()
if (_gmp && !initGMP()) if (_gmp && !initGMP())
return false; return false;
if (!(_tre && _tre->init() && _rgn && _rgn->init())) if (!(_tre && _tre->init() && _rgn))
return false; return false;
return true; return true;