1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-20 12:19:11 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
af688314fb Define symbols draw order 2022-11-08 01:16:38 +01:00
1946c3cc6f Image polygon lines 2022-11-08 00:38:45 +01:00
6 changed files with 75 additions and 15 deletions

View File

@ -1,6 +1,7 @@
#ifndef ENC_ATTRIBUTES_H #ifndef ENC_ATTRIBUTES_H
#define ENC_ATTRIBUTES_H #define ENC_ATTRIBUTES_H
#define CATACH 8
#define CATHAF 30 #define CATHAF 30
#define CATLMK 35 #define CATLMK 35
#define CATMOR 40 #define CATMOR 40
@ -9,6 +10,7 @@
#define DRVAL1 87 #define DRVAL1 87
#define ELEVAT 90 #define ELEVAT 90
#define OBJNAM 116 #define OBJNAM 116
#define RESTRN 131
#define VALDCO 174 #define VALDCO 174
#endif // ENC_ATTRIBUTES_H #endif // ENC_ATTRIBUTES_H

View File

@ -15,6 +15,45 @@ using namespace ENC;
#define PRIM_L 2 #define PRIM_L 2
#define PRIM_A 3 #define PRIM_A 3
static QMap<uint,uint> orderMapInit()
{
QMap<uint,uint> map;
map.insert(BUAARE, 1);
map.insert(BCNISD, 2);
map.insert(BCNLAT, 3);
map.insert(BCNSAW, 4);
map.insert(BCNSPP, 5);
map.insert(BOYCAR, 6);
map.insert(BOYINB, 7);
map.insert(BOYISD, 8);
map.insert(BOYLAT, 9);
map.insert(BOYSAW, 10);
map.insert(BOYSPP, 11);
map.insert(MORFAC, 12);
map.insert(OFSPLF, 13);
map.insert(LIGHTS, 14);
map.insert(OBSTRN, 15);
map.insert(WRECKS, 16);
map.insert(UWTROC, 17);
map.insert(HRBFAC, 18);
map.insert(PILPNT, 19);
map.insert(ACHBRT, 20);
map.insert(LNDELV, 21);
map.insert(LNDMRK, 22);
map.insert(SOUNDG, 0xFFFFFFFF);
return map;
}
static QMap<uint,uint> orderMap = orderMapInit();
static uint order(uint type)
{
QMap<uint, uint>::const_iterator it = orderMap.find(type);
return (it == orderMap.constEnd()) ? type + 512 : it.value();
}
static void warning(const ISO8211::Field &FRID, uint PRIM) static void warning(const ISO8211::Field &FRID, uint PRIM)
{ {
uint RCID = 0xFFFFFFFF; uint RCID = 0xFFFFFFFF;
@ -132,6 +171,13 @@ static Coordinates point(const ISO8211::Record &r, uint COMF)
return coordinates(x, y, COMF); return coordinates(x, y, COMF);
} }
MapData::Point::Point(uint type, const Coordinates &c, const QString &label)
: _type(type), _pos(c), _label(label)
{
uint hash = (uint)qHash(QPair<double,double>(c.lon(), c.lat()));
_id = ((quint64)order(type>>16))<<32 | hash;
}
QVector<MapData::Sounding> MapData::soundings(const ISO8211::Record &r, QVector<MapData::Sounding> MapData::soundings(const ISO8211::Record &r,
uint COMF, uint SOMF) uint COMF, uint SOMF)
{ {
@ -419,8 +465,13 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
if (OBJL == DEPARE && key == DRVAL1) if (OBJL == DEPARE && key == DRVAL1)
subtype = depthLevel(av.at(1).toString()); subtype = depthLevel(av.at(1).toString());
else if (OBJL == RESARE && key == CATREA) else if ((OBJL == RESARE && key == CATREA)
|| (OBJL == ACHARE && key == CATACH))
subtype = av.at(1).toString().toUInt(); subtype = av.at(1).toString().toUInt();
else if (OBJL == RESARE && key == RESTRN) {
if (av.at(1).toString().toUInt() == 1)
subtype = 2;
}
} }
return Attr(subtype, label); return Attr(subtype, label);

View File

