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

Fixed path shape parsing

This commit is contained in:
Martin Tůma 2022-04-16 23:39:03 +02:00
parent 62fa0cce36
commit 1458d66798
3 changed files with 9 additions and 4 deletions

View File

@ -84,10 +84,7 @@ public:
bool readNext(qint32 &lonDelta, qint32 &latDelta) bool readNext(qint32 &lonDelta, qint32 &latDelta)
{ {
if (!(readDelta(_lonSign, lonDelta) && readDelta(_latSign, latDelta))) return (readDelta(_lonSign, lonDelta) && readDelta(_latSign, latDelta));
return false;
return (lonDelta || latDelta);
} }
protected: protected:

View File

@ -152,6 +152,9 @@ bool NETFile::readLine(BitStream4R &bs, const SubDiv *subdiv,
qint32 lonDelta, latDelta; qint32 lonDelta, latDelta;
while (stream.readNext(lonDelta, latDelta)) { while (stream.readNext(lonDelta, latDelta)) {
if (!(lonDelta | latDelta))
break;
pos.rx() += LS(lonDelta, 32-subdiv->bits()); pos.rx() += LS(lonDelta, 32-subdiv->bits());
if (pos.rx() < 0 && subdiv->lon() >= 0) if (pos.rx() < 0 && subdiv->lon() >= 0)
pos.rx() = 0x7fffffff; pos.rx() = 0x7fffffff;
@ -235,6 +238,8 @@ bool NETFile::readShape(const NODFile *nod, SubFile::Handle &nodHdl,
if (!stream.readNext(lonDelta, latDelta)) if (!stream.readNext(lonDelta, latDelta))
break; break;
if (!(lonDelta | latDelta) && !startWithStream)
break;
if (hasAdjustBit && !stream.read(1, adjustBit)) if (hasAdjustBit && !stream.read(1, adjustBit))
return false; return false;

View File

@ -387,6 +387,9 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
poly.points.append(QPointF(c.lon(), c.lat())); poly.points.append(QPointF(c.lon(), c.lat()));
while (stream.readNext(lonDelta, latDelta)) { while (stream.readNext(lonDelta, latDelta)) {
if (!(lonDelta | latDelta))
break;
pos.rx() += LS(lonDelta, 32-subdiv->bits()-shift); pos.rx() += LS(lonDelta, 32-subdiv->bits()-shift);
if (pos.rx() < 0 && subdiv->lon() >= 0) if (pos.rx() < 0 && subdiv->lon() >= 0)
pos.rx() = 0x7fffffff; pos.rx() = 0x7fffffff;