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

Do not recompute the adjacency info offset as we are lready there

This commit is contained in:
Martin Tůma 2022-04-14 23:32:50 +02:00
parent ec06793a19
commit b115c041be
2 changed files with 2 additions and 14 deletions

View File

@ -210,7 +210,6 @@ bool NODFile::nodeInfo(Handle &hdl, AdjacencyInfo &adj) const
QPoint pos( QPoint pos(
adj.blockInfo.hdr.nodeLonBase + DELTA(lon, lonBits, maxBits), adj.blockInfo.hdr.nodeLonBase + DELTA(lon, lonBits, maxBits),
adj.blockInfo.hdr.nodeLatBase + DELTA(lat, latBits, maxBits)); adj.blockInfo.hdr.nodeLatBase + DELTA(lat, latBits, maxBits));
adj.nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1;
if ((maxBits < 0x1c) && (adj.nodeInfo.flags & 8)) { if ((maxBits < 0x1c) && (adj.nodeInfo.flags & 8)) {
quint8 extraBits = 0x1c - maxBits; quint8 extraBits = 0x1c - maxBits;
@ -219,7 +218,6 @@ bool NODFile::nodeInfo(Handle &hdl, AdjacencyInfo &adj) const
if (!(bs.read(extraBits, extraLon) && bs.read(extraBits, extraLat))) if (!(bs.read(extraBits, extraLon) && bs.read(extraBits, extraLat)))
return false; return false;
pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4); pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4);
adj.nodeInfo.bytes++;
} }
// TODO?: check and adjust (shift) coordinates // TODO?: check and adjust (shift) coordinates
@ -282,11 +280,7 @@ bool NODFile::nodeBlock(Handle &hdl, quint32 nodeOffset,
bool NODFile::absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const bool NODFile::absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
{ {
quint32 infoOffset = (adj.nodeOffset << _nodeShift) + _block.offset BitStream1 bs(*this, hdl, _block.offset + _block.size - pos(hdl));
+ adj.nodeInfo.bytes;
if (!seek(hdl, infoOffset))
return false;
BitStream1 bs(*this, hdl, _block.offset + _block.size - infoOffset);
quint8 linkId = adj.blockInfo.hdr.linksCount; quint8 linkId = adj.blockInfo.hdr.linksCount;
quint32 m2p = 2; quint32 m2p = 2;
@ -386,12 +380,7 @@ bool NODFile::absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
bool NODFile::relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const bool NODFile::relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
{ {
quint32 infoOffset = (adj.nodeOffset << _nodeShift) + _block.offset BitStream1 bs(*this, hdl, _block.offset + _block.size - pos(hdl));
+ adj.nodeInfo.bytes;
if (!seek(hdl, infoOffset))
return false;
BitStream1 bs(*this, hdl, _block.offset + _block.size - infoOffset);
quint32 linkId = adj.blockInfo.hdr.linksCount; quint32 linkId = adj.blockInfo.hdr.linksCount;
quint32 skip = 8; quint32 skip = 8;

View File

@ -40,7 +40,6 @@ public:
{ {
QPoint pos; QPoint pos;
quint8 flags; quint8 flags;
quint8 bytes;
}; };
struct AdjacencyInfo struct AdjacencyInfo