@ -52,12 +52,7 @@ public:
class Point { class Point {
public: public:
Point(uint type, const Coordinates &c, const QString &label) Point(uint type, const Coordinates &c, const QString &label);
: _type(type), _pos(c), _label(label)
{
uint hash = (uint)qHash(QPair<double,double>(c.lon(), c.lat()));
_id = ((quint64)type)<<32 | hash;
}
const Coordinates &pos() const {return _pos;} const Coordinates &pos() const {return _pos;}
uint type() const {return _type;} uint type() const {return _type;}

View File

@ -88,12 +88,18 @@ void RasterTile::drawPolygons(QPainter *painter)
continue; continue;
const Style::Polygon &style = s.polygon(ECDIS(poly->type())); const Style::Polygon &style = s.polygon(ECDIS(poly->type()));
if (!style.img().isNull()) {
for (int i = 0; i < poly->path().size(); i++)
BitmapLine::draw(painter, polyline(poly->path().at(i)),
style.img());
} else {
painter->setPen(style.pen()); painter->setPen(style.pen());
painter->setBrush(style.brush()); painter->setBrush(style.brush());
painter->drawPath(painterPath(poly->path())); painter->drawPath(painterPath(poly->path()));
} }
} }
} }
}
void RasterTile::drawLines(QPainter *painter) void RasterTile::drawLines(QPainter *painter)
{ {

View File

@ -38,8 +38,6 @@ void Style::defaultPolygonStyle()
_polygons[TYPE(PONTON)] = Polygon(QBrush("#333333")); _polygons[TYPE(PONTON)] = Polygon(QBrush("#333333"));
_polygons[TYPE(SLCONS)] = Polygon(Qt::NoBrush, QPen(QColor("#333333"), 1.5, _polygons[TYPE(SLCONS)] = Polygon(Qt::NoBrush, QPen(QColor("#333333"), 1.5,
Qt::DashLine)); Qt::DashLine));
_polygons[TYPE(ACHARE)] = Polygon(Qt::NoBrush, QPen(QColor("#e728e7"), 1,
Qt::DashDotLine));
_polygons[TYPE(LAKARE)] = Polygon(QBrush("#9fc4e1"), _polygons[TYPE(LAKARE)] = Polygon(QBrush("#9fc4e1"),
QPen(QColor("#000000"), 1)); QPen(QColor("#000000"), 1));
_polygons[TYPE(CANALS)] = Polygon(QBrush("#9fc4e1"), _polygons[TYPE(CANALS)] = Polygon(QBrush("#9fc4e1"),
@ -48,12 +46,15 @@ void Style::defaultPolygonStyle()
_polygons[TYPE(DYKCON)] = Polygon(QBrush(QColor("#9fc4e1"), _polygons[TYPE(DYKCON)] = Polygon(QBrush(QColor("#9fc4e1"),
Qt::Dense4Pattern), QPen(QColor("#000000"), 1)); Qt::Dense4Pattern), QPen(QColor("#000000"), 1));
_polygons[TYPE(AIRARE)] = Polygon(QBrush("#333333")); _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")); _polygons[TYPE(TSEZNE)] = Polygon(QBrush("#80fcb4fc"));
_polygons[TYPE(DRGARE)] = Polygon(QBrush(QColor("#a0a0ff"), _polygons[TYPE(DRGARE)] = Polygon(QBrush(QColor("#a0a0ff"),
Qt::Dense4Pattern)); Qt::Dense4Pattern));
_polygons[TYPE(UNSARE)] = Polygon(QBrush("#999999")); _polygons[TYPE(UNSARE)] = Polygon(QBrush("#999999"));
_polygons[SUBTYPE(RESARE, 9)] = Polygon(QBrush(QColor("#ff0000"),
Qt::BDiagPattern));
_polygons[SUBTYPE(RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png"));
_polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
_drawOrder _drawOrder
<< TYPE(M_COVR) << TYPE(LNDARE) << SUBTYPE(DEPARE, 0) << TYPE(M_COVR) << TYPE(LNDARE) << SUBTYPE(DEPARE, 0)
@ -63,7 +64,7 @@ void Style::defaultPolygonStyle()
<< TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE) << TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE)
<< TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS) << TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS)
<< TYPE(PONTON) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(PONTON) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN)
<< TYPE(ACHARE) << SUBTYPE(RESARE, 9) << TYPE(154); << SUBTYPE(ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2);
} }
void Style::defaultLineStyle() void Style::defaultLineStyle()

View File

@ -29,13 +29,18 @@ public:
{ {
_pen = (pen == Qt::NoPen) ? QPen(_brush, 0) : pen; _pen = (pen == Qt::NoPen) ? QPen(_brush, 0) : pen;
} }
Polygon(const QImage &img)
: _brush(Qt::NoBrush), _pen(Qt::NoPen), _img(img.convertToFormat(
QImage::Format_ARGB32_Premultiplied)) {}
const QPen &pen() const {return _pen;} const QPen &pen() const {return _pen;}
const QBrush &brush() const {return _brush;} const QBrush &brush() const {return _brush;}
const QImage &img() const {return _img;}
private: private:
QBrush _brush; QBrush _brush;
QPen _pen; QPen _pen;
QImage _img;
}; };
class Line { class Line {