1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-19 12:12:08 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2021-08-23 22:27:36 +02:00
parent 1d2b93466f
commit 09a6d8655e
2 changed files with 10 additions and 12 deletions

View File

@ -433,9 +433,9 @@ bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
quint16 mask = 0; quint16 mask = 0;
quint32 size; quint32 size;
bool firstIsShape = (linkInfo.flags >> 0x12) & 1; bool firstIsShape = (linkInfo.flags >> 10) & 1;
bool singleTopology = (linkInfo.flags >> 0x11) & 1; bool singleTopology = (linkInfo.flags >> 9) & 1;
bool hasLevels = (linkInfo.flags >> 0x13) & 1; bool hasLevels = (linkInfo.flags >> 11) & 1;
if (!singleTopology || hasLevels) { if (!singleTopology || hasLevels) {
if (!bs.readVUInt32(size)) if (!bs.readVUInt32(size))

View File

@ -156,14 +156,12 @@ bool NODFile::linkInfo(Handle &hdl, const BlockInfo &blockInfo, quint32 linkId,
if (!seek(hdl, infoOffset)) if (!seek(hdl, infoOffset))
return false; return false;
quint32 unused, flags; quint32 padding;
BitStream1 bs(*this, hdl, _blockOffset + _blockSize - infoOffset); BitStream1 bs(*this, hdl, _blockOffset + _blockSize - infoOffset);
if (!(bs.read(skip, unused) && bs.read(0xc, flags))) if (!(bs.read(skip, padding) && bs.read(0xc, linkInfo.flags)))
return false; return false;
linkInfo.flags = ((flags << 8) & 0xf0000) | (flags & 0xff); if (!(linkInfo.flags & 0x100)) {
if (!(flags << 8 & 0x10000)) {
if (!bs.read(s1, linkInfo.linkOffset)) if (!bs.read(s1, linkInfo.linkOffset))
return false; return false;
} else { } else {
@ -221,10 +219,9 @@ bool NODFile::nodeInfo(Handle &hdl, const BlockInfo &blockInfo,
pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4); pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4);
nodeInfo.bytes++; nodeInfo.bytes++;
} }
// TODO?: extra bits // TODO?: check and adjust (shift) coordinates
nodeInfo.pos = pos; nodeInfo.pos = pos;
nodeInfo.flags &= 0xf8;
return true; return true;
} }
@ -311,8 +308,9 @@ bool NODFile::absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
if (firstLoop) { if (firstLoop) {
skip >>= (flags >> 5) & 1; skip >>= (flags >> 5) & 1;
flags |= 0x20; flags |= 0x20;
firstLoop = false;
} }
firstLoop = false;
quint32 f4 = flags & 0x10; quint32 f4 = flags & 0x10;
quint32 f4sn = (f4 >> 4) ^ 1; quint32 f4sn = (f4 >> 4) ^ 1;
quint32 m1 = (flags >> 5) & f4sn; quint32 m1 = (flags >> 5) & f4sn;
@ -416,8 +414,8 @@ bool NODFile::relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
if (firstLoop) { if (firstLoop) {
skip >>= (flags >> 5) & 1; skip >>= (flags >> 5) & 1;
flags = ((flags >> 1) & 0x20) | (flags & 0xffffffdf); flags = ((flags >> 1) & 0x20) | (flags & 0xffffffdf);
firstLoop = false;
} }
firstLoop = false;
flagsBits >>= (flags >> 3) & 1; flagsBits >>= (flags >> 3) & 1;
quint32 m = (((flags & 0x70) == 0x30) << 1) | ((flags >> 6) & 1); quint32 m = (((flags & 0x70) == 0x30) << 1) | ((flags >> 6) & 1);
if (!m) { if (!m) {