@@ -462,21 +462,35 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
462462 // move to the desired position
463463 transform.translate ( point.x () + off.x (), point.y () + off.y () );
464464
465- bool hasDataDefinedRotation = context.renderHints () & QgsSymbolV2::DataDefinedRotation || angleExpression;
466- if ( angle != 0 && hasDataDefinedRotation )
467- transform.rotate ( angle );
468-
469- double size = mSize ;
470- QgsExpression* sizeExpression = expression ( " size" );
465+ QgsExpression *sizeExpression = expression ( " size" );
466+ bool hasDataDefinedSize = context.renderHints () & QgsSymbolV2::DataDefinedSizeScale || sizeExpression;
471467
472- if ( sizeExpression )
468+ // resize if necessary
469+ if ( hasDataDefinedSize )
473470 {
474- size = sizeExpression->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toDouble ();
471+ double scaledSize = mSize ;
472+ if ( sizeExpression )
473+ {
474+ scaledSize = sizeExpression->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toDouble ();
475+ }
476+ scaledSize *= QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mSizeUnit );
477+
478+ switch ( mScaleMethod )
479+ {
480+ case QgsSymbolV2::ScaleArea:
481+ scaledSize = sqrt ( scaledSize );
482+ break ;
483+ case QgsSymbolV2::ScaleDiameter:
484+ break ;
485+ }
486+
487+ double half = scaledSize / 2.0 ;
488+ transform.scale ( half, half );
475489 }
476- size *= QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mSizeUnit );
477490
478- double half = size / 2.0 ;
479- transform.scale ( half, half );
491+ bool hasDataDefinedRotation = context.renderHints () & QgsSymbolV2::DataDefinedRotation || angleExpression;
492+ if ( angle != 0 && hasDataDefinedRotation )
493+ transform.rotate ( angle );
480494
481495 QgsExpression* colorExpression = expression ( " color" );
482496 QgsExpression* colorBorderExpression = expression ( " color_border" );
0 commit comments