1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Added hi-dpi one-way street (+ water ways) arrows

This commit is contained in:
Martin Tůma 2023-07-31 23:36:14 +02:00
parent c6af082fa3
commit 3e8b54f605
7 changed files with 19 additions and 13 deletions

View File

@ -58,6 +58,9 @@
<!-- Common map stuff -->
<qresource prefix="/map">
<file alias="arrow.png">icons/map/arrow.png</file>
<file alias="arrow@2x.png">icons/map/arrow@2x.png</file>
<file alias="water-arrow.png">icons/map/water-arrow.png</file>
<file alias="water-arrow@2x.png">icons/map/water-arrow@2x.png</file>
</qresource>
<!-- POIs (IMG & ENC style) -->

BIN
icons/map/arrow@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

BIN
icons/map/water-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@ -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<MapData::Poly> &polygons,
}
void RasterTile::processLines(QList<MapData::Poly> &lines,
QList<TextItem*> &textItems)
QList<TextItem*> &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<MapData::Poly> &lines,
QList<TextItem*> &textItems)
QList<TextItem*> &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<MapData::Poly> &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<MapData::Poly> lines;
QList<MapData::Point> points;
QList<TextItem*> 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);

View File

@ -45,13 +45,13 @@ private:
void processPolygons(const QList<MapData::Poly> &polygons,
QList<TextItem *> &textItems);
void processLines(QList<MapData::Poly> &lines,
QList<TextItem*> &textItems);
QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow);
void processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems);
void processShields(const QList<MapData::Poly> &lines,
QList<TextItem*> &textItems);
void processStreetNames(const QList<MapData::Poly> &lines,
QList<TextItem*> &textItems);
QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow);
Projection _proj;
Transform _transform;

View File

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