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

Compare commits

...

2 Commits

Author SHA1 Message Date
70f0e8982b Generate propper IDs for pints with class labels 2022-02-07 00:59:38 +01:00
d4cceb0859 Code cleanup 2022-02-07 00:59:12 +01:00
2 changed files with 7 additions and 7 deletions

View File

@ -312,14 +312,13 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
if (!(_poiSize >= (offset << _poiMultiplier) if (!(_poiSize >= (offset << _poiMultiplier)
&& seek(hdl, _poiOffset + (offset << _poiMultiplier)) && seek(hdl, _poiOffset + (offset << _poiMultiplier))
&& readUInt24(hdl, poiOffset) && (poiOffset & 0x3FFFFF))) && readUInt24(hdl, poiOffset) && (poiOffset & 0x3FFFFF)))
return QString(); return Label();
labelOffset = _offset + ((poiOffset & 0x3FFFFF) << _multiplier); labelOffset = _offset + ((poiOffset & 0x3FFFFF) << _multiplier);
} else } else
labelOffset = _offset + (offset << _multiplier); labelOffset = _offset + (offset << _multiplier);
if (labelOffset > _offset + _size) if (labelOffset > _offset + _size)
return QString(); return Label();
if (!seek(hdl, labelOffset)) if (!seek(hdl, labelOffset))
return Label(); return Label();

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);