@@ -1053,8 +1053,15 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
1053
1053
}
1054
1054
1055
1055
p->save ();
1056
- double offsetX = mOffset .x () * QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOffsetUnit );
1057
- double offsetY = mOffset .y () * QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOffsetUnit );
1056
+
1057
+ QPointF offset = mOffset ;
1058
+ if ( mOffsetExpression )
1059
+ {
1060
+ QString offsetString = mOffsetExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toString ();
1061
+ offset = QgsSymbolLayerV2Utils::decodePoint ( offsetString );
1062
+ }
1063
+ double offsetX = offset.x () * QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOffsetUnit );
1064
+ double offsetY = offset.y () * QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOffsetUnit );
1058
1065
QPointF outputOffset ( offsetX, offsetY );
1059
1066
1060
1067
double angle = mAngle ;
@@ -1071,13 +1078,40 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
1071
1078
if ( rotated )
1072
1079
p->rotate ( angle );
1073
1080
1081
+ QString path = mPath ;
1082
+ if ( mNameExpression )
1083
+ {
1084
+ path = mNameExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toString ();
1085
+ }
1086
+
1087
+ double outlineWidth = mOutlineWidth ;
1088
+ if ( mOutlineWidthExpression )
1089
+ {
1090
+ outlineWidth = mOutlineWidthExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toDouble ();
1091
+ }
1092
+
1093
+ QColor fillColor = mFillColor ;
1094
+ if ( mFillExpression )
1095
+ {
1096
+ QString colorString = mFillExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toString ();
1097
+ fillColor = QgsSymbolLayerV2Utils::decodeColor ( colorString );
1098
+ }
1099
+
1100
+ QColor outlineColor = mOutlineColor ;
1101
+ if ( mOutlineExpression )
1102
+ {
1103
+ QString colorString = mOutlineExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toString ();
1104
+ outlineColor = QgsSymbolLayerV2Utils::decodeColor ( colorString );
1105
+ }
1106
+
1107
+
1074
1108
bool fitsInCache = true ;
1075
1109
bool usePict = true ;
1076
1110
double hwRatio = 1.0 ;
1077
1111
if ( drawOnScreen && !rotated )
1078
1112
{
1079
1113
usePict = false ;
1080
- const QImage& img = QgsSvgCache::instance ()->svgAsImage ( mPath , size, mFillColor , mOutlineColor , mOutlineWidth ,
1114
+ const QImage& img = QgsSvgCache::instance ()->svgAsImage ( path , size, fillColor, outlineColor, outlineWidth ,
1081
1115
context.renderContext ().scaleFactor (), context.renderContext ().rasterScaleFactor (), fitsInCache );
1082
1116
if ( fitsInCache && img.width () > 1 )
1083
1117
{
@@ -1100,7 +1134,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
1100
1134
if ( usePict || !fitsInCache )
1101
1135
{
1102
1136
p->setOpacity ( context.alpha () );
1103
- const QPicture& pct = QgsSvgCache::instance ()->svgAsPicture ( mPath , size, mFillColor , mOutlineColor , mOutlineWidth ,
1137
+ const QPicture& pct = QgsSvgCache::instance ()->svgAsPicture ( path , size, fillColor, outlineColor, outlineWidth ,
1104
1138
context.renderContext ().scaleFactor (), context.renderContext ().rasterScaleFactor () );
1105
1139
1106
1140
if ( pct.width () > 1 )
0 commit comments