From af688314fb94f1298b470fb4aaf5b34e38547747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 8 Nov 2022 01:16:38 +0100 Subject: [PATCH] Define symbols draw order --- src/map/ENC/mapdata.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ src/map/ENC/mapdata.h | 7 +------ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 5dbacd54..8cfeaadb 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -15,6 +15,45 @@ using namespace ENC; #define PRIM_L 2 #define PRIM_A 3 +static QMap orderMapInit() +{ + QMap map; + + map.insert(BUAARE, 1); + map.insert(BCNISD, 2); + map.insert(BCNLAT, 3); + map.insert(BCNSAW, 4); + map.insert(BCNSPP, 5); + map.insert(BOYCAR, 6); + map.insert(BOYINB, 7); + map.insert(BOYISD, 8); + map.insert(BOYLAT, 9); + map.insert(BOYSAW, 10); + map.insert(BOYSPP, 11); + map.insert(MORFAC, 12); + map.insert(OFSPLF, 13); + map.insert(LIGHTS, 14); + map.insert(OBSTRN, 15); + map.insert(WRECKS, 16); + map.insert(UWTROC, 17); + map.insert(HRBFAC, 18); + map.insert(PILPNT, 19); + map.insert(ACHBRT, 20); + map.insert(LNDELV, 21); + map.insert(LNDMRK, 22); + map.insert(SOUNDG, 0xFFFFFFFF); + + return map; +} + +static QMap orderMap = orderMapInit(); + +static uint order(uint type) +{ + QMap::const_iterator it = orderMap.find(type); + return (it == orderMap.constEnd()) ? type + 512 : it.value(); +} + static void warning(const ISO8211::Field &FRID, uint PRIM) { uint RCID = 0xFFFFFFFF; @@ -132,6 +171,13 @@ static Coordinates point(const ISO8211::Record &r, uint COMF) return coordinates(x, y, COMF); } +MapData::Point::Point(uint type, const Coordinates &c, const QString &label) + : _type(type), _pos(c), _label(label) +{ + uint hash = (uint)qHash(QPair(c.lon(), c.lat())); + _id = ((quint64)order(type>>16))<<32 | hash; +} + QVector MapData::soundings(const ISO8211::Record &r, uint COMF, uint SOMF) { diff --git a/src/map/ENC/mapdata.h b/src/map/ENC/mapdata.h index 3d6dad6e..80781ff7 100644 --- a/src/map/ENC/mapdata.h +++ b/src/map/ENC/mapdata.h @@ -52,12 +52,7 @@ public: class Point { public: - Point(uint type, const Coordinates &c, const QString &label) - : _type(type), _pos(c), _label(label) - { - uint hash = (uint)qHash(QPair(c.lon(), c.lat())); - _id = ((quint64)type)<<32 | hash; - } + Point(uint type, const Coordinates &c, const QString &label); const Coordinates &pos() const {return _pos;} uint type() const {return _type;}