1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Improved ENC style

This commit is contained in:
Martin Tůma 2022-11-04 22:47:21 +01:00
parent cc2703e71d
commit 5ef31f47f2
4 changed files with 30 additions and 15 deletions

View File

@ -116,6 +116,7 @@ HEADERS += src/common/config.h \
src/GUI/passwordedit.h \
src/data/style.h \
src/data/twonavparser.h \
src/map/ENC/attributes.h \
src/map/ENC/mapdata.h \
src/map/ENC/objects.h \
src/map/ENC/rastertile.h \

View File

@ -1,6 +1,7 @@
#include <QFile>
#include "common/util.h"
#include "objects.h"
#include "attributes.h"
#include "mapdata.h"
using namespace ENC;
@ -86,9 +87,8 @@ static bool polygonCb(MapData::Poly *polygon, void *context)
return true;
}
static uint depthLevel(const QVariant &DRVAL1)
static uint depthLevel(const QString &str)
{
QString str(DRVAL1.toString());
double minDepth = str.isEmpty() ? -1 : str.toDouble();
if (minDepth < 0)
@ -362,10 +362,11 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
const QVector<QVariant> &av = ATTF->data().at(i);
uint key = av.at(0).toUInt();
if (key == 116)
if (key == OBJNAM)
label = av.at(1).toString();
if ((OBJL == HRBFAC && key == 30) || (OBJL == LNDMRK && key == 35)
|| (OBJL == WRECKS && key == 71))
if ((OBJL == HRBFAC && key == CATHAF)
|| (OBJL == LNDMRK && key == CATLMK)
|| (OBJL == WRECKS && key == CATWRK))
subtype = av.at(1).toString().toUInt();
}
@ -385,9 +386,9 @@ MapData::Attr MapData::lineAttr(const ISO8211::Record &r, uint OBJL)
const QVector<QVariant> &av = ATTF->data().at(i);
uint key = av.at(0).toUInt();
if (key == 116)
if (key == OBJNAM)
label = av.at(1).toString();
if ((OBJL == DEPCNT && key == 174))
if ((OBJL == DEPCNT && key == VALDCO))
label = av.at(1).toString();
}
@ -396,8 +397,8 @@ MapData::Attr MapData::lineAttr(const ISO8211::Record &r, uint OBJL)
MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
{
if (OBJL != DEPARE)
return Attr();
QString label;
uint subtype = 0;
const ISO8211::Field *ATTF = r.field("ATTF");
if (!(ATTF && ATTF->data().at(0).size() == 2))
@ -405,11 +406,15 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
for (int i = 0; i < ATTF->data().size(); i++) {
const QVector<QVariant> &av = ATTF->data().at(i);
if (av.at(0).toUInt() == 87)
return Attr(depthLevel(av.at(1)));
uint key = av.at(0).toUInt();
if (OBJL == DEPARE && key == DRVAL1)
subtype = depthLevel(av.at(1).toString());
else if (OBJL == RESARE && key == CATREA)
subtype = av.at(1).toString().toUInt();
}
return Attr();
return Attr(subtype, label);
}
MapData::Point *MapData::pointObject(const Sounding &s)

View File

@ -37,9 +37,12 @@
#define PILPNT 90
#define PIPSOL 94
#define PONTON 95
#define RESARE 112
#define RIVERS 114
#define SLCONS 122
#define SOUNDG 129
#define TSSBND 146
#define TSEZNE 150
#define UWTROC 153
#define WRECKS 159
#define M_COVR 302

View File

@ -19,8 +19,10 @@ void Style::defaultPolygonStyle()
_polygons[SUBTYPE(DEPARE, 4)] = Polygon(QBrush("#c0d0ff"));
_polygons[SUBTYPE(DEPARE, 5)] = Polygon(QBrush("#c0e0ff"));
_polygons[SUBTYPE(DEPARE, 6)] = Polygon(QBrush("#ffffff"));
_polygons[TYPE(DMPGRD)] = Polygon(QBrush(QColor("#a3a3a3"), Qt::Dense3Pattern));
_polygons[TYPE(FAIRWY)] = Polygon(QBrush("#fcb4fc"));
_polygons[TYPE(DMPGRD)] = Polygon(QBrush(QColor("#a3a3a3"),
Qt::Dense3Pattern));
_polygons[TYPE(FAIRWY)] = Polygon(Qt::NoBrush, QPen(QColor("#888888"), 1,
Qt::DashDotDotLine));
_polygons[TYPE(OBSTRN)] = Polygon(Qt::NoBrush, QPen(QColor("#000000"), 1.5,
Qt::DotLine));
_polygons[TYPE(PONTON)] = Polygon(QBrush("#333333"));
@ -32,6 +34,9 @@ void Style::defaultPolygonStyle()
QPen(QColor("#000000"), 1));
_polygons[TYPE(RIVERS)] = Polygon(QBrush("#9fc4e1"));
_polygons[TYPE(AIRARE)] = Polygon(QBrush("#333333"));
_polygons[SUBTYPE(RESARE, 9)] = Polygon(QBrush(QColor("#ff0000"),
Qt::BDiagPattern), QPen(QColor("#ff0000"), 1));
_polygons[TYPE(TSEZNE)] = Polygon(QBrush("#80fcb4fc"));
_drawOrder
<< TYPE(M_COVR) << TYPE(LNDARE) << TYPE(BUISGL) << SUBTYPE(DEPARE, 0)
@ -39,7 +44,7 @@ void Style::defaultPolygonStyle()
<< SUBTYPE(DEPARE, 4) << SUBTYPE(DEPARE, 5) << SUBTYPE(DEPARE, 6)
<< TYPE(LAKARE) << TYPE(RIVERS) << TYPE(FAIRWY) << TYPE(AIRARE)
<< TYPE(BRIDGE) << TYPE(SLCONS) << TYPE(PONTON) << TYPE(DMPGRD)
<< TYPE(OBSTRN) << TYPE(ACHARE);
<< TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(ACHARE) << SUBTYPE(RESARE, 9);
}
void Style::defaultLineStyle()
@ -58,6 +63,7 @@ void Style::defaultLineStyle()
_lines[TYPE(PONTON)] = Line(QPen(QColor("#333333"), 1, Qt::SolidLine));
_lines[TYPE(DYKCON)] = Line(QPen(QColor("#333333"), 2, Qt::SolidLine));
_lines[TYPE(RIVERS)] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine));
_lines[TYPE(TSSBND)] = Line(QPen(QColor("#eb49eb"), 2, Qt::DashLine));
}
void Style::defaultPointStyle()