From 0c8a77a4ca32d4391d1d375b7a428bb41930aa20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 24 Nov 2022 09:34:03 +0100 Subject: [PATCH] Fixed broken inland ECDIS styles --- src/map/ENC/attributes.h | 3 +++ src/map/ENC/mapdata.cpp | 7 +++++-- src/map/ENC/objects.h | 9 +++++++++ src/map/ENC/rastertile.cpp | 14 ++++++-------- src/map/ENC/style.cpp | 20 +++++++++++++++----- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/map/ENC/attributes.h b/src/map/ENC/attributes.h index e90cf4fb..e6ce74b3 100644 --- a/src/map/ENC/attributes.h +++ b/src/map/ENC/attributes.h @@ -17,4 +17,7 @@ #define VALDCO 174 #define WATLEV 187 +#define I_CATACH 17000 +#define I_RESTRN 17004 + #endif // ENC_ATTRIBUTES_H diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 4a35afb0..02c92f1b 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -474,9 +474,12 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL) if (OBJL == DEPARE && key == DRVAL1) subtype = depthLevel(av.at(1).toByteArray()); else if ((OBJL == RESARE && key == CATREA) - || (OBJL == ACHARE && key == CATACH)) + || (OBJL == I_RESARE && key == CATREA) + || (OBJL == ACHARE && key == CATACH) + || (OBJL == I_ACHARE && key == I_CATACH)) subtype = av.at(1).toByteArray().toUInt(); - else if (OBJL == RESARE && key == RESTRN) { + else if ((OBJL == RESARE && key == RESTRN) + || (OBJL == I_RESARE && key == I_RESTRN)) { if (av.at(1).toByteArray().toUInt() == 1) subtype = 2; } else if (OBJL == TSSLPT && key == ORIENT) { diff --git a/src/map/ENC/objects.h b/src/map/ENC/objects.h index a30777b9..5d2edcaa 100644 --- a/src/map/ENC/objects.h +++ b/src/map/ENC/objects.h @@ -70,4 +70,13 @@ #define WRECKS 159 #define M_COVR 302 +#define I_ACHBRT 17000 +#define I_ACHARE 17001 +#define I_RESARE 17005 +#define I_BERTHS 17010 +#define I_BRIDGE 17011 +#define I_CBLOHD 17012 +#define I_FERYRT 17013 +#define I_WTWAXS 17051 + #endif // ENC_OBJECTS_H diff --git a/src/map/ENC/rastertile.cpp b/src/map/ENC/rastertile.cpp index e7d9c014..a58a8d57 100644 --- a/src/map/ENC/rastertile.cpp +++ b/src/map/ENC/rastertile.cpp @@ -12,8 +12,6 @@ using namespace ENC; #define ICON_PADDING 2 #define ARROW_SIZE 0.005 -#define ECDIS(x) (((x)>TYPE(17000))?((x)-TYPE(17000)):(x)) - const float C1 = 0.866025f; /* sqrt(3)/2 */ static const QColor haloColor(Qt::white); @@ -161,9 +159,9 @@ void RasterTile::drawPolygons(QPainter *painter) for (int n = 0; n < s.drawOrder().size(); n++) { for (int i = 0; i < _polygons.size(); i++) { const MapData::Poly *poly = _polygons.at(i); - if (ECDIS(poly->type()) != s.drawOrder().at(n)) + if (poly->type() != s.drawOrder().at(n)) continue; - const Style::Polygon &style = s.polygon(ECDIS(poly->type())); + const Style::Polygon &style = s.polygon(poly->type()); if (!style.img().isNull()) { for (int i = 0; i < poly->path().size(); i++) @@ -186,7 +184,7 @@ void RasterTile::drawLines(QPainter *painter) for (int i = 0; i < _lines.size(); i++) { const MapData::Line *line = _lines.at(i); - const Style::Line &style = s.line(ECDIS(line->type())); + const Style::Line &style = s.line(line->type()); if (!style.img().isNull()) { BitmapLine::draw(painter, polyline(line->path()), style.img()); @@ -212,13 +210,13 @@ void RasterTile::processPoints(QList &textItems) for (int i = 0; i < _points.size(); i++) { const MapData::Point *point = _points.at(i); - const Style::Point &style = s.point(ECDIS(point->type())); + const Style::Point &style = s.point(point->type()); const QString *label = point->label().isEmpty() ? 0 : &(point->label()); const QImage *img = style.img().isNull() ? 0 : &style.img(); const QFont *fnt = font(style.textFontSize()); const QColor *color = &style.textColor(); - const QColor *hColor = Style::isSounding(ECDIS(point->type())) + const QColor *hColor = Style::isSounding(point->type()) ? 0 : &haloColor; if ((!label || !fnt) && !img) @@ -239,7 +237,7 @@ void RasterTile::processLines(QList &textItems) for (int i = 0; i < _lines.size(); i++) { const MapData::Line *line = _lines.at(i); - const Style::Line &style = s.line(ECDIS(line->type())); + const Style::Line &style = s.line(line->type()); if (style.img().isNull() && style.pen() == Qt::NoPen) continue; diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index d1cff4be..a0a55d8c 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -22,6 +22,7 @@ void Style::defaultPolygonStyle() _polygons[TYPE(BUISGL)] = Polygon(QBrush("#d98b21"), QPen(QColor("#966118"), 1.5)); _polygons[TYPE(BRIDGE)] = Polygon(QBrush("#a58140")); + _polygons[TYPE(I_BRIDGE)] = Polygon(QBrush("#a58140")); _polygons[SUBTYPE(DEPARE, 0)] = Polygon(QBrush("#98c064")); _polygons[SUBTYPE(DEPARE, 1)] = Polygon(QBrush("#a0a0ff")); _polygons[SUBTYPE(DEPARE, 2)] = Polygon(QBrush("#b0b0ff")); @@ -54,7 +55,9 @@ void Style::defaultPolygonStyle() _polygons[SUBTYPE(RESARE, 9)] = Polygon(QBrush(QColor("#ff0000"), Qt::BDiagPattern)); _polygons[SUBTYPE(RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png")); + _polygons[SUBTYPE(I_RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png")); _polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png")); + _polygons[SUBTYPE(I_ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png")); _polygons[TYPE(PRCARE)] = Polygon(QBrush(QColor("#eb49eb"), Qt::BDiagPattern)); _polygons[TYPE(DAMCON)] = Polygon(QBrush("#d98b21"), QPen(QColor("#000000"), @@ -75,11 +78,12 @@ void Style::defaultPolygonStyle() << TYPE(UNSARE) << SUBTYPE(DEPARE, 4) << SUBTYPE(DEPARE, 5) << SUBTYPE(DEPARE, 6) << TYPE(LAKARE) << TYPE(CANALS) << TYPE(DYKCON) << TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE) - << TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS) - << TYPE(PONTON) << TYPE(FLODOC) << TYPE(DRYDOC) << TYPE(DAMCON) - << TYPE(PYLONS) << TYPE(MORFAC) << TYPE(DMPGRD) << TYPE(TSEZNE) - << TYPE(OBSTRN) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) - << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) << TYPE(PRCARE); + << TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(I_BRIDGE) + << TYPE(SLCONS) << TYPE(PONTON) << TYPE(FLODOC) << TYPE(DRYDOC) + << TYPE(DAMCON) << TYPE(PYLONS) << TYPE(MORFAC) << TYPE(DMPGRD) + << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) + << SUBTYPE(I_ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) + << SUBTYPE(I_RESARE, 2) << TYPE(PRCARE); } void Style::defaultLineStyle() @@ -89,7 +93,9 @@ void Style::defaultLineStyle() _lines[TYPE(DEPCNT)].setTextColor(QColor("#558adf")); _lines[TYPE(DEPCNT)].setTextFontSize(Small); _lines[TYPE(CBLOHD)] = Line(QImage(":/marine/cable-line.png")); + _lines[TYPE(I_CBLOHD)] = Line(QImage(":/marine/cable-line.png")); _lines[TYPE(BRIDGE)] = Line(QPen(QColor("#a58140"), 3, Qt::SolidLine)); + _lines[TYPE(I_BRIDGE)] = Line(QPen(QColor("#a58140"), 3, Qt::SolidLine)); _lines[TYPE(CBLSUB)] = Line(QImage(":/marine/cable.png")); _lines[TYPE(CBLSUB)].setTextFontSize(Small); _lines[TYPE(PIPSOL)] = Line(QImage(":/marine/pipeline.png")); @@ -106,16 +112,19 @@ void Style::defaultLineStyle() _lines[TYPE(SLOTOP)] = Line(QPen(QColor("#797420"), 1, Qt::SolidLine)); _lines[TYPE(OBSTRN)] = Line(QPen(QColor("#000000"), 1.5, Qt::DotLine)); _lines[TYPE(FERYRT)] = Line(QImage(":/marine/ferry-line.png")); + _lines[TYPE(I_FERYRT)] = Line(QImage(":/marine/ferry-line.png")); _lines[TYPE(RAILWY)] = Line(railroad()); _lines[TYPE(ROADWY)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine)); _lines[TYPE(GATCON)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine)); _lines[TYPE(TSELNE)] = Line(QPen(QColor("#80fcb4fc"), 4, Qt::SolidLine)); + _lines[TYPE(I_WTWAXS)] = Line(QPen(QColor("#000000"), 0, Qt::DashLine)); _lines[SUBTYPE(RECTRC, 1)] = Line(QPen(QColor("#000000"), 0, Qt::SolidLine)); _lines[SUBTYPE(RECTRC, 2)] = Line(QPen(QColor("#000000"), 0, Qt::DashLine)); _lines[SUBTYPE(RCRTCL, 1)] = Line(QPen(QColor("#eb49eb"), 0, Qt::SolidLine)); _lines[SUBTYPE(RCRTCL, 2)] = Line(QPen(QColor("#eb49eb"), 0, Qt::DashLine)); _lines[TYPE(FAIRWY)] = Line(QPen(QColor("#888888"), 1, Qt::DashDotDotLine)); _lines[TYPE(BERTHS)] = Line(QPen(QColor("#333333"), 2)); + _lines[TYPE(I_BERTHS)] = Line(QPen(QColor("#333333"), 2)); _lines[TYPE(FNCLNE)] = Line(QImage(":/marine/fence-line.png")); } @@ -161,6 +170,7 @@ void Style::defaultPointStyle() Small); _points[SUBTYPE(HRBFAC, 5)] = Point(QImage(":/marine/yacht-harbor.png")); _points[TYPE(ACHBRT)] = Point(QImage(":/marine/anchorage.png")); + _points[TYPE(I_ACHBRT)] = Point(QImage(":/marine/anchorage.png")); _points[TYPE(OFSPLF)] = Point(QImage(":/marine/platform.png")); _points[TYPE(PILPNT)] = Point(QImage(":/marine/pile.png"), Small); _points[SUBTYPE(MORFAC, 1)] = Point(QImage(":/marine/pile.png"), Small);