1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Yet another area labels layout algorithm change

This commit is contained in:
Martin Tůma 2024-11-13 17:15:26 +01:00
parent 1a9bec1d94
commit a9927911fc

View File

@ -205,17 +205,14 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
const QColor *color = p.ti ? &p.ti->fillColor() : 0; const QColor *color = p.ti ? &p.ti->fillColor() : 0;
const QColor *hColor = p.ti ? haloColor(p.ti) : 0; const QColor *hColor = p.ti ? haloColor(p.ti) : 0;
QPainterPath rp;
rp.addRect(_rect);
QPointF pos = p.p->path->labelPos.isNull() QPointF pos = p.p->path->labelPos.isNull()
? centroid(p.p->pp & rp) : ll2xy(p.p->path->labelPos); ? centroid(p.p->pp) : ll2xy(p.p->path->labelPos);
if (p.ti && p.lbl && set.contains(*p.lbl)) if (p.ti && p.lbl && set.contains(*p.lbl))
continue; continue;
PointItem *item = new PointItem(pos.toPoint(), p.lbl, font, img, color, PointItem *item = new PointItem(pos.toPoint(), p.lbl, font, img, color,
hColor); hColor);
if (item->isValid() && _rect.contains(item->boundingRect().toRect()) if (item->isValid() && rectNearPolygon(p.p->pp, item->boundingRect())
&& rectNearPolygon(p.p->pp, item->boundingRect())
&& !item->collides(textItems)) { && !item->collides(textItems)) {
textItems.append(item); textItems.append(item);
if (p.ti && p.lbl) if (p.ti && p.lbl)