From 0ab6e02e6c246113ac80382431020ceab3faef97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 18 Dec 2024 12:41:05 +0100 Subject: [PATCH 01/21] RCTLPT areas and TSSLPT/RCTLPT points --- src/map/ENC/mapdata.cpp | 10 +++++++--- src/map/ENC/objects.h | 1 + src/map/ENC/rastertile.cpp | 32 ++++++++++++++++++++++++++++---- src/map/ENC/rastertile.h | 1 + 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index a850b6e5..66cf373f 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -285,7 +285,8 @@ MapData::Point::Point(uint type, const Coordinates &c, const QString &label, else _label += "\n(" + QString::fromLatin1(params.at(0)) + "\xE2\x80\x89m)"; - } + } else if ((type == TYPE(TSSLPT) || type == TYPE(RCTLPT)) && params.size()) + _param = QVariant(params.at(0).toDouble()); } MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, @@ -293,7 +294,7 @@ MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, { if (type == TYPE(DEPARE) && params.size()) _type = SUBTYPE(DEPARE, depthLevel(params.at(0))); - else if (type == TYPE(TSSLPT) && params.size()) + else if ((type == TYPE(TSSLPT) || type == TYPE(RCTLPT)) && params.size()) _param = QVariant(params.at(0).toDouble()); else if ((type == TYPE(BRIDGE) || type == TYPE(I_BRIDGE)) && params.size()) { @@ -595,7 +596,9 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL) || (OBJL == RDOCAL && key == ORIENT) || (OBJL == I_RDOCAL && key == ORIENT) || (OBJL == CURENT && key == ORIENT) - || (OBJL == LNDELV && key == ELEVAT)) + || (OBJL == LNDELV && key == ELEVAT) + || (OBJL == TSSLPT && key == ORIENT) + || (OBJL == RCTLPT && key == ORIENT)) params[0] = av.at(1).toByteArray(); if ((OBJL == I_RDOCAL && key == COMCHA) || (OBJL == RDOCAL && key == COMCHA) @@ -668,6 +671,7 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL) } if ((OBJL == TSSLPT && key == ORIENT) + || (OBJL == RCTLPT && key == ORIENT) || (OBJL == DEPARE && key == DRVAL1)) params[0] = av.at(1).toByteArray(); if ((OBJL == BRIDGE && key == VERCLR) diff --git a/src/map/ENC/objects.h b/src/map/ENC/objects.h index d1a5c413..652797c2 100644 --- a/src/map/ENC/objects.h +++ b/src/map/ENC/objects.h @@ -74,6 +74,7 @@ #define RAILWY 106 #define RCRTCL 108 #define RECTRC 109 +#define RCTLPT 110 #define RSCSTA 111 #define RESARE 112 #define RIVERS 114 diff --git a/src/map/ENC/rastertile.cpp b/src/map/ENC/rastertile.cpp index dcba0978..491072d5 100644 --- a/src/map/ENC/rastertile.cpp +++ b/src/map/ENC/rastertile.cpp @@ -150,19 +150,42 @@ QPolygonF RasterTile::tsslptArrow(const QPointF &p, qreal angle) const return polygon; } +static void drawArrow(QPainter *painter, const QPolygonF &polygon, uint type) +{ + if (type>>16 == RCTLPT) { + painter->setPen(QPen(tsslptPen, 1, Qt::DashLine)); + painter->setBrush(Qt::NoBrush); + } else { + painter->setPen(QPen(tsslptPen, 1)); + painter->setBrush(QBrush(tsslptBrush)); + } + painter->drawPolygon(polygon); +} + void RasterTile::drawArrows(QPainter *painter, const QList &polygons) { for (int i = 0; i < polygons.size(); i++) { const MapData::Poly &poly = polygons.at(i); - if (poly.type()>>16 == TSSLPT) { + if (poly.type()>>16 == TSSLPT || poly.type()>>16 == RCTLPT) { QPolygonF polygon(tsslptArrow(centroid(poly.path().first()), deg2rad(poly.param().toDouble()))); + drawArrow(painter, polygon, poly.type()); + } + } +} - painter->setPen(QPen(tsslptPen, 1)); - painter->setBrush(QBrush(tsslptBrush)); - painter->drawPolygon(polygon); +void RasterTile::drawArrows(QPainter *painter, + const QList &points) +{ + for (int i = 0; i < points.size(); i++) { + const MapData::Point &point = points.at(i); + + if (point.type()>>16 == TSSLPT || point.type()>>16 == RCTLPT) { + QPolygonF polygon(tsslptArrow(ll2xy(point.pos()), + deg2rad(point.param().toDouble()))); + drawArrow(painter, polygon, point.type()); } } } @@ -400,6 +423,7 @@ void RasterTile::render() drawPolygons(&painter, polygons); drawLines(&painter, lines); drawArrows(&painter, polygons); + drawArrows(&painter, points); drawTextItems(&painter, lights); drawTextItems(&painter, textItems); diff --git a/src/map/ENC/rastertile.h b/src/map/ENC/rastertile.h index 65333f54..e253646d 100644 --- a/src/map/ENC/rastertile.h +++ b/src/map/ENC/rastertile.h @@ -52,6 +52,7 @@ private: void drawBitmapPath(QPainter *painter, const QImage &img, const Polygon &polygon); void drawArrows(QPainter *painter, const QList &polygons); + void drawArrows(QPainter *painter, const QList &points); void drawPolygons(QPainter *painter, const QList &polygons); void drawLines(QPainter *painter, const QList &lines); void drawTextItems(QPainter *painter, const QList &textItems); From 67b91f62a0317a49174b0b8435a564d4a182ef6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 18 Dec 2024 13:58:49 +0100 Subject: [PATCH 02/21] Radar reflectors (RADRFL) --- gpxsee.qrc | 1 + icons/map/marine/radar-reflector.png | Bin 0 -> 236 bytes src/map/ENC/mapdata.cpp | 21 +++++++++++---------- src/map/ENC/objects.h | 1 + src/map/ENC/style.cpp | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 icons/map/marine/radar-reflector.png diff --git a/gpxsee.qrc b/gpxsee.qrc index 15b56a93..f5b3746f 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -206,6 +206,7 @@ icons/map/marine/kelp.png icons/map/marine/eddies.png icons/map/marine/dome.png + icons/map/marine/radar-reflector.png diff --git a/icons/map/marine/radar-reflector.png b/icons/map/marine/radar-reflector.png new file mode 100644 index 0000000000000000000000000000000000000000..69da1b2f4414ec6bdd477f2d98c9680365720201 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI z1_r((Aj~*bn@<`j*yHKq7-DfcIYEITu6o};e-B<^W>E&=O}$5MbouHEGcz+Eo;}07 zXVGm}$<9JMAGu}o8XFrK&s9wR(H5Gr??ir5Omhyy#dE4xcUOoCr(VcDfBn&sHcq1i z#ao?AmdF;x9BT1?`2YX^naCP{f$n1PboFyt=akR{05@AzCIA2c literal 0 HcmV?d00001 diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 66cf373f..2e41d2a8 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -63,16 +63,17 @@ static QMap orderMapInit() map.insert(TYPE(PILPNT), 34); map.insert(TYPE(ACHBRT), 35); map.insert(TYPE(I_ACHBRT), 35); - map.insert(TYPE(CRANES), 36); - map.insert(TYPE(I_CRANES), 36); - map.insert(TYPE(I_WTWGAG), 37); - map.insert(TYPE(PYLONS), 38); - map.insert(TYPE(SLCONS), 39); - map.insert(TYPE(LNDMRK), 40); - map.insert(TYPE(SILTNK), 41); - map.insert(TYPE(LNDELV), 42); - map.insert(TYPE(SMCFAC), 43); - map.insert(TYPE(BUISGL), 44); + map.insert(TYPE(RADRFL), 36); + map.insert(TYPE(CRANES), 37); + map.insert(TYPE(I_CRANES), 37); + map.insert(TYPE(I_WTWGAG), 38); + map.insert(TYPE(PYLONS), 39); + map.insert(TYPE(SLCONS), 40); + map.insert(TYPE(LNDMRK), 41); + map.insert(TYPE(SILTNK), 42); + map.insert(TYPE(LNDELV), 43); + map.insert(TYPE(SMCFAC), 44); + map.insert(TYPE(BUISGL), 45); map.insert(TYPE(I_DISMAR), 0xFFFFFFFE); map.insert(TYPE(SOUNDG), 0xFFFFFFFF); diff --git a/src/map/ENC/objects.h b/src/map/ENC/objects.h index 652797c2..580a5bf6 100644 --- a/src/map/ENC/objects.h +++ b/src/map/ENC/objects.h @@ -67,6 +67,7 @@ #define PONTON 95 #define PRCARE 96 #define PYLONS 98 +#define RADRFL 101 #define RADSTA 102 #define RTPBCN 103 #define RDOCAL 104 diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 1b009f14..82f36f34 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -335,6 +335,7 @@ void Style::pointStyle(qreal ratio) _points[SUBTYPE(WEDKLP, 0)] = Point(QImage(":/marine/kelp.png")); _points[SUBTYPE(WEDKLP, 1)] = Point(QImage(":/marine/kelp.png")); _points[TYPE(SEAARE)].setHaloColor(QColor()); + _points[TYPE(RADRFL)] = Point(QImage(":/marine/radar-reflector.png")); _points[SUBTYPE(SMCFAC, 7)] = Point(svg2img(":/POI/restaurant-11.svg", ratio), Small); From e0e9fa660a011162d8c57b6ebb83718cf6bf7124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 18 Dec 2024 17:45:25 +0100 Subject: [PATCH 03/21] BERTHS polygons + NAVLNE restyling --- src/map/ENC/mapdata.cpp | 3 ++- src/map/ENC/style.cpp | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 2e41d2a8..25f7673e 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -304,7 +304,8 @@ MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, _label = QString::fromUtf8("\xE2\x86\x95") + UNIT_SPACE + QString::number(clr) + UNIT_SPACE + hUnits(HUNI); } - } else if (type>>16 == LNDARE || type>>16 == SEAARE) + } else if (type>>16 == LNDARE || type>>16 == SEAARE || type>>16 == BERTHS + || type>>16 == I_BERTHS) _label = label; } diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 82f36f34..0fc49436 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -113,8 +113,9 @@ void Style::polygonStyle() _polygons[TYPE(CBLARE)] = Polygon(QImage(":/marine/cable-area-line.png")); _polygons[TYPE(PIPARE)] = Polygon(QImage(":/marine/pipeline-area-line.png")); _polygons[SUBTYPE(MARKUL, 3)] = Polygon(QImage(":/marine/fishing-farm-line.png")); - _polygons[SUBTYPE(I_BERTHS, 6)] = Polygon(Qt::NoBrush, - QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine)); + _polygons[TYPE(BERTHS)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), + 1, Qt::DashLine)); + _polygons[TYPE(I_BERTHS)] = _polygons[TYPE(BERTHS)]; _polygons[TYPE(CONZNE)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashDotLine)); @@ -129,13 +130,14 @@ void Style::polygonStyle() << TYPE(I_TERMNL) << TYPE(SLCONS) << TYPE(I_SLCONS) << TYPE(PONTON) << TYPE(I_PONTON) << TYPE(HULKES) << TYPE(I_HULKES) << TYPE(FLODOC) << TYPE(I_FLODOC) << TYPE(DRYDOC) << TYPE(DAMCON) << TYPE(PYLONS) - << TYPE(MORFAC) << TYPE(GATCON) << TYPE(I_GATCON) << SUBTYPE(I_BERTHS, 6) - << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(UWTROC) - << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) << SUBTYPE(I_ACHARE, 1) - << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) << SUBTYPE(I_RESARE, 2) - << SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) << SUBTYPE(RESARE, 12) - << SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) << TYPE(CBLARE) - << TYPE(PIPARE) << TYPE(PRCARE) << SUBTYPE(MARKUL, 3) << TYPE(CONZNE); + << TYPE(MORFAC) << TYPE(GATCON) << TYPE(I_GATCON) << TYPE(BERTHS) + << TYPE(I_BERTHS) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) + << TYPE(UWTROC) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) + << SUBTYPE(I_ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) + << SUBTYPE(I_RESARE, 2) << SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) + << SUBTYPE(RESARE, 12) << SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) + << TYPE(CBLARE) << TYPE(PIPARE) << TYPE(PRCARE) << SUBTYPE(MARKUL, 3) + << TYPE(CONZNE); } void Style::lineStyle(qreal ratio) @@ -152,7 +154,7 @@ void Style::lineStyle(qreal ratio) _lines[TYPE(CBLSUB)].setTextFontSize(Small); _lines[TYPE(PIPSOL)] = Line(QImage(":/marine/pipeline.png")); _lines[TYPE(PIPSOL)].setTextFontSize(Small); - _lines[TYPE(NAVLNE)] = Line(QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine)); + _lines[TYPE(NAVLNE)] = Line(QPen(QColor(0, 0, 0), 1, Qt::DashLine)); _lines[TYPE(COALNE)] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine)); _lines[TYPE(SLCONS)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine)); _lines[TYPE(I_SLCONS)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine)); From b7bb3b649a6021e91a02c837639e5b7dee35cdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 18 Dec 2024 18:48:50 +0100 Subject: [PATCH 04/21] BUAARE area labels --- src/map/ENC/mapdata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 25f7673e..cfa4f7b2 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -305,7 +305,7 @@ MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, + QString::number(clr) + UNIT_SPACE + hUnits(HUNI); } } else if (type>>16 == LNDARE || type>>16 == SEAARE || type>>16 == BERTHS - || type>>16 == I_BERTHS) + || type>>16 == I_BERTHS || type>>16 == BUAARE) _label = label; } From 4e466d16a112196fdbc68107c744c8782c0184fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 19 Dec 2024 09:50:39 +0100 Subject: [PATCH 05/21] Merged ENC point and areas labels --- src/map/ENC/mapdata.cpp | 15 +++++++ src/map/ENC/mapdata.h | 2 + src/map/ENC/rastertile.cpp | 81 -------------------------------------- src/map/ENC/rastertile.h | 3 -- src/map/ENC/style.cpp | 8 ++-- 5 files changed, 22 insertions(+), 87 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index cfa4f7b2..b7d5efcb 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -170,6 +170,14 @@ static bool polygonCb(const MapData::Poly *polygon, void *context) return true; } +static bool polygonPointCb(const MapData::Poly *polygon, void *context) +{ + QList *points = (QList*)context; + points->append(MapData::Point(polygon->type(), polygon->bounds().center(), + polygon->label(), polygon->param())); + return true; +} + static Coordinates coordinates(int x, int y, uint COMF) { return Coordinates(x / (double)COMF, y / (double)COMF); @@ -290,6 +298,12 @@ MapData::Point::Point(uint type, const Coordinates &c, const QString &label, _param = QVariant(params.at(0).toDouble()); } +MapData::Point::Point(uint type, const Coordinates &c, const QString &label, + const QVariant ¶m) : _type(type), _pos(c), _label(label), _param(param) +{ + _id = ((quint64)order(type))<<32 | (uint)qHash(c); +} + MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, const QVector ¶ms, uint HUNI) : _type(type), _path(path) { @@ -848,6 +862,7 @@ void MapData::points(const RectC &rect, QList *points) const rectcBounds(rect, min, max); _points.Search(min, max, pointCb, points); + _areas.Search(min, max, polygonPointCb, points); } void MapData::lines(const RectC &rect, QList *lines) const diff --git a/src/map/ENC/mapdata.h b/src/map/ENC/mapdata.h index f5f56174..9dc46d33 100644 --- a/src/map/ENC/mapdata.h +++ b/src/map/ENC/mapdata.h @@ -49,6 +49,8 @@ public: public: Point(uint type, const Coordinates &c, const QString &label, const QVector ¶ms); + Point(uint type, const Coordinates &c, const QString &label, + const QVariant ¶m); const Coordinates &pos() const {return _pos;} uint type() const {return _type;} diff --git a/src/map/ENC/rastertile.cpp b/src/map/ENC/rastertile.cpp index 491072d5..8d2ac9f2 100644 --- a/src/map/ENC/rastertile.cpp +++ b/src/map/ENC/rastertile.cpp @@ -40,31 +40,6 @@ static bool showLabel(const QImage *img, const Range &range, int zoom, int type) return true; } -QPointF RasterTile::centroid(const QVector &polygon) const -{ - Q_ASSERT(polygon.size() > 3); - Q_ASSERT(polygon.first() == polygon.last()); - - double area = 0; - double cx = 0, cy = 0; - QPointF pi; - QPointF pj(ll2xy(polygon.at(0))); - - for (int i = 0; i < polygon.size() - 1; i++) { - pi = pj; - pj = ll2xy(polygon.at(i + 1)); - - double f = pi.x() * pj.y() - pj.x() * pi.y(); - area += f; - cx += (pi.x() + pj.x()) * f; - cy += (pi.y() + pj.y()) * f; - } - - double factor = 1.0 / (3.0 * area); - - return QPointF(cx * factor, cy * factor); -} - QPainterPath RasterTile::painterPath(const Polygon &polygon) const { QPainterPath path; @@ -162,20 +137,6 @@ static void drawArrow(QPainter *painter, const QPolygonF &polygon, uint type) painter->drawPolygon(polygon); } -void RasterTile::drawArrows(QPainter *painter, - const QList &polygons) -{ - for (int i = 0; i < polygons.size(); i++) { - const MapData::Poly &poly = polygons.at(i); - - if (poly.type()>>16 == TSSLPT || poly.type()>>16 == RCTLPT) { - QPolygonF polygon(tsslptArrow(centroid(poly.path().first()), - deg2rad(poly.param().toDouble()))); - drawArrow(painter, polygon, poly.type()); - } - } -} - void RasterTile::drawArrows(QPainter *painter, const QList &points) { @@ -252,46 +213,6 @@ void RasterTile::drawTextItems(QPainter *painter, } } -void RasterTile::processPolygons(const QList &polygons, - QList &textItems) -{ - for (int i = 0; i < polygons.size(); i++) { - const MapData::Poly &poly = polygons.at(i); - uint type = poly.type()>>16; - const QImage *img = 0; - const QString *label = 0; - const QFont *fnt = 0; - const QColor *color = 0, *hColor = 0; - QPoint offset(0, 0); - - if (!poly.label().isEmpty()) { - const Style::Point &style = _style->point(poly.type()); - fnt = _style->font(style.textFontSize()); - color = &style.textColor(); - hColor = style.haloColor().isValid() ? &style.haloColor() : 0; - label = &poly.label(); - } - if (type == HRBFAC || type == I_TRNBSN - || poly.type() == SUBTYPE(I_BERTHS, 6)) { - const Style::Point &style = _style->point(poly.type()); - img = style.img().isNull() ? 0 : &style.img(); - offset = style.offset(); - } - - if ((!label || !fnt) && !img) - continue; - - TextPointItem *item = new TextPointItem(offset + - centroid(poly.path().first()).toPoint(), label, fnt, img, color, - hColor, 0, 0); - if (item->isValid() && _rect.contains(item->boundingRect().toRect()) - && !item->collides(textItems)) - textItems.append(item); - else - delete item; - } -} - void RasterTile::processPoints(QList &points, QList &textItems, QList &lights) { @@ -412,7 +333,6 @@ void RasterTile::render() fetchData(polygons, lines, points); processPoints(points, textItems, lights); - processPolygons(polygons, textItems); processLines(lines, textItems); QPainter painter(&img); @@ -422,7 +342,6 @@ void RasterTile::render() drawPolygons(&painter, polygons); drawLines(&painter, lines); - drawArrows(&painter, polygons); drawArrows(&painter, points); drawTextItems(&painter, lights); diff --git a/src/map/ENC/rastertile.h b/src/map/ENC/rastertile.h index e253646d..2d17a6dd 100644 --- a/src/map/ENC/rastertile.h +++ b/src/map/ENC/rastertile.h @@ -47,11 +47,8 @@ private: QList &textItems, QList &lights); void processLines(const QList &lines, QList &textItems); - void processPolygons(const QList &polygons, - QList &textItems); void drawBitmapPath(QPainter *painter, const QImage &img, const Polygon &polygon); - void drawArrows(QPainter *painter, const QList &polygons); void drawArrows(QPainter *painter, const QList &points); void drawPolygons(QPainter *painter, const QList &polygons); void drawLines(QPainter *painter, const QList &lines); diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 0fc49436..43ddd7d1 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -116,6 +116,7 @@ void Style::polygonStyle() _polygons[TYPE(BERTHS)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine)); _polygons[TYPE(I_BERTHS)] = _polygons[TYPE(BERTHS)]; + _polygons[SUBTYPE(I_BERTHS, 6)] = _polygons[TYPE(BERTHS)]; _polygons[TYPE(CONZNE)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashDotLine)); @@ -131,8 +132,8 @@ void Style::polygonStyle() << TYPE(I_PONTON) << TYPE(HULKES) << TYPE(I_HULKES) << TYPE(FLODOC) << TYPE(I_FLODOC) << TYPE(DRYDOC) << TYPE(DAMCON) << TYPE(PYLONS) << TYPE(MORFAC) << TYPE(GATCON) << TYPE(I_GATCON) << TYPE(BERTHS) - << TYPE(I_BERTHS) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) - << TYPE(UWTROC) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) + << TYPE(I_BERTHS) << SUBTYPE(I_BERTHS, 6) << TYPE(DMPGRD) << TYPE(TSEZNE) + << TYPE(OBSTRN) << TYPE(UWTROC) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) << SUBTYPE(I_ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) << SUBTYPE(I_RESARE, 2) << SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) << SUBTYPE(RESARE, 12) << SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) @@ -325,7 +326,8 @@ void Style::pointStyle(qreal ratio) _points[SUBTYPE(I_RDOCAL, 3)].setTextColor(QColor(0xeb, 0x49, 0xeb)); _points[SUBTYPE(I_RDOCAL, 4)].setTextColor(QColor(0xeb, 0x49, 0xeb)); _points[TYPE(PYLONS)] = Point(QImage(":/marine/pylon.png")); - _points[SUBTYPE(I_BERTHS, 6)] = Point(QImage(":/marine/fleeting-area.png")); + _points[SUBTYPE(I_BERTHS, 6)] = Point(QImage(":/marine/fleeting-area.png"), + Small); _points[SUBTYPE(WATTUR, 1)] = Point(QImage(":/marine/breakers.png")); _points[SUBTYPE(WATTUR, 2)] = Point(QImage(":/marine/eddies.png")); _points[SUBTYPE(WATTUR, 3)] = Point(QImage(":/marine/overfalls.png")); From d738555a6850bd634343e4f0c97786ba1334a9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 19 Dec 2024 11:18:53 +0100 Subject: [PATCH 06/21] Extended ACHARE areas --- src/map/ENC/style.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 43ddd7d1..351728d2 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -82,7 +82,27 @@ void Style::polygonStyle() _polygons[SUBTYPE(I_RESARE, 12)] = Polygon(QImage(":/marine/safety-zone-line.png")); _polygons[SUBTYPE(RESARE, 1)] = Polygon(QImage(":/marine/safety-zone-line.png")); _polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png")); - _polygons[SUBTYPE(I_ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png")); + _polygons[SUBTYPE(ACHARE, 2)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 3)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 4)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 5)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 6)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 7)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(ACHARE, 8)] = Polygon(Qt::NoBrush, + QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine)); + _polygons[SUBTYPE(ACHARE, 9)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(I_ACHARE, 1)] = _polygons[SUBTYPE(ACHARE, 1)]; + _polygons[SUBTYPE(I_ACHARE, 2)] = _polygons[SUBTYPE(ACHARE, 2)]; + _polygons[SUBTYPE(I_ACHARE, 3)] = _polygons[SUBTYPE(ACHARE, 3)]; + _polygons[SUBTYPE(I_ACHARE, 4)] = _polygons[SUBTYPE(ACHARE, 4)]; + _polygons[SUBTYPE(I_ACHARE, 5)] = _polygons[SUBTYPE(ACHARE, 5)]; + _polygons[SUBTYPE(I_ACHARE, 6)] = _polygons[SUBTYPE(ACHARE, 6)]; + _polygons[SUBTYPE(I_ACHARE, 7)] = _polygons[SUBTYPE(ACHARE, 7)]; + _polygons[SUBTYPE(I_ACHARE, 8)] = _polygons[SUBTYPE(ACHARE, 8)]; + _polygons[SUBTYPE(I_ACHARE, 9)] = _polygons[SUBTYPE(ACHARE, 9)]; + _polygons[SUBTYPE(I_ACHARE, 10)] = _polygons[SUBTYPE(I_ACHARE, 1)]; + _polygons[SUBTYPE(I_ACHARE, 11)] = _polygons[SUBTYPE(I_ACHARE, 1)]; + _polygons[SUBTYPE(I_ACHARE, 12)] = _polygons[SUBTYPE(I_ACHARE, 1)]; _polygons[TYPE(PRCARE)] = Polygon(QBrush(QColor(0xeb, 0x49, 0xeb), Qt::BDiagPattern)); _polygons[TYPE(DAMCON)] = Polygon(QBrush(QColor(0xd9, 0x8b, 0x21)), @@ -117,6 +137,8 @@ void Style::polygonStyle() 1, Qt::DashLine)); _polygons[TYPE(I_BERTHS)] = _polygons[TYPE(BERTHS)]; _polygons[SUBTYPE(I_BERTHS, 6)] = _polygons[TYPE(BERTHS)]; + _polygons[TYPE(I_TRNBSN)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), + 1, Qt::DashLine)); _polygons[TYPE(CONZNE)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashDotLine)); @@ -134,11 +156,17 @@ void Style::polygonStyle() << TYPE(MORFAC) << TYPE(GATCON) << TYPE(I_GATCON) << TYPE(BERTHS) << TYPE(I_BERTHS) << SUBTYPE(I_BERTHS, 6) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(UWTROC) << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) - << SUBTYPE(I_ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) - << SUBTYPE(I_RESARE, 2) << SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) - << SUBTYPE(RESARE, 12) << SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) - << TYPE(CBLARE) << TYPE(PIPARE) << TYPE(PRCARE) << SUBTYPE(MARKUL, 3) - << TYPE(CONZNE); + << SUBTYPE(ACHARE, 2) << SUBTYPE(ACHARE, 3) << SUBTYPE(ACHARE, 4) + << SUBTYPE(ACHARE, 5) << SUBTYPE(ACHARE, 6) << SUBTYPE(ACHARE, 7) + << SUBTYPE(ACHARE, 8) << SUBTYPE(ACHARE, 9) << SUBTYPE(I_ACHARE, 1) + << SUBTYPE(I_ACHARE, 2) << SUBTYPE(I_ACHARE, 3) << SUBTYPE(I_ACHARE, 4) + << SUBTYPE(I_ACHARE, 5) << SUBTYPE(I_ACHARE, 6) << SUBTYPE(I_ACHARE, 7) + << SUBTYPE(I_ACHARE, 8) << SUBTYPE(I_ACHARE, 9) << SUBTYPE(I_ACHARE, 10) + << SUBTYPE(I_ACHARE, 11) << SUBTYPE(I_ACHARE, 12) << SUBTYPE(RESARE, 9) + << SUBTYPE(RESARE, 2) << SUBTYPE(I_RESARE, 2) << SUBTYPE(RESARE, 17) + << SUBTYPE(I_RESARE, 17) << SUBTYPE(RESARE, 12) << SUBTYPE(I_RESARE, 12) + << SUBTYPE(RESARE, 1) << TYPE(CBLARE) << TYPE(PIPARE) << TYPE(PRCARE) + << TYPE(I_TRNBSN) << SUBTYPE(MARKUL, 3) << TYPE(CONZNE); } void Style::lineStyle(qreal ratio) From 816681f267083902ea327fd0e6512913d36b4b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 19 Dec 2024 11:35:43 +0100 Subject: [PATCH 07/21] Pillar LNDMRKs --- src/map/ENC/style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 351728d2..4c6814f2 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -266,6 +266,7 @@ void Style::pointStyle(qreal ratio) _points[SUBTYPE(LNDMRK, 7)] = Point(QImage(":/marine/pylon.png"), Small); _points[SUBTYPE(LNDMRK, 9)] = Point(QImage(":/marine/monument.png"), Small, QPoint(0, -7)); + _points[SUBTYPE(LNDMRK, 10)] = Point(QImage(":/marine/pylon.png"), Small); _points[SUBTYPE(LNDMRK, 15)] = Point(QImage(":/marine/dome.png"), Small, QPoint(0, -5)); _points[SUBTYPE(LNDMRK, 17)] = Point(QImage(":/marine/tower.png"), Small, From f2ae75d7f5e4e1bfc759663b5b26c3100b65febc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 19 Dec 2024 15:01:45 +0100 Subject: [PATCH 08/21] Do not duplicate BUISGL areas with points --- src/map/ENC/mapdata.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index b7d5efcb..d5c391a5 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -173,8 +173,9 @@ static bool polygonCb(const MapData::Poly *polygon, void *context) static bool polygonPointCb(const MapData::Poly *polygon, void *context) { QList *points = (QList*)context; - points->append(MapData::Point(polygon->type(), polygon->bounds().center(), - polygon->label(), polygon->param())); + if (!(polygon->type()>>16 == BUISGL && polygon->label().isEmpty())) + points->append(MapData::Point(polygon->type(), polygon->bounds().center(), + polygon->label(), polygon->param())); return true; } From a97dc3b6c28c64ff1ac3e5e8ab81a069585fa74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 20 Dec 2024 09:53:58 +0100 Subject: [PATCH 09/21] Do not duplicate PYLONS points/areas --- src/map/ENC/mapdata.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index d5c391a5..40f66e10 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -173,7 +173,8 @@ static bool polygonCb(const MapData::Poly *polygon, void *context) static bool polygonPointCb(const MapData::Poly *polygon, void *context) { QList *points = (QList*)context; - if (!(polygon->type()>>16 == BUISGL && polygon->label().isEmpty())) + if (!((polygon->type()>>16 == BUISGL && polygon->label().isEmpty()) + || polygon->type()>>16 == PYLONS)) points->append(MapData::Point(polygon->type(), polygon->bounds().center(), polygon->label(), polygon->param())); return true; From 001fa34cdd62354e218359254e63f3cafc91859d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 20 Dec 2024 14:41:23 +0100 Subject: [PATCH 10/21] Copy only explicitly defined polygon center points --- src/map/ENC/mapdata.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index 40f66e10..a0d2e63c 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -173,10 +173,13 @@ static bool polygonCb(const MapData::Poly *polygon, void *context) static bool polygonPointCb(const MapData::Poly *polygon, void *context) { QList *points = (QList*)context; - if (!((polygon->type()>>16 == BUISGL && polygon->label().isEmpty()) - || polygon->type()>>16 == PYLONS)) + uint baseType = polygon->type()>>16; + + if (!polygon->label().isEmpty() || baseType == TSSLPT || baseType == RCTLPT + || baseType == I_TRNBSN || polygon->type() == SUBTYPE(I_BERTHS, 6)) points->append(MapData::Point(polygon->type(), polygon->bounds().center(), polygon->label(), polygon->param())); + return true; } From eeee16ff9b2cce8f95ae388d367c649558a0e2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 20 Dec 2024 16:14:36 +0100 Subject: [PATCH 11/21] Special anchorage areas --- gpxsee.qrc | 3 +++ icons/map/marine/24h-anchorage.png | Bin 0 -> 348 bytes icons/map/marine/dw-anchorage.png | Bin 0 -> 296 bytes icons/map/marine/tanker-anchorage.png | Bin 0 -> 413 bytes src/map/ENC/mapdata.cpp | 9 ++++++++- src/map/ENC/style.cpp | 14 ++++++++++++-- 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 icons/map/marine/24h-anchorage.png create mode 100644 icons/map/marine/dw-anchorage.png create mode 100644 icons/map/marine/tanker-anchorage.png diff --git a/gpxsee.qrc b/gpxsee.qrc index f5b3746f..b75d8f19 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -207,6 +207,9 @@ icons/map/marine/eddies.png icons/map/marine/dome.png icons/map/marine/radar-reflector.png + icons/map/marine/24h-anchorage.png + icons/map/marine/dw-anchorage.png + icons/map/marine/tanker-anchorage.png diff --git a/icons/map/marine/24h-anchorage.png b/icons/map/marine/24h-anchorage.png new file mode 100644 index 0000000000000000000000000000000000000000..f2a840d388b4253246543f28946586580e48bded GIT binary patch literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-q!3HG#?#OKdQfx`y?k)`fL2$v|<&%LToCO|{ z#Xud`L734=V|E2l@Q6|N`}|s$BbBRTUo_jP$9W*?HC#nOKD{;R{LXJ?ssuSwpx@#e-=;#1^S z=-leq{o6xz+N%{N5r#Tc^Gr?QSI_&-0q^chtdt3!VbkQGb!+`L sA;HPj^}9p%G5wf%>HCHD_FVdQ&MBb@0Ja2`G5`Po literal 0 HcmV?d00001 diff --git a/icons/map/marine/dw-anchorage.png b/icons/map/marine/dw-anchorage.png new file mode 100644 index 0000000000000000000000000000000000000000..78c28e182c59ab77cd77ddfb4289efab8265b1d6 GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^GC<77!3HF4glkxU6kC$Fy9>jA5L~c#`DCC7XMsm# zF;K^K5N34Jm|X!BJmKl$7-DgH@05dl%?2E8jYnMdtxr0a^6#+|*&dr^#=HB*lFS9? ze4e^_{`}d%P|)NlFjavoJVG<2^OC6RidO|TH=Q>qcnhgS8m`%BS@bi|d;eEG$0`O7 zKU-$^d28lhu7 literal 0 HcmV?d00001 diff --git a/icons/map/marine/tanker-anchorage.png b/icons/map/marine/tanker-anchorage.png new file mode 100644 index 0000000000000000000000000000000000000000..a0baf59ffacb979927472ac3e20df8027d10f296 GIT binary patch literal 413 zcmV;O0b>4%P)2$rz*X4{IQ@`yu{$(4A5jOhR zVEFe5H}VqpVx>>*(NsaFtZr&UL^>_1&->`>`1`_+&!)`*m=)eS=c+s;00000NkvXX Hu0mjfFgCb! literal 0 HcmV?d00001 diff --git a/src/map/ENC/mapdata.cpp b/src/map/ENC/mapdata.cpp index a0d2e63c..79fd75f6 100644 --- a/src/map/ENC/mapdata.cpp +++ b/src/map/ENC/mapdata.cpp @@ -176,7 +176,14 @@ static bool polygonPointCb(const MapData::Poly *polygon, void *context) uint baseType = polygon->type()>>16; if (!polygon->label().isEmpty() || baseType == TSSLPT || baseType == RCTLPT - || baseType == I_TRNBSN || polygon->type() == SUBTYPE(I_BERTHS, 6)) + || baseType == I_TRNBSN + || polygon->type() == SUBTYPE(ACHARE, 2) + || polygon->type() == SUBTYPE(ACHARE, 3) + || polygon->type() == SUBTYPE(ACHARE, 9) + || polygon->type() == SUBTYPE(I_ACHARE, 2) + || polygon->type() == SUBTYPE(I_ACHARE, 3) + || polygon->type() == SUBTYPE(I_ACHARE, 9) + || polygon->type() == SUBTYPE(I_BERTHS, 6)) points->append(MapData::Point(polygon->type(), polygon->bounds().center(), polygon->label(), polygon->param())); diff --git a/src/map/ENC/style.cpp b/src/map/ENC/style.cpp index 4c6814f2..1f94eb2f 100644 --- a/src/map/ENC/style.cpp +++ b/src/map/ENC/style.cpp @@ -355,8 +355,6 @@ void Style::pointStyle(qreal ratio) _points[SUBTYPE(I_RDOCAL, 3)].setTextColor(QColor(0xeb, 0x49, 0xeb)); _points[SUBTYPE(I_RDOCAL, 4)].setTextColor(QColor(0xeb, 0x49, 0xeb)); _points[TYPE(PYLONS)] = Point(QImage(":/marine/pylon.png")); - _points[SUBTYPE(I_BERTHS, 6)] = Point(QImage(":/marine/fleeting-area.png"), - Small); _points[SUBTYPE(WATTUR, 1)] = Point(QImage(":/marine/breakers.png")); _points[SUBTYPE(WATTUR, 2)] = Point(QImage(":/marine/eddies.png")); _points[SUBTYPE(WATTUR, 3)] = Point(QImage(":/marine/overfalls.png")); @@ -370,6 +368,18 @@ void Style::pointStyle(qreal ratio) _points[TYPE(SEAARE)].setHaloColor(QColor()); _points[TYPE(RADRFL)] = Point(QImage(":/marine/radar-reflector.png")); + _points[SUBTYPE(I_BERTHS, 6)] = Point(QImage(":/marine/fleeting-area.png"), + Small); + _points[SUBTYPE(ACHARE, 2)] = Point(QImage(":/marine/dw-anchorage.png"), + Small); + _points[SUBTYPE(ACHARE, 3)] = Point(QImage(":/marine/tanker-anchorage.png"), + Small); + _points[SUBTYPE(ACHARE, 9)] = Point(QImage(":/marine/24h-anchorage.png"), + Small); + _points[SUBTYPE(I_ACHARE, 2)] = _points[SUBTYPE(ACHARE, 2)]; + _points[SUBTYPE(I_ACHARE, 3)] = _points[SUBTYPE(ACHARE, 3)]; + _points[SUBTYPE(I_ACHARE, 9)] = _points[SUBTYPE(ACHARE, 9)]; + _points[SUBTYPE(SMCFAC, 7)] = Point(svg2img(":/POI/restaurant-11.svg", ratio), Small); _points[SUBTYPE(SMCFAC, 11)] = Point(svg2img(":/POI/pharmacy-11.svg", From 699e086618db5b5af60b1ed81831ef8e4015ed29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 2 Jan 2025 08:08:33 +0100 Subject: [PATCH 12/21] AppVeyor Qt6 build fix --- .appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index de900cfe..72ade2ba 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,9 +12,11 @@ environment: - QTDIR: C:\Qt\5.15\msvc2019_64 OPENSSLDIR: C:\OpenSSL-v111-Win64\bin NSISDEF: /DOPENSSL /DANGLE + LRELEASE: lrelease - QTDIR: C:\Qt\6.8\msvc2019_64 OPENSSLDIR: C:\OpenSSL-v33-Win64\bin NSISDEF: /DQT6 /DOPENSSL + LRELEASE: lrelease-pro install: - cmd: |- @@ -23,7 +25,7 @@ install: build_script: - cmd: |- - lrelease gpxsee.pro + %LRELEASE% gpxsee.pro qmake gpxsee.pro nmake release From 701f392a29d2d8c4fc44781d583fad80fff9305b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 2 Jan 2025 18:55:15 +0100 Subject: [PATCH 13/21] Improved error reporting --- src/map/IMG/rastertile.cpp | 6 +++++- src/map/IMG/subfile.h | 4 +++- src/map/aqmmap.cpp | 4 +++- src/map/conversion.cpp | 3 +-- src/map/ellipsoid.cpp | 3 +-- src/map/gcs.cpp | 3 +-- src/map/gemfmap.cpp | 4 +++- src/map/jnxmap.cpp | 5 ++++- src/map/mapsforge/mapdata.cpp | 6 +++++- src/map/mapsforge/rastertile.cpp | 5 ++++- src/map/pcs.cpp | 3 +-- src/map/qctmap.cpp | 4 +++- src/map/rmap.cpp | 4 +++- 13 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index dd4c5b20..5476f880 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -445,7 +445,11 @@ void RasterTile::fetchData(QList &polygons, if (dynamic_cast(_data)) { _file = new QFile(_data->fileName()); - _file->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { + qWarning("%s: %s", qPrintable(_file->fileName()), + qPrintable(_file->errorString())); + return; + } } QRectF polyRect(ttl, QPointF(ttl.x() + _rect.width(), ttl.y() diff --git a/src/map/IMG/subfile.h b/src/map/IMG/subfile.h index 8d76396a..762a6ecc 100644 --- a/src/map/IMG/subfile.h +++ b/src/map/IMG/subfile.h @@ -26,7 +26,9 @@ public: if (!_file) { _file = new QFile(subFile->fileName()); - _file->open(QIODevice::ReadOnly | QIODevice::Unbuffered); + if (!_file->open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + qWarning("%s: %s", qPrintable(_file->fileName()), + qPrintable(_file->errorString())); _delete = true; } _data.resize(subFile->blockSize()); diff --git a/src/map/aqmmap.cpp b/src/map/aqmmap.cpp index bc00b658..e2052923 100644 --- a/src/map/aqmmap.cpp +++ b/src/map/aqmmap.cpp @@ -258,7 +258,9 @@ void AQMMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void AQMMap::unload() diff --git a/src/map/conversion.cpp b/src/map/conversion.cpp index c09bc643..5e441531 100644 --- a/src/map/conversion.cpp +++ b/src/map/conversion.cpp @@ -141,8 +141,7 @@ bool Conversion::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening projections file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/ellipsoid.cpp b/src/map/ellipsoid.cpp index 97c30e4f..b5fa7c77 100644 --- a/src/map/ellipsoid.cpp +++ b/src/map/ellipsoid.cpp @@ -38,8 +38,7 @@ bool Ellipsoid::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening ellipsoids file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/gcs.cpp b/src/map/gcs.cpp index 2aef8dcd..6593c4bc 100644 --- a/src/map/gcs.cpp +++ b/src/map/gcs.cpp @@ -102,8 +102,7 @@ bool GCS::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening GCS file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/gemfmap.cpp b/src/map/gemfmap.cpp index 91797df3..1ad68d0b 100644 --- a/src/map/gemfmap.cpp +++ b/src/map/gemfmap.cpp @@ -189,7 +189,9 @@ void GEMFMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void GEMFMap::unload() diff --git a/src/map/jnxmap.cpp b/src/map/jnxmap.cpp index 6cc72d70..bfad6f50 100644 --- a/src/map/jnxmap.cpp +++ b/src/map/jnxmap.cpp @@ -162,7 +162,10 @@ void JNXMap::load(const Projection &in, const Projection &out, _projection = in; _mapRatio = hidpi ? deviceRatio : 1.0; - if (_file.open(QIODevice::ReadOnly)) + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); + else readTiles(); } diff --git a/src/map/mapsforge/mapdata.cpp b/src/map/mapsforge/mapdata.cpp index 63e6ceb2..bae0e91a 100644 --- a/src/map/mapsforge/mapdata.cpp +++ b/src/map/mapsforge/mapdata.cpp @@ -459,7 +459,11 @@ RectC MapData::bounds() const void MapData::load() { QFile file(_fileName); - if (file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + + if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + qWarning("%s: %s", qPrintable(file.fileName()), + qPrintable(file.errorString())); + else readSubFiles(file); } diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 3aba51c8..ee42efa9 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -410,8 +410,11 @@ void RasterTile::fetchData(QList &paths, QPoint ttl(_rect.topLeft()); QFile file(_data->fileName()); - if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) + if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { + qWarning("%s: %s", qPrintable(file.fileName()), + qPrintable(file.errorString())); return; + } QRectF pathRect(QPointF(ttl.x() - PATHS_EXTENT, ttl.y() - PATHS_EXTENT), QPointF(ttl.x() + _rect.width() + PATHS_EXTENT, ttl.y() + _rect.height() diff --git a/src/map/pcs.cpp b/src/map/pcs.cpp index c72c1dc5..bebe36ce 100644 --- a/src/map/pcs.cpp +++ b/src/map/pcs.cpp @@ -31,8 +31,7 @@ bool PCS::loadList(const QString &path) bool res; if (!file.open(QFile::ReadOnly)) { - qWarning("Error opening PCS file: %s: %s", qPrintable(path), - qPrintable(file.errorString())); + qWarning("%s: %s", qPrintable(path), qPrintable(file.errorString())); return false; } diff --git a/src/map/qctmap.cpp b/src/map/qctmap.cpp index 6d05ef24..4373b1be 100644 --- a/src/map/qctmap.cpp +++ b/src/map/qctmap.cpp @@ -361,7 +361,9 @@ void QCTMap::load(const Projection &in, const Projection &out, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void QCTMap::unload() diff --git a/src/map/rmap.cpp b/src/map/rmap.cpp index b107221c..ef1ac79f 100644 --- a/src/map/rmap.cpp +++ b/src/map/rmap.cpp @@ -365,7 +365,9 @@ void RMap::load(const Projection &in, const Projection &out, qreal deviceRatio, Q_UNUSED(out); _mapRatio = hidpi ? deviceRatio : 1.0; - _file.open(QIODevice::ReadOnly); + if (!_file.open(QIODevice::ReadOnly)) + qWarning("%s: %s", qPrintable(_file.fileName()), + qPrintable(_file.errorString())); } void RMap::unload() From 25fb9e5f9be7aebf91972e72cc2815e7d2b6e28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 00:43:11 +0100 Subject: [PATCH 14/21] Revert "AppVeyor Qt6 build fix" This reverts commit 699e086618db5b5af60b1ed81831ef8e4015ed29. --- .appveyor.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 72ade2ba..de900cfe 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,11 +12,9 @@ environment: - QTDIR: C:\Qt\5.15\msvc2019_64 OPENSSLDIR: C:\OpenSSL-v111-Win64\bin NSISDEF: /DOPENSSL /DANGLE - LRELEASE: lrelease - QTDIR: C:\Qt\6.8\msvc2019_64 OPENSSLDIR: C:\OpenSSL-v33-Win64\bin NSISDEF: /DQT6 /DOPENSSL - LRELEASE: lrelease-pro install: - cmd: |- @@ -25,7 +23,7 @@ install: build_script: - cmd: |- - %LRELEASE% gpxsee.pro + lrelease gpxsee.pro qmake gpxsee.pro nmake release From 1219801910ec646f23e0126dc833780be63699af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 07:18:56 +0100 Subject: [PATCH 15/21] Try msvc2022_64 path --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index de900cfe..e7b0aa17 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,7 +12,7 @@ environment: - QTDIR: C:\Qt\5.15\msvc2019_64 OPENSSLDIR: C:\OpenSSL-v111-Win64\bin NSISDEF: /DOPENSSL /DANGLE - - QTDIR: C:\Qt\6.8\msvc2019_64 + - QTDIR: C:\Qt\6.8\msvc2022_64 OPENSSLDIR: C:\OpenSSL-v33-Win64\bin NSISDEF: /DQT6 /DOPENSSL From 2a925b0c84f233a98ada49f8aa3ab4e534cb1b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 09:19:33 +0100 Subject: [PATCH 16/21] Do not include the unused OpenSSL libs on Qt6 --- .appveyor.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e7b0aa17..795173ae 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -13,8 +13,7 @@ environment: OPENSSLDIR: C:\OpenSSL-v111-Win64\bin NSISDEF: /DOPENSSL /DANGLE - QTDIR: C:\Qt\6.8\msvc2022_64 - OPENSSLDIR: C:\OpenSSL-v33-Win64\bin - NSISDEF: /DQT6 /DOPENSSL + NSISDEF: /DQT6 install: - cmd: |- @@ -36,8 +35,10 @@ build_script: xcopy lang\*.qm installer\translations\ /sy xcopy icons\symbols installer\symbols /i copy licence.txt installer - copy %OPENSSLDIR%\libcrypto-*-x64.dll installer - copy %OPENSSLDIR%\libssl-*-x64.dll installer + IF EXISTS OPENSSLDIR ( + copy %OPENSSLDIR%\libcrypto-*-x64.dll installer + copy %OPENSSLDIR%\libssl-*-x64.dll installer + ) makensis.exe %NSISDEF% installer\gpxsee64.nsi From 871cb8433c1f8103a008959b97292923ef37611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 09:39:45 +0100 Subject: [PATCH 17/21] Fixed syntax --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 795173ae..587c69bd 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -35,7 +35,7 @@ build_script: xcopy lang\*.qm installer\translations\ /sy xcopy icons\symbols installer\symbols /i copy licence.txt installer - IF EXISTS OPENSSLDIR ( + IF DEFINED OPENSSLDIR ( copy %OPENSSLDIR%\libcrypto-*-x64.dll installer copy %OPENSSLDIR%\libssl-*-x64.dll installer ) From 7ee681313fc01014abbbbfba920458289dc1af50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 10:02:01 +0100 Subject: [PATCH 18/21] Fixed YAML/CMD syntax --- .appveyor.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 587c69bd..0447e3b5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -35,10 +35,8 @@ build_script: xcopy lang\*.qm installer\translations\ /sy xcopy icons\symbols installer\symbols /i copy licence.txt installer - IF DEFINED OPENSSLDIR ( - copy %OPENSSLDIR%\libcrypto-*-x64.dll installer - copy %OPENSSLDIR%\libssl-*-x64.dll installer - ) + IF DEFINED OPENSSLDIR (copy %OPENSSLDIR%\libcrypto-*-x64.dll installer) + IF DEFINED OPENSSLDIR (copy %OPENSSLDIR%\libssl-*-x64.dll installer) makensis.exe %NSISDEF% installer\gpxsee64.nsi From 7a161fa364991a489807efa45448e3e571aeb474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 19:17:30 +0100 Subject: [PATCH 19/21] Improved error handling --- src/map/IMG/demfile.h | 2 +- src/map/IMG/gmapdata.cpp | 21 +++++++++----------- src/map/IMG/gmapdata.h | 6 ++---- src/map/IMG/imgdata.cpp | 3 +-- src/map/IMG/lblfile.h | 2 +- src/map/IMG/mapdata.cpp | 8 ++++---- src/map/IMG/netfile.h | 2 +- src/map/IMG/nodfile.h | 2 +- src/map/IMG/rastertile.cpp | 2 +- src/map/IMG/rgnfile.h | 2 +- src/map/IMG/style.cpp | 8 ++++---- src/map/IMG/style.h | 4 ++-- src/map/IMG/subfile.h | 15 ++++++++++----- src/map/IMG/trefile.cpp | 4 ++-- src/map/IMG/trefile.h | 2 +- src/map/IMG/vectortile.cpp | 39 ++++++++++++++++++++------------------ src/map/IMG/vectortile.h | 16 ++++++++++++++-- 17 files changed, 76 insertions(+), 62 deletions(-) diff --git a/src/map/IMG/demfile.h b/src/map/IMG/demfile.h index 7d4cb617..dce210b9 100644 --- a/src/map/IMG/demfile.h +++ b/src/map/IMG/demfile.h @@ -11,7 +11,7 @@ class DEMFile : public SubFile { public: DEMFile(const IMGData *img) : SubFile(img) {} - DEMFile(const QString *path) : SubFile(path) {} + DEMFile(const QString &path) : SubFile(path) {} DEMFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset) {} bool load(Handle &hdl); diff --git a/src/map/IMG/gmapdata.cpp b/src/map/IMG/gmapdata.cpp index 1e15c1e2..f5239dd7 100644 --- a/src/map/IMG/gmapdata.cpp +++ b/src/map/IMG/gmapdata.cpp @@ -87,12 +87,16 @@ bool GMAPData::loadTile(const QDir &dir) const QFileInfo &fi = ml.at(i); SubFile::Type tt = tileType(fi.suffix()); if (VectorTile::isTileFile(tt)) { - _files.append(new QString(fi.absoluteFilePath())); - tile->addFile(_files.last(), tt); + if (!tile->addFile(fi.absoluteFilePath(), tt)) { + qWarning("%s: Invalid map tile structure", + qPrintable(dir.path())); + delete tile; + return false; + } } } - if (!tile->init(0)) { + if (!tile->init()) { qWarning("%s: Invalid map tile", qPrintable(dir.path())); delete tile; return false; @@ -131,10 +135,8 @@ GMAPData::GMAPData(const QString &fileName) : MapData(fileName) loadTile(QDir(fi.absoluteFilePath())); } - if (baseDir.exists(typFilePath)) { - _files.append(new QString(baseDir.filePath(typFilePath))); - _typ = new SubFile(_files.last()); - } + if (baseDir.exists(typFilePath)) + _typ = new SubFile(baseDir.filePath(typFilePath)); if (!_tileTree.Count()) _errorString = "No usable map tile found"; @@ -143,8 +145,3 @@ GMAPData::GMAPData(const QString &fileName) : MapData(fileName) computeZooms(); } - -GMAPData::~GMAPData() -{ - qDeleteAll(_files); -} diff --git a/src/map/IMG/gmapdata.h b/src/map/IMG/gmapdata.h index aff4596c..b7ae17a9 100644 --- a/src/map/IMG/gmapdata.h +++ b/src/map/IMG/gmapdata.h @@ -12,15 +12,13 @@ class GMAPData : public MapData { public: GMAPData(const QString &fileName); - ~GMAPData(); private: bool readXML(const QString &path, QString &dataDir, QString &typFile); - void mapProduct(QXmlStreamReader &reader, QString &dataDir, QString &typFile); + void mapProduct(QXmlStreamReader &reader, QString &dataDir, + QString &typFile); void subProduct(QXmlStreamReader &reader, QString &dataDir); bool loadTile(const QDir &dir); - - QList _files; }; } diff --git a/src/map/IMG/imgdata.cpp b/src/map/IMG/imgdata.cpp index 41ea1a4e..a14cebad 100644 --- a/src/map/IMG/imgdata.cpp +++ b/src/map/IMG/imgdata.cpp @@ -117,8 +117,7 @@ bool IMGData::readFAT(QFile *file, TileMap &tileMap) } else tile = *it; - SubFile *subFile = part ? tile->file(tt) - : tile->addFile(this, tt); + SubFile *subFile = part ? tile->file(tt) : tile->addFile(this, tt); if (!(subFile && readSubFileBlocks(file, offset, subFile))) return false; } else if (tt == SubFile::TYP) { diff --git a/src/map/IMG/lblfile.h b/src/map/IMG/lblfile.h index 5f866732..0ee5b6d3 100644 --- a/src/map/IMG/lblfile.h +++ b/src/map/IMG/lblfile.h @@ -18,7 +18,7 @@ public: LBLFile(const IMGData *img) : SubFile(img), _huffmanText(0), _imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {} - LBLFile(const QString *path) + LBLFile(const QString &path) : SubFile(path), _huffmanText(0), _imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {} LBLFile(const SubFile *gmp, quint32 offset) diff --git a/src/map/IMG/mapdata.cpp b/src/map/IMG/mapdata.cpp index 68c031a5..aa412c94 100644 --- a/src/map/IMG/mapdata.cpp +++ b/src/map/IMG/mapdata.cpp @@ -99,14 +99,14 @@ void MapData::load(qreal ratio) Q_ASSERT(!_style); if (_typ) - _style = new Style(0, ratio, _typ); + _style = new Style(ratio, _typ); else { QString typFile(ProgramPaths::typFile()); if (QFileInfo::exists(typFile)) { - SubFile typ(&typFile); - _style = new Style(0, ratio, &typ); + SubFile typ(typFile); + _style = new Style(ratio, &typ); } else - _style = new Style(0, ratio); + _style = new Style(ratio); } } diff --git a/src/map/IMG/netfile.h b/src/map/IMG/netfile.h index bf63a0de..7f0c191a 100644 --- a/src/map/IMG/netfile.h +++ b/src/map/IMG/netfile.h @@ -18,7 +18,7 @@ class NETFile : public SubFile public: NETFile(const IMGData *img) : SubFile(img), _huffmanTable(0), _tp(0), _netShift(0), _linksShift(0) {} - NETFile(const QString *path) + NETFile(const QString &path) : SubFile(path), _huffmanTable(0), _tp(0), _netShift(0), _linksShift(0) {} NETFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _huffmanTable(0), _tp(0), _netShift(0), diff --git a/src/map/IMG/nodfile.h b/src/map/IMG/nodfile.h index 227b3223..dcdf8b53 100644 --- a/src/map/IMG/nodfile.h +++ b/src/map/IMG/nodfile.h @@ -62,7 +62,7 @@ public: NODFile(const IMGData *img) : SubFile(img), _indexFlags(0), _indexRecordSize(0), _blockRecordSize(0), _blockShift(0), _nodeShift(0), _indexIdSize(0) {} - NODFile(const QString *path) + NODFile(const QString &path) : SubFile(path), _indexFlags(0), _indexRecordSize(0), _blockRecordSize(0), _blockShift(0), _nodeShift(0), _indexIdSize(0) {} NODFile(const SubFile *gmp, quint32 offset) diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index 5476f880..9fa0ab41 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -152,7 +152,7 @@ void RasterTile::drawPolygons(QPainter *painter, bool insert = false; SubFile::Handle *hdl = hc.object(poly.raster.lbl()); if (!hdl) { - hdl = new SubFile::Handle(_file, poly.raster.lbl()); + hdl = new SubFile::Handle(poly.raster.lbl(), _file); insert = true; } QPixmap pm(poly.raster.lbl()->image(*hdl, poly.raster.id())); diff --git a/src/map/IMG/rgnfile.h b/src/map/IMG/rgnfile.h index 7b574e93..7040250c 100644 --- a/src/map/IMG/rgnfile.h +++ b/src/map/IMG/rgnfile.h @@ -24,7 +24,7 @@ public: }; RGNFile(const IMGData *img) : SubFile(img), _huffmanTable(0) {} - RGNFile(const QString *path) : SubFile(path), _huffmanTable(0) {} + RGNFile(const QString &path) : SubFile(path), _huffmanTable(0) {} RGNFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _huffmanTable(0) {} ~RGNFile(); diff --git a/src/map/IMG/style.cpp b/src/map/IMG/style.cpp index 6e56e81a..02a19acd 100644 --- a/src/map/IMG/style.cpp +++ b/src/map/IMG/style.cpp @@ -1268,9 +1268,9 @@ bool Style::parseDrawOrder(SubFile *file, SubFile::Handle &hdl, return true; } -bool Style::parseTYPFile(QFile *file, SubFile *typ) +bool Style::parseTYPFile(SubFile *typ) { - SubFile::Handle hdl(file, typ); + SubFile::Handle hdl(typ); Section points, lines, polygons, order; quint16 tmp16, codepage; @@ -1311,7 +1311,7 @@ bool Style::parseTYPFile(QFile *file, SubFile *typ) return true; } -Style::Style(QFile *file, qreal ratio, SubFile *typ) +Style::Style(qreal ratio, SubFile *typ) { _large = pixelSizeFont(16); _normal = pixelSizeFont(14); @@ -1326,7 +1326,7 @@ Style::Style(QFile *file, qreal ratio, SubFile *typ) defaultPointStyle(ratio); if (typ) - parseTYPFile(file, typ); + parseTYPFile(typ); } const Style::Line &Style::line(quint32 type) const diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index 1374083c..d08c70c1 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -104,7 +104,7 @@ public: }; - Style(QFile *file, qreal ratio, SubFile *typ = 0); + Style(qreal ratio, SubFile *typ = 0); const Line &line(quint32 type) const; const Polygon &polygon(quint32 type) const; @@ -171,7 +171,7 @@ private: bool extended; }; - bool parseTYPFile(QFile *file, SubFile *typ); + bool parseTYPFile(SubFile *typ); bool parsePoints(SubFile *file, SubFile::Handle &hdl, const Section §ion); bool parsePoint(SubFile *file, SubFile::Handle &hdl, diff --git a/src/map/IMG/subfile.h b/src/map/IMG/subfile.h index 762a6ecc..ea868492 100644 --- a/src/map/IMG/subfile.h +++ b/src/map/IMG/subfile.h @@ -18,7 +18,7 @@ public: class Handle { public: - Handle(QFile *file, const SubFile *subFile) + Handle(const SubFile *subFile, QFile *file = 0) : _file(file), _blockNum(-1), _blockPos(-1), _pos(-1), _delete(false) { if (!subFile) @@ -53,13 +53,18 @@ public: SubFile(const IMGData *img) : _gmpOffset(0), _img(img), _blocks(new QVector()), _path(0) {} SubFile(const SubFile *gmp, quint32 offset) : _gmpOffset(offset), - _img(gmp->_img), _blocks(gmp->_blocks), _path(gmp->_path) {} - SubFile(const QString *path) - : _gmpOffset(0), _img(0), _blocks(0), _path(path) {} + _img(gmp->_img), _blocks(gmp->_blocks), _path(gmp->_path) + { + Q_ASSERT(offset); + } + SubFile(const QString &path) + : _gmpOffset(0), _img(0), _blocks(0), _path(new QString(path)) {} ~SubFile() { - if (!_gmpOffset) + if (!_gmpOffset) { delete _blocks; + delete _path; + } } void addBlock(quint16 block) {_blocks->append(block);} diff --git a/src/map/IMG/trefile.cpp b/src/map/IMG/trefile.cpp index 959a6545..6b736f16 100644 --- a/src/map/IMG/trefile.cpp +++ b/src/map/IMG/trefile.cpp @@ -51,7 +51,7 @@ TREFile::~TREFile() bool TREFile::init(QFile *file) { - Handle hdl(file, this); + Handle hdl(this, file); quint8 locked, levels[64]; quint16 hdrLen; qint32 north, east, south, west; @@ -156,7 +156,7 @@ int TREFile::readExtEntry(Handle &hdl, quint32 &polygons, quint32 &lines, bool TREFile::load(QFile *file, int idx) { - Handle hdl(file, this); + Handle hdl(this, file); QList sl; SubDiv *s = 0; SubDivTree *tree = new SubDivTree(); diff --git a/src/map/IMG/trefile.h b/src/map/IMG/trefile.h index c309f365..58e235c0 100644 --- a/src/map/IMG/trefile.h +++ b/src/map/IMG/trefile.h @@ -18,7 +18,7 @@ class TREFile : public SubFile public: TREFile(const IMGData *img) : SubFile(img), _flags(0), _extItemSize(0) {} - TREFile(const QString *path) + TREFile(const QString &path) : SubFile(path), _flags(0), _extItemSize(0) {} TREFile(const SubFile *gmp, quint32 offset) : SubFile(gmp, offset), _flags(0), _extItemSize(0) {} diff --git a/src/map/IMG/vectortile.cpp b/src/map/IMG/vectortile.cpp index 18682338..d46dbd41 100644 --- a/src/map/IMG/vectortile.cpp +++ b/src/map/IMG/vectortile.cpp @@ -53,9 +53,12 @@ bool VectorTile::init(QFile *file) bool VectorTile::initGMP(QFile *file) { - SubFile::Handle hdl(file, _gmp); + SubFile::Handle hdl(_gmp, file); quint32 tre, rgn, lbl, net, nod, dem; + if (_tre || _rgn || _lbl || _net || _nod || _dem) + return false; + if (!(_gmp->seek(hdl, 0x19) && _gmp->readUInt32(hdl, tre) && _gmp->readUInt32(hdl, rgn) && _gmp->readUInt32(hdl, lbl) && _gmp->readUInt32(hdl, net) && _gmp->readUInt32(hdl, nod) @@ -133,10 +136,10 @@ void VectorTile::polys(QFile *file, const RectC &rect, const Zoom &zoom, } if (!_loaded) { - rgnHdl = new SubFile::Handle(file, _rgn); - lblHdl = new SubFile::Handle(file, _lbl); - netHdl = new SubFile::Handle(file, _net); - nodHdl = new SubFile::Handle(file, _nod); + rgnHdl = new SubFile::Handle(_rgn, file); + lblHdl = new SubFile::Handle(_lbl, file); + netHdl = new SubFile::Handle(_net, file); + nodHdl = new SubFile::Handle(_nod, file); if (!load(*rgnHdl, *lblHdl, *netHdl, *nodHdl)) { _lock.unlock(); @@ -159,9 +162,9 @@ void VectorTile::polys(QFile *file, const RectC &rect, const Zoom &zoom, quint32 shift = _tre->shift(subdiv->bits()); if (!rgnHdl) { - rgnHdl = new SubFile::Handle(file, _rgn); - lblHdl = new SubFile::Handle(file, _lbl); - netHdl = new SubFile::Handle(file, _net); + rgnHdl = new SubFile::Handle(_rgn, file); + lblHdl = new SubFile::Handle(_lbl, file); + netHdl = new SubFile::Handle(_net, file); } if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv)) { @@ -182,9 +185,9 @@ void VectorTile::polys(QFile *file, const RectC &rect, const Zoom &zoom, if (_net && _net->hasLinks()) { if (!nodHdl) - nodHdl = new SubFile::Handle(file, _nod); + nodHdl = new SubFile::Handle(_nod, file); if (!nodHdl2) - nodHdl2 = new SubFile::Handle(file, _nod); + nodHdl2 = new SubFile::Handle(_nod, file); _rgn->links(*rgnHdl, subdiv, shift, _net, *netHdl, _nod, *nodHdl, *nodHdl2, _lbl, *lblHdl, &polys->lines); } @@ -221,10 +224,10 @@ void VectorTile::points(QFile *file, const RectC &rect, const Zoom &zoom, } if (!_loaded) { - rgnHdl = new SubFile::Handle(file, _rgn); - lblHdl = new SubFile::Handle(file, _lbl); - SubFile::Handle nodHdl(file, _nod); - SubFile::Handle netHdl(file, _net); + rgnHdl = new SubFile::Handle(_rgn, file); + lblHdl = new SubFile::Handle(_lbl, file); + SubFile::Handle nodHdl(_nod, file); + SubFile::Handle netHdl(_net, file); if (!load(*rgnHdl, *lblHdl, netHdl, nodHdl)) { _lock.unlock(); @@ -245,8 +248,8 @@ void VectorTile::points(QFile *file, const RectC &rect, const Zoom &zoom, cacheLock->unlock(); if (!rgnHdl) { - rgnHdl = new SubFile::Handle(file, _rgn); - lblHdl = new SubFile::Handle(file, _lbl); + rgnHdl = new SubFile::Handle(_rgn, file); + lblHdl = new SubFile::Handle(_lbl, file); } if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv)) { @@ -290,7 +293,7 @@ void VectorTile::elevations(QFile *file, const RectC &rect, const Zoom &zoom, } if (!_demLoaded) { - hdl = new SubFile::Handle(file, _dem); + hdl = new SubFile::Handle(_dem, file); if (!loadDem(*hdl)) { _demLock.unlock(); @@ -315,7 +318,7 @@ void VectorTile::elevations(QFile *file, const RectC &rect, const Zoom &zoom, cacheLock->unlock(); if (!hdl) - hdl = new SubFile::Handle(file, _dem); + hdl = new SubFile::Handle(_dem, file); el = _dem->elevations(*hdl, level, tile); if (!el->m.isNull()) diff --git a/src/map/IMG/vectortile.h b/src/map/IMG/vectortile.h index a4e8bc3b..10184d6f 100644 --- a/src/map/IMG/vectortile.h +++ b/src/map/IMG/vectortile.h @@ -21,7 +21,7 @@ public: delete _dem; delete _gmp; } - bool init(QFile *file); + bool init(QFile *file = 0); void clear(); const RectC &bounds() const {return _tre->bounds();} @@ -49,25 +49,37 @@ public: } template - SubFile *addFile(T *container, SubFile::Type type) + SubFile *addFile(T container, SubFile::Type type) { switch (type) { case SubFile::TRE: + if (_tre) + return 0; _tre = new TREFile(container); return _tre; case SubFile::RGN: + if (_rgn) + return 0; _rgn = new RGNFile(container); return _rgn; case SubFile::LBL: + if (_lbl) + return 0; _lbl = new LBLFile(container); return _lbl; case SubFile::NET: + if (_net) + return 0; _net = new NETFile(container); return _net; case SubFile::NOD: + if (_nod) + return 0; _nod = new NODFile(container); return _nod; case SubFile::DEM: + if (_dem) + return 0; _dem = new DEMFile(container); return _dem; case SubFile::GMP: From 5ff99b13a25cd2b900c03a4cf52070fad6df94a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 19:21:51 +0100 Subject: [PATCH 20/21] Copyright year++ --- gpxsee.pro | 2 +- pkg/windows/gpxsee64.nsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gpxsee.pro b/gpxsee.pro index 43ae4f93..c4bfd6d3 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -523,7 +523,7 @@ win32 { RESOURCES += theme-color.qrc QMAKE_TARGET_DESCRIPTION = GPXSee - QMAKE_TARGET_COPYRIGHT = Copyright (c) 2015-2024 Martin Tuma + QMAKE_TARGET_COPYRIGHT = Copyright (c) 2015-2025 Martin Tuma RC_ICONS = icons/app/gpxsee.ico \ icons/formats/gpx.ico \ icons/formats/tcx.ico \ diff --git a/pkg/windows/gpxsee64.nsi b/pkg/windows/gpxsee64.nsi index 98c669a9..494559e6 100644 --- a/pkg/windows/gpxsee64.nsi +++ b/pkg/windows/gpxsee64.nsi @@ -58,7 +58,7 @@ VIProductVersion "${VERSION}.0.0" VIAddVersionKey "ProductVersion" ${VERSION} VIAddVersionKey "FileVersion" "${VERSION}.0.0" VIAddVersionKey "ProductName" "GPXSee" -VIAddVersionKey "LegalCopyright" "Copyright (c) 2015-2024 Martin Tůma" +VIAddVersionKey "LegalCopyright" "Copyright (c) 2015-2025 Martin Tůma" VIAddVersionKey "FileDescription" "GPXSee installer (x64)" ; Registry key to check for directory (so if you install again, it will From 2b967ce05ee6e86902096224e899186522b6c742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 3 Jan 2025 19:46:19 +0100 Subject: [PATCH 21/21] Use Qt 6.8.1 for the OS X builds --- .github/workflows/osx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 8e97df33..5733c306 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -15,7 +15,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v4 with: - version: '6.8.0' + version: '6.8.1' modules: qtpositioning qtserialport qtimageformats - name: Create localization run: lrelease gpxsee.pro