Skip to content
Permalink
Browse files

consider data defined svg pattern rotation (fixes #7736)

  • Loading branch information
jef-n committed Jul 11, 2013
1 parent 3e83901 commit fd85aeea954642b1a13acab1d5e624008875ef4a
Showing with 11 additions and 3 deletions.
  1. +10 −3 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  2. +1 −0 src/core/symbology-ng/qgsfillsymbollayerv2.h
@@ -302,6 +302,7 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
return;
}

mNextAngle = mAngle;
applyDataDefinedSettings( context );

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

if ( qgsDoubleNear( mAngle, 0.0 ) )
if ( qgsDoubleNear( mNextAngle, 0.0 ) )
{
p->setBrush( mBrush );
}
else
{
QTransform t = mBrush.transform();
t.rotate( mAngle );
t.rotate( mNextAngle );
QBrush rotatedBrush = mBrush;
rotatedBrush.setTransform( t );
p->setBrush( rotatedBrush );
@@ -766,11 +767,17 @@ void QgsSVGFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderCon
QgsExpression* fillColorExpression = expression( "svgFillColor" );
QgsExpression* outlineColorExpression = expression( "svgOutlineColor" );
QgsExpression* outlineWidthExpression = expression( "svgOutlineWidth" );
if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression )
QgsExpression* angleExpression = expression( "angle" );
if ( !widthExpression && !svgFileExpression && !fillColorExpression && !outlineColorExpression && !outlineWidthExpression && !angleExpression )
{
return; //no data defined settings
}

if ( angleExpression )
{
mNextAngle = angleExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toDouble();
}

double width = mPatternWidth;
if ( widthExpression )
{
@@ -118,6 +118,7 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2

protected:
QBrush mBrush;
double mNextAngle; // mAngle / data defined angle

/**Outline width*/
double mOutlineWidth;

0 comments on commit fd85aee

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