diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index e462c6de..f4969b7d 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -114,11 +114,8 @@ const QFont *RasterTile::poiFont(Style::FontSize size, int zoom, } } -void RasterTile::ll2xy(QList &polys, bool polygons) const +void RasterTile::ll2xy(QList &polys) const { - if (!_vectors && !polygons) - return; - for (int i = 0; i < polys.size(); i++) { MapData::Poly &poly = polys[i]; for (int j = 0; j < poly.points.size(); j++) { @@ -130,9 +127,6 @@ void RasterTile::ll2xy(QList &polys, bool polygons) const void RasterTile::ll2xy(QList &points) const { - if (!_vectors) - return; - for (int i = 0; i < points.size(); i++) { QPointF p(ll2xy(points.at(i).coordinates)); points[i].coordinates = Coordinates(p.x(), p.y()); @@ -198,9 +192,6 @@ void RasterTile::drawPolygons(QPainter *painter, void RasterTile::drawLines(QPainter *painter, const QList &lines) const { - if (!_vectors) - return; - painter->setBrush(Qt::NoBrush); for (int i = 0; i < lines.size(); i++) { @@ -290,9 +281,6 @@ void RasterTile::processPolygons(const QList &polygons, void RasterTile::processLines(QList &lines, QList &textItems, const QImage (&arrows)[2]) { - if (!_vectors) - return; - std::stable_sort(lines.begin(), lines.end()); if (_zoom >= 22) @@ -411,9 +399,6 @@ void RasterTile::processShields(const QList &lines, void RasterTile::processPoints(QList &points, QList &textItems) { - if (!_vectors) - return; - std::sort(points.begin(), points.end()); for (int i = 0; i < points.size(); i++) { @@ -462,14 +447,16 @@ void RasterTile::fetchData(QList &polygons, RectD polyRectD(_transform.img2proj(polyRect.topLeft()), _transform.img2proj(polyRect.bottomRight())); _data->polys(polyRectD.toRectC(_proj, 20), _zoom, - &polygons, &lines); + &polygons, _vectors ? &lines : 0); - QRectF pointRect(QPointF(ttl.x() - TEXT_EXTENT, ttl.y() - TEXT_EXTENT), - QPointF(ttl.x() + _rect.width() + TEXT_EXTENT, ttl.y() + _rect.height() - + TEXT_EXTENT)); - RectD pointRectD(_transform.img2proj(pointRect.topLeft()), - _transform.img2proj(pointRect.bottomRight())); - _data->points(pointRectD.toRectC(_proj, 20), _zoom, &points); + if (_vectors) { + QRectF pointRect(QPointF(ttl.x() - TEXT_EXTENT, ttl.y() - TEXT_EXTENT), + QPointF(ttl.x() + _rect.width() + TEXT_EXTENT, ttl.y() + _rect.height() + + TEXT_EXTENT)); + RectD pointRectD(_transform.img2proj(pointRect.topLeft()), + _transform.img2proj(pointRect.bottomRight())); + _data->points(pointRectD.toRectC(_proj, 20), _zoom, &points); + } } MatrixD RasterTile::elevation(int extend) const @@ -540,8 +527,8 @@ void RasterTile::render() arrows[WATER] = HIDPI_IMG(":/map", "water-arrow", _ratio); fetchData(polygons, lines, points); - ll2xy(polygons, true); - ll2xy(lines, false); + ll2xy(polygons); + ll2xy(lines); ll2xy(points); processPoints(points, textItems); diff --git a/src/map/IMG/rastertile.h b/src/map/IMG/rastertile.h index 2a828a24..96871739 100644 --- a/src/map/IMG/rastertile.h +++ b/src/map/IMG/rastertile.h @@ -54,7 +54,7 @@ private: {return _transform.proj2img(_proj.ll2xy(c));} Coordinates xy2ll(const QPointF &p) const {return _proj.xy2ll(_transform.img2proj(p));} - void ll2xy(QList &polys, bool polygons) const; + void ll2xy(QList &polys) const; void ll2xy(QList &points) const; void drawPolygons(QPainter *painter, const QList &polygons) const; diff --git a/src/map/IMG/vectortile.cpp b/src/map/IMG/vectortile.cpp index 3e0efb05..19a83dd1 100644 --- a/src/map/IMG/vectortile.cpp +++ b/src/map/IMG/vectortile.cpp @@ -183,12 +183,14 @@ void VectorTile::polys(const RectC &rect, const Zoom &zoom, } copyPolys(rect, &polys->polygons, polygons); - copyPolys(rect, &polys->lines, lines); + if (lines) + copyPolys(rect, &polys->lines, lines); cache->insert(subdiv, polys); } else { copyPolys(rect, &polys->polygons, polygons); - copyPolys(rect, &polys->lines, lines); + if (lines) + copyPolys(rect, &polys->lines, lines); } }