From 47b6c9d116da109136b845154be087d88ea9f1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 31 Jan 2021 14:54:21 +0100 Subject: [PATCH] Code cleanup --- src/map/IMG/rgnfile.cpp | 8 +++++--- src/map/IMG/style.h | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index 7be1996e..ac5f60c6 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -2,6 +2,7 @@ #include "common/garmin.h" #include "deltastream.h" #include "huffmanstream.h" +#include "style.h" #include "lblfile.h" #include "netfile.h" #include "nodfile.h" @@ -18,7 +19,7 @@ static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr) QPair(pos.x(), pos.y())), labelPtr & 0x3FFFFF)); id = ((quint64)type)<<32 | hash; // Make country labels precedent over city labels - if (!(type >= 0x1400 && type <= 0x153f)) + if (!Style::isCountry(type)) id |= 1ULL<<63; return id; @@ -390,8 +391,9 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv, point.coordinates = Coordinates(toWGS24(pos.x()), toWGS24(pos.y())); point.id = pointId(pos, point.type, labelPtr & 0x3FFFFF); if (lbl && (labelPtr & 0x3FFFFF)) - point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF, labelPtr & 0x400000, - !(point.type == 0x1400 || point.type == 0x1500 || point.type == 0x1e00)); + point.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF, + labelPtr & 0x400000, !(Style::isCountry(point.type) + || Style::isState(point.type))); points->append(point); } diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index 6a8164de..da7cc74d 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -127,6 +127,10 @@ public: {return (type == 0x6616);} static bool isMajorRoad(quint32 type) {return (type <= TYPE(0x04));} + static bool isCountry(quint32 type) + {return (type >= 0x1400 && type <= 0x153f);} + static bool isState(quint32 type) + {return (type = TYPE(0x1e));} static POIClass poiClass(quint32 type);