Skip to content

Commit fd85aee

Browse files
committed
consider data defined svg pattern rotation (fixes #7736)
1 parent 3e83901 commit fd85aee

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/core/symbology-ng/qgsfillsymbollayerv2.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
302302
return;
303303
}
304304

305+
mNextAngle = mAngle;
305306
applyDataDefinedSettings( context );
306307

307308
p->setPen( QPen( Qt::NoPen ) );
@@ -315,14 +316,14 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
315316
_renderPolygon( p, points, rings );
316317
}
317318

318-
if ( qgsDoubleNear( mAngle, 0.0 ) )
319+
if ( qgsDoubleNear( mNextAngle, 0.0 ) )
319320
{
320321
p->setBrush( mBrush );
321322
}
322323
else
323324
{
324325
QTransform t = mBrush.transform();
325-
t.rotate( mAngle );
326+
t.rotate( mNextAngle );
326327
QBrush rotatedBrush = mBrush;
327328
rotatedBrush.setTransform( t );
328329
p->setBrush( rotatedBrush );
@@ -766,11 +767,17 @@ void QgsSVGFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderCon
766767
QgsExpression* fillColorExpression = expression( "svgFillColor" );
767768
QgsExpression* outlineColorExpression = expression( "svgOutlineColor" );
768769
QgsExpression* outlineWidthExpression = expression( "svgOutlineWidth" );
769-
if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression )
770+
QgsExpression* angleExpression = expression( "angle" );
771+
if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression && !angleExpression )
770772
{
771773
return; //no data defined settings
772774
}
773775

776+
if ( angleExpression )
777+
{
778+
mNextAngle = angleExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toDouble();
779+
}
780+
774781
double width = mPatternWidth;
775782
if ( widthExpression )
776783
{

src/core/symbology-ng/qgsfillsymbollayerv2.h

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2
118118

119119
protected:
120120
QBrush mBrush;
121+
double mNextAngle; // mAngle / data defined angle
121122

122123
/**Outline width*/
123124
double mOutlineWidth;

0 commit comments

Comments
 (0)