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

Fixed broken inland ECDIS styles

This commit is contained in:
Martin Tůma 2022-11-24 09:34:03 +01:00
parent 03c9dbd2a7
commit 0c8a77a4ca
5 changed files with 38 additions and 15 deletions

View File

@ -17,4 +17,7 @@
#define VALDCO 174
#define WATLEV 187
#define I_CATACH 17000
#define I_RESTRN 17004
#endif // ENC_ATTRIBUTES_H

View File

@ -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) {

View File

@ -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

View File

@ -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<TextItem*> &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<TextItem*> &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;

View File

@ -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);