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