Skip to content

Commit

Permalink
Fix incorrect size of markers with data defined name
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 11, 2014
1 parent dd1bb9f commit 0ba3f5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -539,13 +539,15 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
off = _rotatedOffset( off, angle );

//data defined shape?
bool createdNewPath = false;
if ( mNameExpression )
{
QString name = mNameExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString();
if ( !prepareShape( name ) ) // drawing as a polygon
{
preparePath( name ); // drawing as a painter path
}
createdNewPath = true;
}

if ( mUsingCache )
Expand All @@ -565,17 +567,15 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
transform.translate( point.x() + off.x(), point.y() + off.y() );

// resize if necessary
if ( hasDataDefinedSize )
if ( hasDataDefinedSize || createdNewPath )
{

double s = scaledSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale );

double half = s / 2.0;
transform.scale( half, half );
}

bool hasDataDefinedRotation = context.renderHints() & QgsSymbolV2::DataDefinedRotation || mAngleExpression;
if ( angle != 0 && hasDataDefinedRotation )
if ( angle != 0 && ( hasDataDefinedRotation || createdNewPath ) )
transform.rotate( angle );

QgsExpression* colorExpression = expression( "color" );
Expand Down

0 comments on commit 0ba3f5b

Please sign in to comment.