From d7663a0789b3eceb55c7e3fd535414ac73f8e9b6 Mon Sep 17 00:00:00 2001 From: Marco Hugentobler Date: Thu, 23 May 2013 11:55:37 +0200 Subject: [PATCH] Scale/diameter scale also for svg marker --- src/core/symbology-ng/qgsmarkersymbollayerv2.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp b/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp index 37e624725902..085e3421722d 100644 --- a/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp @@ -843,11 +843,26 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re double size = mSize; QgsExpression* sizeExpression = expression( "size" ); + bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale || sizeExpression; + if ( sizeExpression ) { size = sizeExpression->evaluate( const_cast( context.feature() ) ).toDouble(); } size *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit ); + + if ( hasDataDefinedSize ) + { + switch ( mScaleMethod ) + { + case QgsSymbolV2::ScaleArea: + size = sqrt( size ); + break; + case QgsSymbolV2::ScaleDiameter: + break; + } + } + //don't render symbols with size below one or above 10,000 pixels if (( int )size < 1 || 10000.0 < size ) {