Skip to content
Permalink
Browse files

Fix ellipse symbol layer with graduated/categorised renderer

  • Loading branch information
nyalldawson committed Nov 14, 2015
1 parent 8ddc909 commit 5a6bfbb260d4054fa5d075510423f7374ce1af78
@@ -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 );

@@ -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 );
}

@@ -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;
@@ -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 );
@@ -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 );
@@ -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; }
@@ -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;
@@ -846,7 +846,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;

0 comments on commit 5a6bfbb

Please sign in to comment.
You can’t perform that action at this time.