From 3e8b54f6050b096c7b7699443bce8f11b78ace5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20T=C5=AFma?= Date: Mon, 31 Jul 2023 23:36:14 +0200 Subject: [PATCH] Added hi-dpi one-way street (+ water ways) arrows --- gpxsee.qrc | 3 +++ icons/map/arrow@2x.png | Bin 0 -> 241 bytes icons/map/water-arrow.png | Bin 0 -> 181 bytes icons/map/water-arrow@2x.png | Bin 0 -> 249 bytes src/map/IMG/rastertile.cpp | 22 +++++++++++----------- src/map/IMG/rastertile.h | 4 ++-- src/map/IMG/style.h | 3 +++ 7 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 icons/map/arrow@2x.png create mode 100644 icons/map/water-arrow.png create mode 100644 icons/map/water-arrow@2x.png diff --git a/gpxsee.qrc b/gpxsee.qrc index 0c5d86cb..70029704 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -58,6 +58,9 @@ icons/map/arrow.png + icons/map/arrow@2x.png + icons/map/water-arrow.png + icons/map/water-arrow@2x.png diff --git a/icons/map/arrow@2x.png b/icons/map/arrow@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3dffad2ca4d68489f3fb275d98ce381583dcf4b2 GIT binary patch literal 241 zcwXxa@N?(olHy`uVBq!ia0vp^3P8-q!3HG#?#OKdQfx`y?k)^q@Y8vBJ&@uo@Q5sC zV9-+rVaAH3_GLi9iJmTwAr_~PPI2TrtiZ!^d`iqG`?!<*%3IH=PRp1g6wP}wW`{!A z7Pb}%VFTv;1V*vYtAEu51>ZMnYJ9kPDA(4-+=l(x0*9<6@oQZ)SsS8WPd^cM-#etN(PlOGkrawxmar>mdKI;Vst09-;<761SM literal 0 HcwPel00001 diff --git a/icons/map/water-arrow.png b/icons/map/water-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..50d1f8b3c18ab00f9739114d94c7047bfe1e2a17 GIT binary patch literal 181 zcwXxa@N?(olHy`uVBq!ia0vp^0zk~p!3HE570x;VDYhhUcNYdQ`02d69!PN(ctjR6 zFz6|RFk{71`!b+lsHcl#h{WaOgaf=T5T!<~WhLT^qB$6RORe1! SCqJ7Bvfb0w&t;ucLK6VBE;BFy literal 0 HcwPel00001 diff --git a/icons/map/water-arrow@2x.png b/icons/map/water-arrow@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a57bb6adafc13705a705d87456aeab56a2fc5f0e GIT binary patch literal 249 zcwXxa@N?(olHy`uVBq!ia0vp^3P8-q!3HG#?#OKdQfx`y?k)^q@Y8vBJ&@uo@Q5sC zV9-+rVaAH3_GLi9nVv3=Ar_~PPC3ZiY{26>-+4z#hu)=BiM6LUa3m{ieaGsp*_5!F zcaOJT;J?e|LW*wucN)YEm^ZI_RW-SzR@n7ET;kdfzopr0On#_W&i*H literal 0 HcwPel00001 diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index dfecb211..02a7616c 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -25,12 +25,6 @@ static const QColor shieldBgColor1("#dd3e3e"); static const QColor shieldBgColor2("#379947"); static const QColor shieldBgColor3("#4a7fc1"); -static const QImage *arrow() -{ - static QImage img(":/map/arrow.png"); - return &img; -} - static QFont pixelSizeFont(int pixelSize) { QFont f; @@ -308,17 +302,17 @@ void RasterTile::processPolygons(const QList &polygons, } void RasterTile::processLines(QList &lines, - QList &textItems) + QList &textItems, const QImage &arrow, const QImage &waterArrow) { std::stable_sort(lines.begin(), lines.end()); if (_zoom >= 22) - processStreetNames(lines, textItems); + processStreetNames(lines, textItems, arrow, waterArrow); processShields(lines, textItems); } void RasterTile::processStreetNames(const QList &lines, - QList &textItems) + QList &textItems, const QImage &arrow, const QImage &waterArrow) { for (int i = 0; i < lines.size(); i++) { const MapData::Poly &poly = lines.at(i); @@ -334,7 +328,9 @@ void RasterTile::processStreetNames(const QList &lines, const QColor *color = style.textColor().isValid() ? &style.textColor() : 0; const QColor *hColor = Style::isContourLine(poly.type) ? 0 : &haloColor; - const QImage *img = poly.oneway ? arrow() : 0; + const QImage *img = poly.oneway + ? Style::isWaterLine(poly.type) + ? &waterArrow : &arrow : 0; TextPathItem *item = new TextPathItem(poly.points, &poly.label.text(), _rect, fnt, color, hColor, img); @@ -479,6 +475,10 @@ void RasterTile::render() QList lines; QList points; QList textItems; + QImage arrow = (_ratio >= 2) + ? QImage(":/map/arrow@2x.png") : QImage(":/map/arrow.png"); + QImage waterArrow = (_ratio >= 2) + ? QImage(":/map/water-arrow@2x.png") : QImage(":/map/water-arrow.png"); fetchData(polygons, lines, points); ll2xy(polygons); @@ -487,7 +487,7 @@ void RasterTile::render() processPoints(points, textItems); processPolygons(polygons, textItems); - processLines(lines, textItems); + processLines(lines, textItems, arrow, waterArrow); _pixmap.setDevicePixelRatio(_ratio); _pixmap.fill(Qt::transparent); diff --git a/src/map/IMG/rastertile.h b/src/map/IMG/rastertile.h index 8002c8b8..9ba1724d 100644 --- a/src/map/IMG/rastertile.h +++ b/src/map/IMG/rastertile.h @@ -45,13 +45,13 @@ private: void processPolygons(const QList &polygons, QList &textItems); void processLines(QList &lines, - QList &textItems); + QList &textItems, const QImage &arrow, const QImage &waterArrow); void processPoints(QList &points, QList &textItems); void processShields(const QList &lines, QList &textItems); void processStreetNames(const QList &lines, - QList &textItems); + QList &textItems, const QImage &arrow, const QImage &waterArrow); Projection _proj; Transform _transform; diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index e04ae3e3..559dde73 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -104,6 +104,9 @@ public: static bool isWaterArea(quint32 type) {return ((type >= TYPE(0x3c) && type <= TYPE(0x44)) || (type & 0xffff00) == TYPE(0x10b));} + static bool isWaterLine(quint32 type) + {return (type == TYPE(0x26) || type == TYPE(0x18) + || type == TYPE(0x1f));} static bool isMilitaryArea(quint32 type) {return (type == TYPE(0x04) || type == 0x10901);} static bool isNatureReserve(quint32 type) -- 2.11.4.GIT