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 3c11a5d commit 5741925
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 9 additions & 8 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,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 @@ -307,7 +308,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
mPen.setColor( mOutlineColor );
mPen.setStyle( mOutlineStyle );
mPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOutlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
mBrush.setColor( mFillColor );
mBrush.setColor( mColor );
prepareExpressions( context );
}

Expand Down Expand Up @@ -339,7 +340,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 @@ -450,7 +451,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 @@ -621,10 +622,10 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa

//fill color
bool ok;
QColor fc = mFillColor;
QColor fc = mColor;
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR ) )
{
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mFillColor ) );
context->setOriginalValueVariable( QgsSymbolLayerV2Utils::encodeColor( mColor ) );
QString colorString = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, *context, QVariant(), &ok ).toString();
if ( ok )
fc = QgsSymbolLayerV2Utils::decodeColor( colorString );
Expand Down
5 changes: 2 additions & 3 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.h
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 5741925

Please sign in to comment.