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

Display one-way streets info in IMG maps

This commit is contained in:
Martin Tůma 2023-07-13 11:59:53 +02:00
parent 56c77df176
commit b4be5ea206
5 changed files with 30 additions and 3 deletions

View File

@ -55,6 +55,11 @@
<file alias="transform-move_32@2x.png">icons/GUI/transform-move_32@2x.png</file>
</qresource>
<!-- Common map stuff -->
<qresource prefix="/map">
<file alias="arrow.png">icons/map/arrow.png</file>
</qresource>
<!-- POIs (IMG & ENC style) -->
<qresource prefix="/POI">
<file alias="airfield-11.png">icons/map/POI/airfield-11.png</file>

BIN
icons/map/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

View File

@ -25,6 +25,8 @@ class MapData
{
public:
struct Poly {
Poly() : oneway(false) {}
/* QPointF insted of Coordinates for performance reasons (no need to
duplicate all the vectors for drawing). Note, that we do not want to
ll2xy() the points in the MapData class as this can not be done in
@ -34,6 +36,7 @@ public:
Raster raster;
quint32 type;
RectC boundingRect;
bool oneway;
bool operator<(const Poly &other) const
{return type > other.type;}

View File

@ -25,6 +25,12 @@ 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;
@ -327,14 +333,25 @@ void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
const QFont *fnt = font(style.textFontSize(), Style::Small);
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;
TextPathItem *item = new TextPathItem(poly.points,
&poly.label.text(), _rect, fnt, color, Style::isContourLine(poly.type)
? 0 : &haloColor);
&poly.label.text(), _rect, fnt, color, hColor, img);
if (item->isValid() && !item->collides(textItems))
textItems.append(item);
else
else {
delete item;
if (img) {
TextPathItem *item = new TextPathItem(poly.points, 0, _rect, 0,
0, 0, img);
if (item->isValid() && !item->collides(textItems))
textItems.append(item);
else
delete item;
}
}
}
}

View File

@ -292,6 +292,8 @@ bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
poly.type = (segmentType == Polygon)
? ((quint32)(type & 0x7F)) << 8 : ((quint32)(type & 0x3F)) << 8;
if (segmentType == Line && type & 0x40)
poly.oneway = true;
QPoint pos(subdiv->lon() + LS(lon, 24-subdiv->bits()),