Skip to content

Commit c6547c0

Browse files
committedNov 18, 2015
Fix ellipse symbol layer with graduated/categorised renderer
(cherry-picked from 5a6bfbb)
1 parent 70f5896 commit c6547c0

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed
 

‎src/core/symbology-ng/qgsellipsesymbollayerv2.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@
2626
#include <QDomElement>
2727

2828
QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2()
29-
: mSymbolName( "circle" )
29+
: QgsMarkerSymbolLayerV2()
30+
, mSymbolName( "circle" )
3031
, mSymbolWidth( 4 )
3132
, mSymbolWidthUnit( QgsSymbolV2::MM )
3233
, mSymbolHeight( 3 )
3334
, mSymbolHeightUnit( QgsSymbolV2::MM )
34-
, mFillColor( Qt::white )
3535
, mOutlineColor( Qt::black )
3636
, mOutlineStyle( Qt::SolidLine )
3737
, mOutlineWidth( 0 )
3838
, mOutlineWidthUnit( QgsSymbolV2::MM )
3939
{
40+
mColor = Qt::white;
4041
mPen.setColor( mOutlineColor );
4142
mPen.setStyle( mOutlineStyle );
4243
mPen.setWidth( 1.0 );
4344
mPen.setJoinStyle( Qt::MiterJoin );
44-
mBrush.setColor( mFillColor );
45+
mBrush.setColor( mColor );
4546
mBrush.setStyle( Qt::SolidPattern );
4647
mOffset = QPointF( 0, 0 );
4748

@@ -340,7 +341,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
340341
mPen.setColor( mOutlineColor );
341342
mPen.setStyle( mOutlineStyle );
342343
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
343-
mBrush.setColor( mFillColor );
344+
mBrush.setColor( mColor );
344345
prepareExpressions( context.fields(), context.renderContext().rendererScale() );
345346
}
346347

@@ -372,7 +373,7 @@ void QgsEllipseSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &el
372373
QDomElement graphicElem = doc.createElement( "se:Graphic" );
373374
element.appendChild( graphicElem );
374375

375-
QgsSymbolLayerV2Utils::wellKnownMarkerToSld( doc, graphicElem, mSymbolName, mFillColor, mOutlineColor, mOutlineStyle, mOutlineWidth, mSymbolWidth );
376+
QgsSymbolLayerV2Utils::wellKnownMarkerToSld( doc, graphicElem, mSymbolName, mColor, mOutlineColor, mOutlineStyle, mOutlineWidth, mSymbolWidth );
376377

377378
// store w/h factor in a <VendorOption>
378379
double widthHeightFactor = mSymbolWidth / mSymbolHeight;
@@ -481,7 +482,7 @@ QgsStringMap QgsEllipseSymbolLayerV2::properties() const
481482
map["outline_width"] = QString::number( mOutlineWidth );
482483
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit );
483484
map["outline_width_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOutlineWidthMapUnitScale );
484-
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mFillColor );
485+
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor );
485486
map["outline_color"] = QgsSymbolLayerV2Utils::encodeColor( mOutlineColor );
486487
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
487488
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
@@ -656,7 +657,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
656657
}
657658

658659
//fill color
659-
QColor fc = mFillColor;
660+
QColor fc = mColor;
660661
QgsExpression* fillColorExpression = expression( "fill_color" );
661662
if ( fillColorExpression )
662663
{

‎src/core/symbology-ng/qgsellipsesymbollayerv2.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
5757
void setOutlineWidth( double w ) { mOutlineWidth = w; }
5858
double outlineWidth() const { return mOutlineWidth; }
5959

60-
void setFillColor( const QColor& c ) override { mFillColor = c;}
61-
QColor fillColor() const override { return mFillColor; }
60+
void setFillColor( const QColor& c ) override { setColor( c ); }
61+
QColor fillColor() const override { return color(); }
6262

6363
void setOutlineColor( const QColor& c ) override { mOutlineColor = c; }
6464
QColor outlineColor() const override { return mOutlineColor; }
@@ -95,7 +95,6 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
9595
double mSymbolHeight;
9696
QgsSymbolV2::OutputUnit mSymbolHeightUnit;
9797
QgsMapUnitScale mSymbolHeightMapUnitScale;
98-
QColor mFillColor;
9998
QColor mOutlineColor;
10099
Qt::PenStyle mOutlineStyle;
101100
double mOutlineWidth;

‎src/core/symbology-ng/qgsfillsymbollayerv2.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
844844

845845
//param(fill), param(outline), param(outline-width) are going
846846
//to be replaced in memory
847-
QColor mSvgFillColor;
848847
QColor mSvgOutlineColor;
849848
double mSvgOutlineWidth;
850849
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit;

0 commit comments

Comments
 (0)