From 26229e5871cd9cc54a7e212c8bd328de99824461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 16 Feb 2020 08:43:37 +0100 Subject: [PATCH] Fixed tile bounds exceeding map bounds --- src/map/imgmap.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/map/imgmap.cpp b/src/map/imgmap.cpp index 9be288f9..10634e1b 100644 --- a/src/map/imgmap.cpp +++ b/src/map/imgmap.cpp @@ -588,15 +588,21 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags) tiles.append(RasterTile(this, ttl, key)); RasterTile &tile = tiles.last(); - RectD polyRect(_transform.img2proj(ttl), _transform.img2proj( - QPointF(ttl.x() + TILE_SIZE, ttl.y() + TILE_SIZE))); - _data->polys(polyRect.toRectC(_projection, 4), _zoom, + QRectF polyRect(ttl, QPointF(ttl.x() + TILE_SIZE, + ttl.y() + TILE_SIZE)); + polyRect &= bounds(); + RectD polyRectD(_transform.img2proj(polyRect.topLeft()), + _transform.img2proj(polyRect.bottomRight())); + _data->polys(polyRectD.toRectC(_projection, 4), _zoom, &(tile.polygons()), &(tile.lines())); - RectD pointRect(_transform.img2proj(QPointF(ttl.x() - TEXT_EXTENT, - ttl.y() - TEXT_EXTENT)), _transform.img2proj(QPointF(ttl.x() - + TILE_SIZE + TEXT_EXTENT, ttl.y() + TILE_SIZE + TEXT_EXTENT))); - _data->points(pointRect.toRectC(_projection, 4), _zoom, + QRectF pointRect(QPointF(ttl.x() - TEXT_EXTENT, + ttl.y() - TEXT_EXTENT), QPointF(ttl.x() + TILE_SIZE + + TEXT_EXTENT, ttl.y() + TILE_SIZE + TEXT_EXTENT)); + pointRect &= bounds(); + RectD pointRectD(_transform.img2proj(pointRect.topLeft()), + _transform.img2proj(pointRect.bottomRight())); + _data->points(pointRectD.toRectC(_projection, 4), _zoom, &(tile.points())); } }