mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-23 19:25:54 +01:00
Limit area labels to one per tile
This commit is contained in:
parent
77f51098f6
commit
86b85e5afc
@ -153,6 +153,7 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
|
||||
QList<const Style::TextRender*> labels(_style->areaLabels(_zoom));
|
||||
QList<const Style::Symbol*> symbols(_style->areaSymbols(_zoom));
|
||||
QList<PathText> items;
|
||||
QSet<QByteArray> set;
|
||||
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
const PainterPath &path = paths.at(i);
|
||||
@ -199,12 +200,16 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user