Skip to content

Commit

Permalink
Use the point label as additional source for the id hash
Browse files Browse the repository at this point in the history
Some (marine) maps have different points with the same type on the same
position.
  • Loading branch information
tumic0 committed May 11, 2023
1 parent 682fcc0 commit bb22ad9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/map/IMG/rgnfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ using namespace IMG;

#define MASK(bits) ((1U << (bits)) - 1U)

static quint64 pointId(const QPoint &pos, quint32 type)
static quint64 pointId(const QPoint &pos, quint32 type, const QString &label)
{
quint64 hash = qHash(pos);
quint64 hash = qHash(pos) ^ qHash(label);
quint64 id = ((quint64)type)<<40 | (hash & 0xFFFFFFFFFF);

// Increase rendering priorities for some special items
Expand Down Expand Up @@ -483,11 +483,11 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,

point.type = (quint16)type<<8 | subtype;
point.coordinates = Coordinates(toWGS24(pos.x()), toWGS24(pos.y()));
point.id = pointId(pos, point.type);
if (lbl && (labelPtr & 0x3FFFFF))
point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF,
labelPtr & 0x400000, !(Style::isCountry(point.type)
|| Style::isState(point.type)), Style::isSpot(point.type));
point.id = pointId(pos, point.type, point.label.text());

points->append(point);
}
Expand Down Expand Up @@ -536,9 +536,9 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
continue;

point.coordinates = Coordinates(toWGS24(p.x()), toWGS24(p.y()));
point.id = pointId(p, point.type);
if (lbl && (labelPtr & 0x3FFFFF))
point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);
point.id = pointId(p, point.type, point.label.text());

points->append(point);
}
Expand Down

0 comments on commit bb22ad9

Please sign in to comment.