1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

The coordinates and the point type are sufficient for a unique ID

This commit is contained in:
Martin Tůma 2023-04-19 00:33:04 +02:00
parent f8d40850a7
commit 229af4c749

View File

@ -13,12 +13,11 @@ using namespace IMG;
#define MASK(bits) ((1U << (bits)) - 1U) #define MASK(bits) ((1U << (bits)) - 1U)
static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr) static quint64 pointId(const QPoint &pos, quint32 type)
{ {
quint64 id; quint64 id;
uint hash = (uint)qHash(QPair<uint,uint>((uint)qHash( uint hash = (uint)qHash(QPair<int, int>(pos.x(), pos.y()));
QPair<int, int>(pos.x(), pos.y())), labelPtr));
id = ((quint64)type)<<32 | hash; id = ((quint64)type)<<32 | hash;
// Increase rendering priorities for some special items // Increase rendering priorities for some special items
@ -485,7 +484,7 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
point.type = (quint16)type<<8 | subtype; point.type = (quint16)type<<8 | subtype;
point.coordinates = Coordinates(toWGS24(pos.x()), toWGS24(pos.y())); point.coordinates = Coordinates(toWGS24(pos.x()), toWGS24(pos.y()));
point.id = pointId(pos, point.type, labelPtr & 0x3FFFFF); point.id = pointId(pos, point.type);
if (lbl && (labelPtr & 0x3FFFFF)) if (lbl && (labelPtr & 0x3FFFFF))
point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF, point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF,
labelPtr & 0x400000, !(Style::isCountry(point.type) labelPtr & 0x400000, !(Style::isCountry(point.type)
@ -538,8 +537,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
continue; continue;
point.coordinates = Coordinates(toWGS24(p.x()), toWGS24(p.y())); point.coordinates = Coordinates(toWGS24(p.x()), toWGS24(p.y()));
point.id = pointId(p, point.type, point.classLabel ? pos(hdl) point.id = pointId(p, point.type);
: labelPtr & 0x3FFFFF);
if (lbl && (labelPtr & 0x3FFFFF)) if (lbl && (labelPtr & 0x3FFFFF))
point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF); point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);