1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-01 07:43:03 +02:00

Recommended routes style

This commit is contained in:
Martin Tůma 2025-05-19 09:18:32 +02:00
parent 744cfde08f
commit 93fc190748
5 changed files with 28 additions and 4 deletions

View File

@ -193,7 +193,9 @@ static quint32 lineType(quint32 type, quint32 flags)
return type | (flags & 0xFF000000) | 1<<20;
else
return type | (flags & 0xFF000000);
} else if (flags & MapData::Poly::Direction)
} else if (Style::isRecommendedRoute(type))
return (flags & MapData::Poly::Dashed) ? type | 1<<20 : type;
else if (flags & MapData::Poly::Direction)
return type | 1<<20;
else
return type;

View File

@ -244,7 +244,7 @@ bool RGNFile::readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
return true;
}
bool RGNFile::readLineInfo(Handle &hdl, quint8 flags, quint32 size,
bool RGNFile::readLineStyle(Handle &hdl, quint8 flags, quint32 size,
MapData::Poly *line) const
{
line->flags |= (flags & 0xf)<<24;
@ -270,6 +270,21 @@ bool RGNFile::readLineInfo(Handle &hdl, quint8 flags, quint32 size,
}
}
bool RGNFile::readRecommendedRoute(Handle &hdl, quint8 flags, quint32 size,
MapData::Poly *line) const
{
Q_UNUSED(flags);
quint32 val;
if (!(size >= 1 && readUInt8(hdl, val)))
return false;
if (val & 2)
line->flags |= MapData::Poly::Dashed;
return true;
}
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, LBLFile *lbl, Handle &lblHdl) const
{
@ -320,7 +335,9 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
point->flags |= (flags & 0xf)<<20;
if (line && Style::isStyledLine(line->type))
readLineInfo(hdl, flags, rs, line);
readLineStyle(hdl, flags, rs, line);
if (line && Style::isRecommendedRoute(line->type))
readRecommendedRoute(hdl, flags, rs, line);
return seek(hdl, off + rs);
}

View File

@ -69,7 +69,9 @@ private:
MapData::Point *point) const;
bool readLightInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readLineInfo(Handle &hdl, quint8 flags, quint32 size,
bool readLineStyle(Handle &hdl, quint8 flags, quint32 size,
MapData::Poly *line) const;
bool readRecommendedRoute(Handle &hdl, quint8 flags, quint32 size,
MapData::Poly *line) const;
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const;

View File

@ -490,6 +490,7 @@ void Style::defaultLineStyle(qreal ratio)
_lines[0x10106] = Line(QImage(":/marine/cable-line.png"));
_lines[0x10107] = Line(QPen(QColor(0xa5, 0x81, 0x40), 3, Qt::SolidLine));
_lines[0x10108] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine));
_lines[0x110108] = Line(QPen(QColor(0, 0, 0), 1, Qt::DashLine));
_lines[0x10301] = Line(QPen(QColor(0x0e, 0x10, 0x87), 1, Qt::SolidLine));
_lines[0x10307] = Line(QPen(QColor(0x05, 0x62, 0x0e), 1, Qt::SolidLine));

View File

@ -162,6 +162,8 @@ public:
{return type >= 0x10400 && type < 0x10700;}
static bool isCartographicLine(quint32 type)
{return type == 0x10601;}
static bool isRecommendedRoute(quint32 type)
{return type == 0x10108;}
static bool hasColorset(quint32 type)
{return (isBuoy(type) && !(type == 0x1020d || type >= 0x10216));}