Skip to content

Commit 79130b3

Browse files
committed
Fix shift in point displacement renderer
1 parent e6718b6 commit 79130b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/plugins/point_displacement_renderer/qgspointdisplacementrenderer.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,17 @@ void QgsPointDisplacementRenderer::calculateSymbolAndLabelPositions( const QPoin
479479
symbolPositions.clear();
480480
labelShifts.clear();
481481

482+
if ( nPosition < 1 )
483+
{
484+
return;
485+
}
486+
else if ( nPosition == 1 ) //If there is only one feature, draw it exactly at the center position
487+
{
488+
symbolPositions.append( centerPoint );
489+
labelShifts.append( QPointF( symbolDiagonal / 2.0, -symbolDiagonal / 2.0 ) );
490+
return;
491+
}
492+
482493
double fullPerimeter = 2 * M_PI;
483494
double angleStep = fullPerimeter / nPosition;
484495
double currentAngle;

0 commit comments

Comments
 (0)