diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index ece31f6e..ffd48692 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -27,6 +27,11 @@ static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr) return id; } +static double d2m(quint32 val, quint32 flags) +{ + return (flags & 1) ? val / 10.0 : val; +} + RGNFile::~RGNFile() { delete _huffmanTable; @@ -81,7 +86,48 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, bottom))); } - if (point && (flags & 1) && lbl) { + if (point && Style::isDepthPoint(point->type)) { + quint32 depth = 0; + quint32 units = (flags >> 3) & 3; + + if (rs == 0) { + depth = flags & 0x3f; + units = (flags >> 5) & 2; + } else if (rs == 1) { + quint32 val; + + if (!readUInt8(hdl, val)) + return false; + depth = val | ((quint32)flags & 7) << 8; + } else if (rs < 4) { + quint32 val; + + Q_ASSERT(!(flags & 4)); + if (!readVUInt32(hdl, rs, val)) + return false; + depth = val | ((quint32)flags & 3) << (rs * 8); + } + + if (depth) + point->label = QString::number(d2m(depth, units)); + } + + if (point && Style::isIsolatedDangerPoint(point->type) && rs) { + quint32 val, rb = rs; + quint32 units = (flags >> 3) & 3; + + if ((flags & 7) == 7) { + if (!readUInt8(hdl, val)) + return false; + rb--; + } + if (!readVUInt32(hdl, rb, val)) + return false; + + point->label = QString::number(d2m(val, units)); + } + + if (point && !Style::isMarinePoint(point->type) && (flags & 1) && lbl) { point->label = lbl->label(lblHdl, this, hdl, rs); point->classLabel = true; } diff --git a/src/map/IMG/style.cpp b/src/map/IMG/style.cpp index cdee86f7..9f290178 100644 --- a/src/map/IMG/style.cpp +++ b/src/map/IMG/style.cpp @@ -519,6 +519,7 @@ void Style::defaultPointStyle() _points[0x10215] = Point(QImage(":/IMG/beacon.png")); _points[0x10306] = Point(QImage(":/IMG/church.png")); _points[0x1030a] = Point(QImage(":/IMG/triangulation-point.png")); + _points[0x10400] = Point(QImage(":/IMG/obstruction.png")); _points[0x10401] = Point(QImage(":/IMG/obstruction.png")); _points[0x10402] = Point(QImage(":/IMG/wreck.png")); _points[0x10403] = Point(QImage(":/IMG/wreck-exposed.png")); diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index 6f3ef389..fb78144f 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -119,6 +119,12 @@ public: {return (type == TYPE(0x1e));} static bool isRaster(quint32 type) {return (type == 0x10613);} + static bool isDepthPoint(quint32 type) + {return (type == 0x10301);} + static bool isIsolatedDangerPoint(quint32 type) + {return (type == 0x10400);} + static bool isMarinePoint(quint32 type) + {return type >= 0x10100 && type < 0x10a00;} private: struct Section {