Skip to content
Permalink
Browse files
fixed toSld() & replaced "" by QString
  • Loading branch information
vmora committed Jan 16, 2014
1 parent bf39737 commit c7ccdc9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
@@ -435,9 +435,9 @@ void QgsCategorizedSymbolRendererV2::toSld( QDomDocument &doc, QDomElement &elem
QgsStringMap props;
props[ "attribute" ] = mAttrName;
if ( mRotation.data() )
props[ "angle" ] = QString( mRotation->expression() ).append( "\"" ).prepend( "\"" );
props[ "angle" ] = mRotation->expression();
if ( mSizeScale.data() )
props[ "scale" ] = QString( mSizeScale->expression() ).append( "\"" ).prepend( "\"" );
props[ "scale" ] = mSizeScale->expression();

// create a Rule for each range
for ( QgsCategoryList::const_iterator it = mCategories.constBegin(); it != mCategories.constEnd(); ++it )
@@ -126,7 +126,7 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2
//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = "" );
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = QString() );

QgsSymbolV2* sourceSymbol();
void setSourceSymbol( QgsSymbolV2* sym );
@@ -144,7 +144,7 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mRotation.data() || !mRotation->hasParserError() );
}
//! @note added in 1.6
QString rotationField() const { return mRotation.data() ? mRotation->expression() : "";}
QString rotationField() const { return mRotation.data() ? mRotation->expression() : QString();}

//! @note added in 1.6
void setSizeScaleField( QString expression )
@@ -153,7 +153,7 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mSizeScale.data() || !mSizeScale->hasParserError() );
}
//! @note added in 1.6
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : ""; }
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : QString(); }

//! @note added in 2.0
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
@@ -343,9 +343,9 @@ void QgsGraduatedSymbolRendererV2::toSld( QDomDocument& doc, QDomElement &elemen
QgsStringMap props;
props[ "attribute" ] = mAttrName;
if ( mRotation.data() )
props[ "angle" ] = QString( mRotation->expression() ).append( "\"" ).prepend( "\"" );
props[ "angle" ] = mRotation->expression();
if ( mSizeScale.data() )
props[ "scale" ] = QString( mSizeScale->expression() ).append( "\"" ).prepend( "\"" );
props[ "scale" ] = mSizeScale->expression();

// create a Rule for each range
for ( QgsRangeList::const_iterator it = mRanges.constBegin(); it != mRanges.constEnd(); ++it )
@@ -144,7 +144,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2
//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = "" );
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = QString() );

QgsSymbolV2* sourceSymbol();
void setSourceSymbol( QgsSymbolV2* sym );
@@ -170,7 +170,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mRotation.data() || !mRotation->hasParserError() );
}
//! @note added in 1.6
QString rotationField() const { return mRotation.data() ? mRotation->expression() : "";}
QString rotationField() const { return mRotation.data() ? mRotation->expression() : QString();}

//! @note added in 1.6
void setSizeScaleField( QString expression )
@@ -179,7 +179,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mSizeScale.data() || !mSizeScale->hasParserError() );
}
//! @note added in 1.6
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : ""; }
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : QString(); }

//! @note added in 2.0
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
@@ -22,6 +22,7 @@
#include "qgsfeature.h"
#include "qgsvectorlayer.h"
#include "qgssymbollayerv2.h"
#include "qgsogcutils.h"

#include <QDomDocument>
#include <QDomElement>
@@ -188,10 +189,11 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::clone()
void QgsSingleSymbolRendererV2::toSld( QDomDocument& doc, QDomElement &element ) const
{
QgsStringMap props;
QString errorMsg;
if ( mRotation.data() )
props[ "angle" ] = QString( mRotation->expression() ).append( "\"" ).prepend( "\"" );
props[ "angle" ] = mRotation->expression();
if ( mSizeScale.data() )
props[ "scale" ] = QString( mSizeScale->expression() ).append( "\"" ).prepend( "\"" );
props[ "scale" ] = mSizeScale->expression();

QDomElement ruleElem = doc.createElement( "se:Rule" );
element.appendChild( ruleElem );
@@ -50,7 +50,7 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mRotation.data() || !mRotation->hasParserError() );
}
//! @note added in 1.5
QString rotationField() const { return mRotation.data() ? mRotation->expression() : ""; }
QString rotationField() const { return mRotation.data() ? mRotation->expression() : QString(); }

//! @note added in 1.5
void setSizeScaleField( QString expression )
@@ -59,7 +59,7 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2
Q_ASSERT( !mSizeScale.data() || !mSizeScale->hasParserError() );
}
//! @note added in 1.5
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : ""; }
QString sizeScaleField() const { return mSizeScale.data() ? mSizeScale->expression() : QString(); }

//! @note added in 2.0
void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
@@ -91,7 +91,7 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2
//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = "" );
virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = QString() );

protected:
QScopedPointer<QgsSymbolV2> mSymbol;

0 comments on commit c7ccdc9

Please sign in to comment.