@@ -976,12 +976,13 @@ QgsMapUnitScale QgsSimpleMarkerSymbolLayerV2::mapUnitScale() const
976
976
// ////////
977
977
978
978
979
- QgsSvgMarkerSymbolLayerV2::QgsSvgMarkerSymbolLayerV2 ( QString name, double size, double angle )
979
+ QgsSvgMarkerSymbolLayerV2::QgsSvgMarkerSymbolLayerV2 ( QString name, double size, double angle, QgsSymbolV2::ScaleMethod scaleMethod )
980
980
{
981
981
mPath = QgsSymbolLayerV2Utils::symbolNameToPath ( name );
982
982
mSize = size;
983
983
mAngle = angle;
984
984
mOffset = QPointF ( 0 , 0 );
985
+ mScaleMethod = scaleMethod;
985
986
mOutlineWidth = 1.0 ;
986
987
mOutlineWidthUnit = QgsSymbolV2::MM;
987
988
mFillColor = QColor ( Qt::black );
@@ -994,15 +995,18 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::create( const QgsStringMap& props )
994
995
QString name = DEFAULT_SVGMARKER_NAME;
995
996
double size = DEFAULT_SVGMARKER_SIZE;
996
997
double angle = DEFAULT_SVGMARKER_ANGLE;
997
-
998
+ QgsSymbolV2::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD;
999
+
998
1000
if ( props.contains ( " name" ) )
999
1001
name = props[" name" ];
1000
1002
if ( props.contains ( " size" ) )
1001
1003
size = props[" size" ].toDouble ();
1002
1004
if ( props.contains ( " angle" ) )
1003
1005
angle = props[" angle" ].toDouble ();
1004
-
1005
- QgsSvgMarkerSymbolLayerV2* m = new QgsSvgMarkerSymbolLayerV2 ( name, size, angle );
1006
+ if ( props.contains ( " scale_method" ) )
1007
+ scaleMethod = QgsSymbolLayerV2Utils::decodeScaleMethod ( props[" scale_method" ] );
1008
+
1009
+ QgsSvgMarkerSymbolLayerV2* m = new QgsSvgMarkerSymbolLayerV2 ( name, size, angle, scaleMethod );
1006
1010
1007
1011
// we only check the svg default parameters if necessary, since it could be expensive
1008
1012
if ( !props.contains ( " fill" ) && !props.contains ( " outline" ) && !props.contains ( " outline-width" ) )
@@ -1143,6 +1147,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
1143
1147
1144
1148
double scaledSize = mSize ;
1145
1149
QgsExpression* sizeExpression = expression ( " size" );
1150
+
1146
1151
bool hasDataDefinedSize = context.renderHints () & QgsSymbolV2::DataDefinedSizeScale || sizeExpression;
1147
1152
1148
1153
if ( sizeExpression )
@@ -1297,6 +1302,7 @@ QgsStringMap QgsSvgMarkerSymbolLayerV2::properties() const
1297
1302
map[" offset" ] = QgsSymbolLayerV2Utils::encodePoint ( mOffset );
1298
1303
map[" offset_unit" ] = QgsSymbolLayerV2Utils::encodeOutputUnit ( mOffsetUnit );
1299
1304
map[" offset_map_unit_scale" ] = QgsSymbolLayerV2Utils::encodeMapUnitScale ( mOffsetMapUnitScale );
1305
+ map[" scale_method" ] = QgsSymbolLayerV2Utils::encodeScaleMethod ( mScaleMethod );
1300
1306
map[" fill" ] = mFillColor .name ();
1301
1307
map[" outline" ] = mOutlineColor .name ();
1302
1308
map[" outline-width" ] = QString::number ( mOutlineWidth );
0 commit comments