1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02: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(
adj.blockInfo.hdr.nodeLonBase + DELTA(lon, lonBits, maxBits),
adj.blockInfo.hdr.nodeLatBase + DELTA(lat, latBits, maxBits));
adj.nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1;
if ((maxBits < 0x1c) && (adj.nodeInfo.flags & 8)) {
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)))
return false;
pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4);
adj.nodeInfo.bytes++;
}
// 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
{
quint32 infoOffset = (adj.nodeOffset << _nodeShift) + _block.offset
+ adj.nodeInfo.bytes;
if (!seek(hdl, infoOffset))
return false;
BitStream1 bs(*this, hdl, _block.offset + _block.size - infoOffset);
BitStream1 bs(*this, hdl, _block.offset + _block.size - pos(hdl));
quint8 linkId = adj.blockInfo.hdr.linksCount;
quint32 m2p = 2;
@ -386,12 +380,7 @@ bool NODFile::absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
bool NODFile::relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
{
quint32 infoOffset = (adj.nodeOffset << _nodeShift) + _block.offset
+ adj.nodeInfo.bytes;
if (!seek(hdl, infoOffset))
return false;
BitStream1 bs(*this, hdl, _block.offset + _block.size - infoOffset);
BitStream1 bs(*this, hdl, _block.offset + _block.size - pos(hdl));
quint32 linkId = adj.blockInfo.hdr.linksCount;
quint32 skip = 8;

View File

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