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

Compare commits

...

4 Commits

7 changed files with 107 additions and 64 deletions

View File

@ -156,6 +156,8 @@
<file alias="triangulation-point.png">icons/IMG/marine/triangulation-point.png</file> <file alias="triangulation-point.png">icons/IMG/marine/triangulation-point.png</file>
<file alias="yacht-harbor.png">icons/IMG/marine/yacht-harbor.png</file> <file alias="yacht-harbor.png">icons/IMG/marine/yacht-harbor.png</file>
<file alias="pile.png">icons/IMG/marine/pile.png</file> <file alias="pile.png">icons/IMG/marine/pile.png</file>
<file alias="spar-buoy.png">icons/IMG/marine/spar-buoy.png</file>
<file alias="mooring-buoy.png">icons/IMG/marine/mooring-buoy.png</file>
</qresource> </qresource>
<!-- Mapsforge rendertheme --> <!-- Mapsforge rendertheme -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

View File

@ -37,11 +37,96 @@ RGNFile::~RGNFile()
delete _huffmanTable; delete _huffmanTable;
} }
bool RGNFile::readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
MapData::Poly *poly) const
{
quint32 id;
quint32 top, right, bottom, left;
if (!(lbl && lbl->imageIdSize()))
return false;
if (size < lbl->imageIdSize() + 16U)
return false;
if (!(readVUInt32(hdl, lbl->imageIdSize(), id)
&& readUInt32(hdl, top) && readUInt32(hdl, right)
&& readUInt32(hdl, bottom) && readUInt32(hdl, left)))
return false;
poly->raster = Raster(lbl, id, QRect(QPoint(left, top), QPoint(right,
bottom)));
return true;
}
bool RGNFile::readDepthInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const
{
quint32 depth = 0;
quint32 units = (flags >> 3) & 3;
quint32 val;
if (!size) {
depth = flags & 0x3f;
units = (flags >> 5) & 2;
} else if (size == 1) {
if (!readUInt8(hdl, val))
return false;
depth = val | ((quint32)flags & 7) << 8;
} else if (size < 4) {
Q_ASSERT(!(flags & 4));
if (!readVUInt32(hdl, size, val))
return false;
depth = val | ((quint32)flags & 3) << (size * 8);
} else
return false;
point->label = QString::number(d2m(depth, units));
return true;
}
bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const
{
quint32 val, rb = size;
quint32 units = (flags >> 3) & 3;
if (!size)
return false;
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));
return true;
}
bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const
{
if (!(flags & 1))
return true;
if (!lbl)
return false;
point->label = lbl->label(lblHdl, this, hdl, size);
point->classLabel = true;
return true;
}
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const void *object, const LBLFile *lbl, Handle &lblHdl) const
{ {
quint8 flags; quint8 flags;
quint32 rs; quint32 rs = 0;
MapData::Poly *poly = (segmentType == Polygon) MapData::Poly *poly = (segmentType == Polygon)
? (MapData::Poly *) object : 0; ? (MapData::Poly *) object : 0;
MapData::Point *point = (segmentType == Point) MapData::Point *point = (segmentType == Point)
@ -64,73 +149,18 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
if (!readVUInt32(hdl, rs)) if (!readVUInt32(hdl, rs))
return false; return false;
break; break;
default:
rs = 0;
break;
} }
quint32 off = pos(hdl); quint32 off = pos(hdl);
if (poly && Style::isRaster(poly->type) && lbl && lbl->imageIdSize()) { if (poly && Style::isRaster(poly->type))
quint32 id; readRasterInfo(hdl, lbl, rs, poly);
quint32 top, right, bottom, left; if (point && Style::isDepthPoint(point->type))
readDepthInfo(hdl, flags, rs, point);
if (rs < lbl->imageIdSize() + 16U) if (point && Style::isObstructionPoint(point->type))
return false; readObstructionInfo(hdl, flags, rs, point);
if (!(readVUInt32(hdl, lbl->imageIdSize(), id) if (point && !Style::isMarinePoint(point->type))
&& readUInt32(hdl, top) && readUInt32(hdl, right) readLabel(hdl, lbl, lblHdl, flags, rs, point);
&& readUInt32(hdl, bottom) && readUInt32(hdl, left)))
return false;
poly->raster = Raster(lbl, id, QRect(QPoint(left, top), QPoint(right,
bottom)));
}
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::isObstructionPoint(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;
}
return seek(hdl, off + rs); return seek(hdl, off + rs);
} }

View File

@ -58,6 +58,14 @@ private:
const LBLFile *lbl, Handle &lblHdl) const; const LBLFile *lbl, Handle &lblHdl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const; bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const; bool skipGblFields(Handle &hdl, quint32 flags) const;
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
MapData::Poly *poly) const;
bool readDepthInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const;
HuffmanTable *_huffmanTable; HuffmanTable *_huffmanTable;
Section _base, _dict, _polygons, _lines, _points; Section _base, _dict, _polygons, _lines, _points;

View File

@ -252,6 +252,7 @@ void Style::defaultLineStyle()
_lines[0x10507] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine)); _lines[0x10507] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine));
_lines[0x10601] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine)); _lines[0x10601] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine));
_lines[0x10606] = Line(QImage(":/IMG/anchor-line.png")); _lines[0x10606] = Line(QImage(":/IMG/anchor-line.png"));
_lines[0x1060c] = Line(QPen(QColor("#e728e7"), 1, Qt::SolidLine));
_lines[0x1060d] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine)); _lines[0x1060d] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine));
_lines[0x10611] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine)); _lines[0x10611] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine));
} }
@ -507,6 +508,7 @@ void Style::defaultPointStyle()
_points[0x10204] = Point(QImage(":/IMG/buoy.png")); _points[0x10204] = Point(QImage(":/IMG/buoy.png"));
_points[0x10205] = Point(QImage(":/IMG/buoy.png")); _points[0x10205] = Point(QImage(":/IMG/buoy.png"));
_points[0x10206] = Point(QImage(":/IMG/beacon.png")); _points[0x10206] = Point(QImage(":/IMG/beacon.png"));
_points[0x10207] = Point(QImage(":/IMG/spar-buoy.png"));
_points[0x1020b] = Point(QImage(":/IMG/buoy.png")); _points[0x1020b] = Point(QImage(":/IMG/buoy.png"));
_points[0x1020d] = Point(QImage(":/IMG/light-platform.png")); _points[0x1020d] = Point(QImage(":/IMG/light-platform.png"));
_points[0x1020e] = Point(QImage(":/IMG/beacon.png")); _points[0x1020e] = Point(QImage(":/IMG/beacon.png"));
@ -517,6 +519,7 @@ void Style::defaultPointStyle()
_points[0x10213] = Point(QImage(":/IMG/beacon.png")); _points[0x10213] = Point(QImage(":/IMG/beacon.png"));
_points[0x10214] = Point(QImage(":/IMG/beacon.png")); _points[0x10214] = Point(QImage(":/IMG/beacon.png"));
_points[0x10215] = Point(QImage(":/IMG/beacon.png")); _points[0x10215] = Point(QImage(":/IMG/beacon.png"));
_points[0x10216] = Point(QImage(":/IMG/mooring-buoy.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[0x10400] = Point(QImage(":/IMG/obstruction.png"));