Skip to content

Commit

Permalink
Merge pull request #35587 from qgis-bot/backport-35575-to-release-3_10
Browse files Browse the repository at this point in the history
[Backport release-3_10] Fix simple and ellipse marker bound calculation ignores stroke width
  • Loading branch information
rouault committed Apr 5, 2020
2 parents 9b3830d + 7f6e38e commit 96c5b0e
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/core/symbology/qgsellipsesymbollayer.cpp
Expand Up @@ -674,7 +674,7 @@ QRectF QgsEllipseSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext &con
if ( !qgsDoubleNear( angle, 0.0 ) )
transform.rotate( angle );

double penWidth = 0.0;
double penWidth = mStrokeWidth;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeWidth ) )
{
context.setOriginalValueVariable( mStrokeWidth );
Expand All @@ -686,10 +686,12 @@ QRectF QgsEllipseSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext &con
double strokeWidth = exprVal.toDouble( &ok );
if ( ok )
{
penWidth = context.renderContext().convertToPainterUnits( strokeWidth, mStrokeWidthUnit, mStrokeWidthMapUnitScale );
penWidth = strokeWidth;
}
}
}
penWidth = context.renderContext().convertToPainterUnits( penWidth, mStrokeWidthUnit, mStrokeWidthMapUnitScale );

if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeStyle ) )
{
context.setOriginalValueVariable( QgsSymbolLayerUtils::encodePenStyle( mStrokeStyle ) );
Expand All @@ -699,6 +701,8 @@ QRectF QgsEllipseSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext &con
penWidth = 0.0;
}
}
else if ( mStrokeStyle == Qt::NoPen )
penWidth = 0;

//antialiasing, add 1 pixel
penWidth += 1;
Expand Down
8 changes: 6 additions & 2 deletions src/core/symbology/qgsmarkersymbollayer.cpp
Expand Up @@ -1458,17 +1458,18 @@ QRectF QgsSimpleMarkerSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext
QRectF symbolBounds = QgsSimpleMarkerSymbolLayerBase::bounds( point, context );

// need to account for stroke width
double penWidth = 0.0;
double penWidth = mStrokeWidth;
bool ok = true;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeWidth ) )
{
context.setOriginalValueVariable( mStrokeWidth );
double strokeWidth = mDataDefinedProperties.valueAsDouble( QgsSymbolLayer::PropertyStrokeWidth, context.renderContext().expressionContext(), mStrokeWidth, &ok );
if ( ok )
{
penWidth = context.renderContext().convertToPainterUnits( strokeWidth, mStrokeWidthUnit, mStrokeWidthMapUnitScale );
penWidth = strokeWidth;
}
}
penWidth = context.renderContext().convertToPainterUnits( penWidth, mStrokeWidthUnit, mStrokeWidthMapUnitScale );
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyStrokeStyle ) )
{
context.setOriginalValueVariable( QgsSymbolLayerUtils::encodePenStyle( mStrokeStyle ) );
Expand All @@ -1478,6 +1479,9 @@ QRectF QgsSimpleMarkerSymbolLayer::bounds( QPointF point, QgsSymbolRenderContext
penWidth = 0.0;
}
}
else if ( mStrokeStyle == Qt::NoPen )
penWidth = 0;

//antialiasing, add 1 pixel
penWidth += 1;

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 96c5b0e

Please sign in to comment.