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

Compare commits

...

2 Commits

Author SHA1 Message Date
744cfde08f Refactoring 2025-05-18 21:50:56 +02:00
7f491330b1 Dashed misc/cartographic lines 2025-05-18 21:42:57 +02:00
5 changed files with 35 additions and 10 deletions

View File

@ -34,7 +34,8 @@ public:
enum Flags { enum Flags {
OneWay = 1, OneWay = 1,
Invert = 2, Invert = 2,
Direction = 4 Direction = 4,
Dashed = 8
}; };
/* QPointF insted of Coordinates for performance reasons (no need to /* QPointF insted of Coordinates for performance reasons (no need to

View File

@ -188,9 +188,12 @@ void RasterTile::drawPolygons(QPainter *painter,
static quint32 lineType(quint32 type, quint32 flags) static quint32 lineType(quint32 type, quint32 flags)
{ {
if (Style::isMiscLine(type)) if (Style::isCartographicLine(type)) {
if (flags & MapData::Poly::Dashed)
return type | (flags & 0xFF000000) | 1<<20;
else
return type | (flags & 0xFF000000); return type | (flags & 0xFF000000);
else if (flags & MapData::Poly::Direction) } else if (flags & MapData::Poly::Direction)
return type | 1<<20; return type | 1<<20;
else else
return type; return type;

View File

@ -255,14 +255,19 @@ bool RGNFile::readLineInfo(Handle &hdl, quint8 flags, quint32 size,
if (!readUInt8(hdl, val)) if (!readUInt8(hdl, val))
return false; return false;
if (val & 3)
line->flags |= MapData::Poly::Dashed;
if ((val >> 3) & 3) if ((val >> 3) & 3)
line->flags |= MapData::Poly::Direction; line->flags |= MapData::Poly::Direction;
if ((val >> 3) & 2) if ((val >> 3) & 2)
line->flags |= MapData::Poly::Invert; line->flags |= MapData::Poly::Invert;
return true; return true;
} else } else {
if ((flags >> 4) & 3)
line->flags |= MapData::Poly::Dashed;
return (!size); return (!size);
}
} }
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
@ -314,7 +319,7 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
if (point && Style::isLabelPoint(point->type)) if (point && Style::isLabelPoint(point->type))
point->flags |= (flags & 0xf)<<20; point->flags |= (flags & 0xf)<<20;
if (line && Style::isMarineLine(line->type)) if (line && Style::isStyledLine(line->type))
readLineInfo(hdl, flags, rs, line); readLineInfo(hdl, flags, rs, line);
return seek(hdl, off + rs); return seek(hdl, off + rs);

View File

@ -530,21 +530,37 @@ void Style::defaultLineStyle(qreal ratio)
_lines[0x110508] = Line(QImage(":/marine/minefield-line.png")); _lines[0x110508] = Line(QImage(":/marine/minefield-line.png"));
_lines[0x10601] = Line(QPen(QColor(0, 0, 0), 1)); _lines[0x10601] = Line(QPen(QColor(0, 0, 0), 1));
_lines[0x110601] = Line(QPen(QColor(0, 0, 0), 1, Qt::DashLine));
_lines[0x10601 | 1<<24] = Line(QPen(QColor(0, 0x90, 0xfc), 1)); _lines[0x10601 | 1<<24] = Line(QPen(QColor(0, 0x90, 0xfc), 1));
_lines[0x110601 | 1<<24] = Line(QPen(QColor(0, 0x90, 0xfc), 1, Qt::DashLine));
_lines[0x10601 | 2<<24] = Line(QPen(QColor(0x30, 0xa0, 0x1b), 1)); _lines[0x10601 | 2<<24] = Line(QPen(QColor(0x30, 0xa0, 0x1b), 1));
_lines[0x110601 | 2<<24] = Line(QPen(QColor(0x30, 0xa0, 0x1b), 1, Qt::DashLine));
_lines[0x10601 | 3<<24] = Line(QPen(QColor(0xa7, 0xf1, 0xfc), 1)); _lines[0x10601 | 3<<24] = Line(QPen(QColor(0xa7, 0xf1, 0xfc), 1));
_lines[0x110601 | 3<<24] = Line(QPen(QColor(0xa7, 0xf1, 0xfc), 1, Qt::DashLine));
_lines[0x10601 | 4<<24] = Line(QPen(QColor(0xff, 0x40, 0x40), 1)); _lines[0x10601 | 4<<24] = Line(QPen(QColor(0xff, 0x40, 0x40), 1));
_lines[0x110601 | 4<<24] = Line(QPen(QColor(0xff, 0x40, 0x40), 1, Qt::DashLine));
_lines[0x10601 | 5<<24] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1)); _lines[0x10601 | 5<<24] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1));
_lines[0x110601 | 5<<24] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
_lines[0x10601 | 6<<24] = Line(QPen(QColor(0xfc, 0xe0, 0x1f), 1)); _lines[0x10601 | 6<<24] = Line(QPen(QColor(0xfc, 0xe0, 0x1f), 1));
_lines[0x110601 | 6<<24] = Line(QPen(QColor(0xfc, 0xe0, 0x1f), 1, Qt::DashLine));
_lines[0x10601 | 7<<24] = Line(QPen(QColor(0xfc, 0x79, 0x1e), 1)); _lines[0x10601 | 7<<24] = Line(QPen(QColor(0xfc, 0x79, 0x1e), 1));
_lines[0x110601 | 7<<24] = Line(QPen(QColor(0xfc, 0x79, 0x1e), 1, Qt::DashLine));
_lines[0x10601 | 8<<24] = Line(QPen(QColor(0x40, 0x40, 0x40), 1)); _lines[0x10601 | 8<<24] = Line(QPen(QColor(0x40, 0x40, 0x40), 1));
_lines[0x110601 | 8<<24] = Line(QPen(QColor(0x40, 0x40, 0x40), 1, Qt::DashLine));
_lines[0x10601 | 9<<24] = Line(QPen(QColor(0x84, 0xe6, 0xfc), 1)); _lines[0x10601 | 9<<24] = Line(QPen(QColor(0x84, 0xe6, 0xfc), 1));
_lines[0x110601 | 9<<24] = Line(QPen(QColor(0x84, 0xe6, 0xfc), 1, Qt::DashLine));
_lines[0x10601 | 10<<24] = Line(QPen(QColor(0x83, 0x53, 0x15), 1)); _lines[0x10601 | 10<<24] = Line(QPen(QColor(0x83, 0x53, 0x15), 1));
_lines[0x110601 | 10<<24] = Line(QPen(QColor(0x83, 0x53, 0x15), 1, Qt::DashLine));
_lines[0x10601 | 11<<24] = Line(QPen(QColor(0xd2, 0xfc, 0xfc), 1)); _lines[0x10601 | 11<<24] = Line(QPen(QColor(0xd2, 0xfc, 0xfc), 1));
_lines[0x110601 | 11<<24] = Line(QPen(QColor(0xd2, 0xfc, 0xfc), 1, Qt::DashLine));
_lines[0x10601 | 12<<24] = Line(QPen(QColor(0xc5, 0xf1, 0xc2), 1)); _lines[0x10601 | 12<<24] = Line(QPen(QColor(0xc5, 0xf1, 0xc2), 1));
_lines[0x110601 | 12<<24] = Line(QPen(QColor(0xc5, 0xf1, 0xc2), 1, Qt::DashLine));
_lines[0x10601 | 13<<24] = Line(QPen(QColor(0xfc, 0xc6, 0xfc), 1)); _lines[0x10601 | 13<<24] = Line(QPen(QColor(0xfc, 0xc6, 0xfc), 1));
_lines[0x110601 | 13<<24] = Line(QPen(QColor(0xfc, 0xc6, 0xfc), 1, Qt::DashLine));
_lines[0x10601 | 14<<24] = Line(QPen(QColor(0xe2, 0xdc, 0xa9), 1)); _lines[0x10601 | 14<<24] = Line(QPen(QColor(0xe2, 0xdc, 0xa9), 1));
_lines[0x110601 | 14<<24] = Line(QPen(QColor(0xe2, 0xdc, 0xa9), 1, Qt::DashLine));
_lines[0x10601 | 15<<24] = Line(QPen(QColor(0xcd, 0xcd, 0xcd), 1)); _lines[0x10601 | 15<<24] = Line(QPen(QColor(0xcd, 0xcd, 0xcd), 1));
_lines[0x110601 | 15<<24] = Line(QPen(QColor(0xcd, 0xcd, 0xcd), 1, Qt::DashLine));
_lines[0x10602] = Line(QPen(QColor(0xfc, 0xb4, 0xfc), 2)); _lines[0x10602] = Line(QPen(QColor(0xfc, 0xb4, 0xfc), 2));
_lines[0x10603] = Line(QImage(":/marine/international-maritime-boundary.png")); _lines[0x10603] = Line(QImage(":/marine/international-maritime-boundary.png"));
_lines[0x110603] = Line(QImage(":/marine/international-maritime-boundary.png")); _lines[0x110603] = Line(QImage(":/marine/international-maritime-boundary.png"));

View File

@ -142,6 +142,8 @@ public:
{return (type >= 0x1400 && type <= 0x153f);} {return (type >= 0x1400 && type <= 0x153f);}
static bool isState(quint32 type) static bool isState(quint32 type)
{return (type == TYPE(0x1e));} {return (type == TYPE(0x1e));}
static bool isMarina(quint32 type)
{return type == 0x10703;}
static bool isRaster(quint32 type) static bool isRaster(quint32 type)
{return (type == 0x10613);} {return (type == 0x10613);}
static bool isDepthPoint(quint32 type) static bool isDepthPoint(quint32 type)
@ -156,12 +158,10 @@ public:
{return type == 0x10500;} {return type == 0x10500;}
static bool isMarinePoint(quint32 type) static bool isMarinePoint(quint32 type)
{return type >= 0x10100 && type < 0x10a00;} {return type >= 0x10100 && type < 0x10a00;}
static bool isMarineLine(quint32 type) static bool isStyledLine(quint32 type)
{return type >= 0x10400 && type < 0x10700;} {return type >= 0x10400 && type < 0x10700;}
static bool isMiscLine(quint32 type) static bool isCartographicLine(quint32 type)
{return type == 0x10601;} {return type == 0x10601;}
static bool isMarina(quint32 type)
{return type == 0x10703;}
static bool hasColorset(quint32 type) static bool hasColorset(quint32 type)
{return (isBuoy(type) && !(type == 0x1020d || type >= 0x10216));} {return (isBuoy(type) && !(type == 0x1020d || type >= 0x10216));}