From 86b85e5afce46c3099e2e7f15e22c6116822aa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 28 Oct 2024 13:00:56 +0100 Subject: [PATCH] Limit area labels to one per tile --- src/map/mapsforge/rastertile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 3fed7c6d..4e6287b8 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -153,6 +153,7 @@ void RasterTile::processAreaLabels(const QVector &paths, QList labels(_style->areaLabels(_zoom)); QList symbols(_style->areaSymbols(_zoom)); QList items; + QSet set; for (int i = 0; i < paths.size(); i++) { const PainterPath &path = paths.at(i); @@ -199,12 +200,16 @@ void RasterTile::processAreaLabels(const QVector &paths, QPointF pos = p.p->path->labelPos.isNull() ? centroid(p.p->pp) : ll2xy(p.p->path->labelPos); + if (p.ti && set.contains(*p.lbl)) + continue; + PointItem *item = new PointItem(pos.toPoint(), p.lbl, font, img, color, hColor); if (item->isValid() && _rect.contains(item->boundingRect().toRect()) - && !item->collides(textItems)) + && !item->collides(textItems)) { textItems.append(item); - else + set.insert(*p.lbl); + } else delete item; } }