1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Added support for depth points

This commit is contained in:
Martin Tůma 2022-04-03 18:21:26 +02:00
parent c5e46957a8
commit 576a063dcb
3 changed files with 54 additions and 1 deletions

View File

@ -27,6 +27,11 @@ static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr)
return id; return id;
} }
static double d2m(quint32 val, quint32 flags)
{
return (flags & 1) ? val / 10.0 : val;
}
RGNFile::~RGNFile() RGNFile::~RGNFile()
{ {
delete _huffmanTable; delete _huffmanTable;
@ -81,7 +86,48 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
bottom))); 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->label = lbl->label(lblHdl, this, hdl, rs);
point->classLabel = true; point->classLabel = true;
} }

View File

@ -519,6 +519,7 @@ void Style::defaultPointStyle()
_points[0x10215] = Point(QImage(":/IMG/beacon.png")); _points[0x10215] = Point(QImage(":/IMG/beacon.png"));
_points[0x10306] = Point(QImage(":/IMG/church.png")); _points[0x10306] = Point(QImage(":/IMG/church.png"));
_points[0x1030a] = Point(QImage(":/IMG/triangulation-point.png")); _points[0x1030a] = Point(QImage(":/IMG/triangulation-point.png"));
_points[0x10400] = Point(QImage(":/IMG/obstruction.png"));
_points[0x10401] = Point(QImage(":/IMG/obstruction.png")); _points[0x10401] = Point(QImage(":/IMG/obstruction.png"));
_points[0x10402] = Point(QImage(":/IMG/wreck.png")); _points[0x10402] = Point(QImage(":/IMG/wreck.png"));
_points[0x10403] = Point(QImage(":/IMG/wreck-exposed.png")); _points[0x10403] = Point(QImage(":/IMG/wreck-exposed.png"));

View File

@ -119,6 +119,12 @@ public:
{return (type == TYPE(0x1e));} {return (type == TYPE(0x1e));}
static bool isRaster(quint32 type) static bool isRaster(quint32 type)
{return (type == 0x10613);} {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: private:
struct Section { struct Section {