Skip to content

Commit

Permalink
Allow coloring of svg markers when used with graduated/categorised re…
Browse files Browse the repository at this point in the history
…nderers (fix #11658)

(cherry-picked from a721752)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 14d47ab commit d633f59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -1053,7 +1053,7 @@ QgsSvgMarkerSymbolLayerV2::QgsSvgMarkerSymbolLayerV2( QString name, double size,
mScaleMethod = scaleMethod;
mOutlineWidth = 1.0;
mOutlineWidthUnit = QgsSymbolV2::MM;
mFillColor = QColor( Qt::black );
mColor = QColor( Qt::black );
mOutlineColor = QColor( Qt::black );
}

Expand Down Expand Up @@ -1337,7 +1337,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
outlineWidth = outlineWidthExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toDouble();
}

QColor fillColor = mFillColor;
QColor fillColor = mColor;
QgsExpression* fillExpression = expression( "fill" );
if ( fillExpression )
{
Expand Down Expand Up @@ -1428,7 +1428,7 @@ QgsStringMap QgsSvgMarkerSymbolLayerV2::properties() const
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
map["scale_method"] = QgsSymbolLayerV2Utils::encodeScaleMethod( mScaleMethod );
map["color"] = mFillColor.name();
map["color"] = mColor.name();
map["outline_color"] = mOutlineColor.name();
map["outline_width"] = QString::number( mOutlineWidth );
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit );
Expand All @@ -1443,7 +1443,7 @@ QgsStringMap QgsSvgMarkerSymbolLayerV2::properties() const
QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::clone() const
{
QgsSvgMarkerSymbolLayerV2* m = new QgsSvgMarkerSymbolLayerV2( mPath, mSize, mAngle );
m->setFillColor( mFillColor );
m->setFillColor( mColor );
m->setOutlineColor( mOutlineColor );
m->setOutlineWidth( mOutlineWidth );
m->setOutlineWidthUnit( mOutlineWidthUnit );
Expand Down Expand Up @@ -1496,7 +1496,7 @@ void QgsSvgMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &
QDomElement graphicElem = doc.createElement( "se:Graphic" );
element.appendChild( graphicElem );

QgsSymbolLayerV2Utils::externalGraphicToSld( doc, graphicElem, mPath, "image/svg+xml", mFillColor, mSize );
QgsSymbolLayerV2Utils::externalGraphicToSld( doc, graphicElem, mPath, "image/svg+xml", mColor, mSize );

// <Rotation>
QString angleFunc;
Expand Down Expand Up @@ -1634,7 +1634,7 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
outlineWidth = outlineWidthExpression->evaluate( *f ).toDouble();
}

QColor fillColor = mFillColor;
QColor fillColor = mColor;
QgsExpression *fillExpression = expression( "fill" );
if ( fillExpression )
{
Expand Down
5 changes: 2 additions & 3 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.h
Expand Up @@ -179,8 +179,8 @@ class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
QString path() const { return mPath; }
void setPath( QString path );

QColor fillColor() const override { return mFillColor; }
void setFillColor( const QColor& c ) override { mFillColor = c; }
QColor fillColor() const override { return color(); }
void setFillColor( const QColor& color ) override { setColor( color ); }

QColor outlineColor() const override { return mOutlineColor; }
void setOutlineColor( const QColor& c ) override { mOutlineColor = c; }
Expand All @@ -207,7 +207,6 @@ class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2

//param(fill), param(outline), param(outline-width) are going
//to be replaced in memory
QColor mFillColor;
QColor mOutlineColor;
double mOutlineWidth;
QgsSymbolV2::OutputUnit mOutlineWidthUnit;
Expand Down

0 comments on commit d633f59

Please sign in to comment.