Skip to content
Permalink
Browse files

Avoid labels being marked as overlapping obstacles when features

neighbour each other

(cherry-picked from 655fc93)
  • Loading branch information
nyalldawson committed Aug 9, 2016
1 parent 00e9c32 commit 93389a826dd104a2f890264f637fbcee37d4f01f
Showing with 16 additions and 8 deletions.
  1. +16 −8 src/core/qgspallabeling.cpp
@@ -2926,16 +2926,24 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
}
}

if ( distinmapunit ) //convert distance from mm/map units to pixels
{
distance /= distMapUnitScale.computeMapUnitsPerPixel( context );
}
else //mm
{
distance *= vectorScaleFactor;
}

// when using certain placement modes, we force a tiny minimum distance. This ensures that
// candidates are created just offset from a border and avoids candidates being incorrectly flagged as colliding with neighbours
if ( placement == QgsPalLayerSettings::Line || placement == QgsPalLayerSettings::Curved || placement == QgsPalLayerSettings::PerimeterCurved )
{
distance = qMax( distance, 1.0 );
}

if ( !qgsDoubleNear( distance, 0.0 ) )
{
if ( distinmapunit ) //convert distance from mm/map units to pixels
{
distance /= distMapUnitScale.computeMapUnitsPerPixel( context );
}
else //mm
{
distance *= vectorScaleFactor;
}
double d = ptOne.distance( ptZero ) * distance;
( *labelFeature )->setDistLabel( d );
}

0 comments on commit 93389a8

Please sign in to comment.
You can’t perform that action at this time.