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

ENC inland waters style hack

This commit is contained in:
Martin Tůma 2022-11-05 20:38:08 +01:00
parent 67209c4ad5
commit 015598b951
5 changed files with 35 additions and 8 deletions

View File

@ -3,6 +3,7 @@
#define CATHAF 30
#define CATLMK 35
#define CATMOR 40
#define CATREA 56
#define CATWRK 71
#define DRVAL1 87

View File

@ -374,7 +374,8 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
label = av.at(1).toString();
if ((OBJL == HRBFAC && key == CATHAF)
|| (OBJL == LNDMRK && key == CATLMK)
|| (OBJL == WRECKS && key == CATWRK))
|| (OBJL == WRECKS && key == CATWRK)
|| (OBJL == MORFAC && key == CATMOR))
subtype = av.at(1).toString().toUInt();
}

View File

@ -29,20 +29,24 @@
#define DYKCON 49
#define FAIRWY 51
#define FERYRT 53
#define GATCON 61
#define HRBFAC 64
#define LAKARE 69
#define LNDARE 71
#define LNDELV 72
#define LNDMRK 74
#define LIGHTS 75
#define MORFAC 84
#define NAVLNE 85
#define OBSTRN 86
#define OFSPLF 87
#define PILPNT 90
#define PIPSOL 94
#define PONTON 95
#define RAILWY 106
#define RESARE 112
#define RIVERS 114
#define ROADWY 116
#define SLCONS 122
#define SLOTOP 126
#define SOUNDG 129

View File

@ -9,6 +9,8 @@ using namespace ENC;
#define ICON_PADDING 2
#define ECDIS(x) (((x)>TYPE(17000))?((x)-TYPE(17000)):(x))
static const QColor haloColor(Qt::white);
static struct {
@ -82,9 +84,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 (poly->type() != s.drawOrder().at(n))
if (ECDIS(poly->type()) != s.drawOrder().at(n))
continue;
const Style::Polygon &style = s.polygon(poly->type());
const Style::Polygon &style = s.polygon(ECDIS(poly->type()));
painter->setPen(style.pen());
painter->setBrush(style.brush());
@ -101,7 +103,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(line->type());
const Style::Line &style = s.line(ECDIS(line->type()));
if (!style.img().isNull()) {
BitmapLine::draw(painter, polyline(line->path()), style.img());
@ -127,13 +129,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(point->type());
const Style::Point &style = s.point(ECDIS(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(point->type())
const QColor *hColor = Style::isSounding(ECDIS(point->type()))
? 0 : &haloColor;
if ((!label || !fnt) && !img)
@ -154,7 +156,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(line->type());
const Style::Line &style = s.line(ECDIS(line->type()));
if (style.img().isNull() && style.pen() == Qt::NoPen)
continue;

View File

@ -1,7 +1,19 @@
#include <QPainter>
#include "style.h"
using namespace ENC;
static QImage railroad()
{
QImage img(16, 4, QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::black);
QPainter p(&img);
p.setPen(QPen(Qt::white, 2));
p.drawLine(9, 2, 15, 2);
return img;
}
void Style::defaultPolygonStyle()
{
_polygons[TYPE(M_COVR)] = Polygon(QBrush("#ffffff"));
@ -76,6 +88,9 @@ 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(RAILWY)] = Line(railroad());
_lines[TYPE(ROADWY)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine));
_lines[TYPE(GATCON)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine));
}
void Style::defaultPointStyle()
@ -107,9 +122,13 @@ void Style::defaultPointStyle()
_points[SUBTYPE(WRECKS, 5)] = Point(QImage(":/marine/wreck-exposed.png"));
_points[TYPE(UWTROC)] = Point(QImage(":/marine/rock-dangerous.png"), Small);
_points[SUBTYPE(HRBFAC, 5)] = Point(QImage(":/marine/yacht-harbor.png"));
_points[TYPE(PILPNT)] = Point(QImage(":/marine/pile.png"), Small);
_points[TYPE(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);
_points[SUBTYPE(MORFAC, 5)] = Point(QImage(":/marine/pile.png"), Small);
_points[SUBTYPE(MORFAC, 7)] = Point(QImage(":/marine/mooring-buoy.png"),
Small);
}
Style::Style()