Skip to content

Commit

Permalink
Clean legacy code in ellipse symbol layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Mar 31, 2013
1 parent 0c08088 commit cbab57d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 78 deletions.
21 changes: 0 additions & 21 deletions python/core/symbology-ng/qgsellipsesymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,21 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
void setSymbolName( const QString& name );
QString symbolName() const;

void setSymbolNameField( const QString& field );
const QString& symbolNameField() const;

void setSymbolWidth( double w );
double symbolWidth() const;

void setWidthField( const QString& field );
const QString& widthField() const;

void setSymbolHeight( double h );
double symbolHeight() const;

void setHeightField( const QString& field );
const QString& heightField() const;

void setRotationField( const QString& field );
const QString& rotationField() const;

void setOutlineWidth( double w );
double outlineWidth() const;

void setOutlineWidthField( const QString& field );
const QString& outlineWidthField() const;

void setFillColor( const QColor& c );
QColor fillColor() const;

void setFillColorField( const QString& field );
const QString& fillColorField() const;

void setOutlineColor( const QColor& c );
QColor outlineColor() const;

void setOutlineColorField( const QString& field );
const QString& outlineColorField() const;

QSet<QString> usedAttributes() const;

};
22 changes: 4 additions & 18 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2(): mSymbolName( "circle" ), mSy
mBrush.setStyle( Qt::SolidPattern );

mAngle = 0;
mWidthIndex = -1;
mHeightIndex = -1;
mRotationIndex = -1;
mOutlineWidthIndex = -1;
mFillColorIndex = -1;
mOutlineColorIndex = -1;
mSymbolNameIndex = -1;
}

QgsEllipseSymbolLayerV2::~QgsEllipseSymbolLayerV2()
Expand Down Expand Up @@ -270,16 +263,16 @@ void QgsEllipseSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &el
QString angleFunc = props.value( "angle", "" );
if ( angleFunc.isEmpty() ) // symbol has no angle set
{
if ( !mRotationField.isEmpty() )
angleFunc = mRotationField;
if ( mRotationExpression )
angleFunc = mRotationExpression->dump();
else if ( !doubleNear( mAngle, 0.0 ) )
angleFunc = QString::number( mAngle );
}
else if ( !mRotationField.isEmpty() )
else if ( mRotationExpression )
{
// the symbol has an angle and the symbol layer have a rotation
// property set
angleFunc = QString( "%1 + %2" ).arg( angleFunc ).arg( mRotationField );
angleFunc = QString( "%1 + %2" ).arg( angleFunc ).arg( mRotationExpression->dump() );
}
else if ( !doubleNear( mAngle, 0.0 ) )
{
Expand Down Expand Up @@ -355,20 +348,13 @@ QgsStringMap QgsEllipseSymbolLayerV2::properties() const
map["symbol_name"] = mSymbolName;
map["symbol_width"] = QString::number( mSymbolWidth );
map["symbol_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSymbolWidthUnit );
map["width_field"] = mWidthField;
map["symbol_height"] = QString::number( mSymbolHeight );
map["symbol_height_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSymbolHeightUnit );
map["height_field"] = mHeightField;
map["angle"] = QString::number( mAngle );
map["rotation_field"] = mRotationField;
map["outline_width"] = QString::number( mOutlineWidth );
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit );
map["outline_width_field"] = mOutlineWidthField;
map["fill_color"] = QgsSymbolLayerV2Utils::encodeColor( mFillColor );
map["fill_color_field"] = mFillColorField;
map["outline_color"] = QgsSymbolLayerV2Utils::encodeColor( mOutlineColor );
map["outline_color_field"] = mOutlineColorField;
map["symbol_name_field"] = mSymbolNameField;

//data defined properties
if ( mWidthExpression )
Expand Down
39 changes: 0 additions & 39 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,21 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
void setSymbolName( const QString& name ) { mSymbolName = name; }
QString symbolName() const { return mSymbolName; }

void setSymbolNameField( const QString& field ) { mSymbolNameField = field; }
const QString& symbolNameField() const { return mSymbolNameField; }

void setSymbolWidth( double w ) { mSymbolWidth = w; }
double symbolWidth() const { return mSymbolWidth; }

void setWidthField( const QString& field ) { mWidthField = field; }
const QString& widthField() const { return mWidthField; }

void setSymbolHeight( double h ) { mSymbolHeight = h; }
double symbolHeight() const { return mSymbolHeight; }

void setHeightField( const QString& field ) { mHeightField = field; }
const QString& heightField() const { return mHeightField; }

void setRotationField( const QString& field ) { mRotationField = field; }
const QString& rotationField() const { return mRotationField; }

void setOutlineWidth( double w ) { mOutlineWidth = w; }
double outlineWidth() const { return mOutlineWidth; }

void setOutlineWidthField( const QString& field ) { mOutlineWidthField = field; }
const QString& outlineWidthField() const { return mOutlineWidthField; }

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

void setFillColorField( const QString& field ) { mFillColorField = field; }
const QString& fillColorField() const { return mFillColorField; }

void setOutlineColor( const QColor& c ) { mOutlineColor = c; }
QColor outlineColor() const { return mOutlineColor; }

void setOutlineColorField( const QString& field ) { mOutlineColorField = field; }
const QString& outlineColorField() const { return mOutlineColorField; }

QSet<QString> usedAttributes() const;

void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolWidthUnit = unit; }
Expand Down Expand Up @@ -111,14 +90,6 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
QgsSymbolV2::OutputUnit mOutlineWidthUnit;

//data defined property fields
QString mWidthField;
QString mHeightField;
QString mRotationField;
QString mOutlineWidthField;
QString mFillColorField;
QString mOutlineColorField;
QString mSymbolNameField;

QgsExpression* mWidthExpression;
QgsExpression* mHeightExpression;
QgsExpression* mRotationExpression;
Expand All @@ -127,16 +98,6 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
QgsExpression* mOutlineColorExpression;
QgsExpression* mSymbolNameExpression;

//field indices for data defined properties
//resolved in startRender method
int mWidthIndex;
int mHeightIndex;
int mRotationIndex;
int mOutlineWidthIndex;
int mFillColorIndex;
int mOutlineColorIndex;
int mSymbolNameIndex;

QPainterPath mPainterPath;

QPen mPen;
Expand Down

0 comments on commit cbab57d

Please sign in to comment.