diff --git a/src/map/IMG/bitmapline.cpp b/src/map/IMG/bitmapline.cpp index cf23fd75..c3ff3fc5 100644 --- a/src/map/IMG/bitmapline.cpp +++ b/src/map/IMG/bitmapline.cpp @@ -1,7 +1,13 @@ #include #include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#include +#else // QT5 +#include +#endif // QT5 #include "bitmapline.h" + static QImage img2line(const QImage &img, int width) { Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied); @@ -32,8 +38,8 @@ void BitmapLine::draw(QPainter *painter, const QPolygonF &line, painter->save(); painter->translate(segment.p1()); painter->rotate(-segment.angle()); - painter->drawImage(0, -img.height()/2, img2line(img, segment.length())); + painter->drawImage(0.0, -img.height()/2.0, img2line(img, + qCeil(segment.length()))); painter->restore(); } } - diff --git a/src/map/IMG/style.cpp b/src/map/IMG/style.cpp index 1be926af..e75b43ae 100644 --- a/src/map/IMG/style.cpp +++ b/src/map/IMG/style.cpp @@ -1,4 +1,5 @@ #include +#include #include "style.h" @@ -79,13 +80,19 @@ void Style::defaultPolygonStyle() << TYPE(0x13); } +static QImage railroad() +{ + QImage img(16, 4, QImage::Format_ARGB32_Premultiplied); + img.fill(QColor("#717171")); + QPainter p(&img); + p.setPen(QPen(Qt::white, 2)); + p.drawLine(9, 2, 15, 2); + + return img; +} + void Style::defaultLineStyle() { - QVector pattern; - pattern << 4 << 4; - QPen rr(QColor("#717171"), 3, Qt::CustomDashLine); - rr.setDashPattern(pattern); - _lines[TYPE(0x01)] = Line(QPen(QColor("#9bd772"), 2, Qt::SolidLine), QPen(QColor("#72a35a"), 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); _lines[TYPE(0x02)] = Line(QPen(QColor("#ffcc78"), 2, Qt::SolidLine), @@ -109,8 +116,7 @@ void Style::defaultLineStyle() QPen(QColor("#e8a541"), 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); _lines[TYPE(0x0c)] = Line(QPen(QColor("#ffffff"), 3, Qt::SolidLine), QPen(QColor("#d5cdc0"), 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - _lines[TYPE(0x14)] = Line(rr, QPen(Qt::white, 3, Qt::SolidLine, - Qt::RoundCap, Qt::RoundJoin)); + _lines[TYPE(0x14)] = Line(railroad()); _lines[TYPE(0x16)] = Line(QPen(QColor("#aba083"), 1, Qt::DotLine)); _lines[TYPE(0x18)] = Line(QPen(QColor("#9fc4e1"), 2, Qt::SolidLine)); _lines[TYPE(0x18)].setTextColor(QColor("#9fc4e1"));