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

Generate propper IDs for pints with class labels

This commit is contained in:
Martin Tůma 2022-02-07 00:59:38 +01:00
parent d4cceb0859
commit 70f0e8982b

View File

@ -18,7 +18,7 @@ static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr)
quint64 id; quint64 id;
uint hash = (uint)qHash(QPair<uint,uint>((uint)qHash( uint hash = (uint)qHash(QPair<uint,uint>((uint)qHash(
QPair<int, int>(pos.x(), pos.y())), labelPtr & 0x3FFFFF)); QPair<int, int>(pos.x(), pos.y())), labelPtr));
id = ((quint64)type)<<32 | hash; id = ((quint64)type)<<32 | hash;
// Make country labels precedent over city labels // Make country labels precedent over city labels
if (!Style::isCountry(type)) if (!Style::isCountry(type))
@ -451,7 +451,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags)) if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags))
return false; return false;
QPoint pos(subdiv->lon() + LS(lon, 24-subdiv->bits()), QPoint p(subdiv->lon() + LS(lon, 24-subdiv->bits()),
subdiv->lat() + LS(lat, 24-subdiv->bits())); subdiv->lat() + LS(lat, 24-subdiv->bits()));
// Discard NT points breaking style draw order logic (and causing huge // Discard NT points breaking style draw order logic (and causing huge
@ -459,8 +459,9 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
if (point.type == 0x11400) if (point.type == 0x11400)
continue; continue;
point.coordinates = Coordinates(toWGS24(pos.x()), toWGS24(pos.y())); point.coordinates = Coordinates(toWGS24(p.x()), toWGS24(p.y()));
point.id = pointId(pos, point.type, labelPtr & 0x3FFFFF); point.id = pointId(p, point.type, point.classLabel ? pos(hdl)
: labelPtr & 0x3FFFFF);
if (lbl && (labelPtr & 0x3FFFFF)) if (lbl && (labelPtr & 0x3FFFFF))
point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF); point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);