1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-23 19:25:54 +01:00

Do not try to draw labels outside the tile rect

This commit is contained in:
Martin Tůma 2024-11-22 21:52:32 +01:00
parent 2a16a1f34c
commit 67820d7c4d
2 changed files with 14 additions and 4 deletions

View File

@ -220,8 +220,13 @@ void RasterTile::drawLines(QPainter *painter, const QList<MapData::Line> &lines)
void RasterTile::drawTextItems(QPainter *painter,
const QList<TextItem*> &textItems)
{
for (int i = 0; i < textItems.size(); i++)
textItems.at(i)->paint(painter);
QRectF rect(_rect);
for (int i = 0; i < textItems.size(); i++) {
const TextItem *ti = textItems.at(i);
if (rect.intersects(ti->boundingRect()))
ti->paint(painter);
}
}
void RasterTile::processPolygons(const QList<MapData::Poly> &polygons,

View File

@ -217,8 +217,13 @@ void RasterTile::drawLines(QPainter *painter,
void RasterTile::drawTextItems(QPainter *painter,
const QList<TextItem*> &textItems) const
{
for (int i = 0; i < textItems.size(); i++)
textItems.at(i)->paint(painter);
QRectF rect(_rect);
for (int i = 0; i < textItems.size(); i++) {
const TextItem *ti = textItems.at(i);
if (rect.intersects(ti->boundingRect()))
ti->paint(painter);
}
}
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,