Skip to content

Commit

Permalink
Fix ellipse symbol layer with graduated/categorised renderer
Browse files Browse the repository at this point in the history
(cherry-picked from 5a6bfbb)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 70f5896 commit c6547c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
15 changes: 8 additions & 7 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Expand Up @@ -26,22 +26,23 @@
#include <QDomElement>

QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2()
: mSymbolName( "circle" )
: QgsMarkerSymbolLayerV2()
, mSymbolName( "circle" )
, mSymbolWidth( 4 )
, mSymbolWidthUnit( QgsSymbolV2::MM )
, mSymbolHeight( 3 )
, mSymbolHeightUnit( QgsSymbolV2::MM )
, mFillColor( Qt::white )
, mOutlineColor( Qt::black )
, mOutlineStyle( Qt::SolidLine )
, mOutlineWidth( 0 )
, mOutlineWidthUnit( QgsSymbolV2::MM )
{
mColor = Qt::white;
mPen.setColor( mOutlineColor );
mPen.setStyle( mOutlineStyle );
mPen.setWidth( 1.0 );
mPen.setJoinStyle( Qt::MiterJoin );
mBrush.setColor( mFillColor );
mBrush.setColor( mColor );
mBrush.setStyle( Qt::SolidPattern );
mOffset = QPointF( 0, 0 );

Expand Down Expand Up @@ -340,7 +341,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
mPen.setColor( mOutlineColor );
mPen.setStyle( mOutlineStyle );
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
mBrush.setColor( mFillColor );
mBrush.setColor( mColor );
prepareExpressions( context.fields(), context.renderContext().rendererScale() );
}

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

QgsSymbolLayerV2Utils::wellKnownMarkerToSld( doc, graphicElem, mSymbolName, mFillColor, mOutlineColor, mOutlineStyle, mOutlineWidth, mSymbolWidth );
QgsSymbolLayerV2Utils::wellKnownMarkerToSld( doc, graphicElem, mSymbolName, mColor, mOutlineColor, mOutlineStyle, mOutlineWidth, mSymbolWidth );

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

//fill color
QColor fc = mFillColor;
QColor fc = mColor;
QgsExpression* fillColorExpression = expression( "fill_color" );
if ( fillColorExpression )
{
Expand Down
5 changes: 2 additions & 3 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.h
Expand Up @@ -57,8 +57,8 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
void setOutlineWidth( double w ) { mOutlineWidth = w; }
double outlineWidth() const { return mOutlineWidth; }

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

void setOutlineColor( const QColor& c ) override { mOutlineColor = c; }
QColor outlineColor() const override { return mOutlineColor; }
Expand Down Expand Up @@ -95,7 +95,6 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
double mSymbolHeight;
QgsSymbolV2::OutputUnit mSymbolHeightUnit;
QgsMapUnitScale mSymbolHeightMapUnitScale;
QColor mFillColor;
QColor mOutlineColor;
Qt::PenStyle mOutlineStyle;
double mOutlineWidth;
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology-ng/qgsfillsymbollayerv2.h
Expand Up @@ -844,7 +844,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer

//param(fill), param(outline), param(outline-width) are going
//to be replaced in memory
QColor mSvgFillColor;
QColor mSvgOutlineColor;
double mSvgOutlineWidth;
QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit;
Expand Down

0 comments on commit c6547c0

Please sign in to comment.