From 99521f456ab1a08a59913594a3d6280f780d8b5e Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 8 Aug 2016 13:18:24 +1000 Subject: [PATCH] [pal] When labels can be placed both above and below the line, prefer above --- src/core/pal/feature.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index 91f5fef994b..26aa412766d 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -1067,9 +1067,15 @@ int FeaturePart::createCurvedCandidatesAlongLine( QList< LabelPosition* >& lPos, if ( i == 0 && (( !reversed && ( flags & FLAG_ABOVE_LINE ) ) || ( reversed && ( flags & FLAG_BELOW_LINE ) ) ) ) p = _createCurvedCandidate( slp, angle_avg, mLF->distLabel() + li->label_height / 2 ); if ( i == 1 && flags & FLAG_ON_LINE ) + { p = _createCurvedCandidate( slp, angle_avg, 0 ); + p->setCost( p->cost() + 0.002 ); + } if ( i == 2 && (( !reversed && ( flags & FLAG_BELOW_LINE ) ) || ( reversed && ( flags & FLAG_ABOVE_LINE ) ) ) ) + { p = _createCurvedCandidate( slp, angle_avg, -li->label_height / 2 - mLF->distLabel() ); + p->setCost( p->cost() + 0.001 ); + } if ( p && mLF->permissibleZonePrepared() ) {