Skip to content
Permalink
Browse files
* also intialize mCalc member of QgsExpression in protected ctor (fixes
#8475)

* avoid nesting ogc:Filter in ogc:Filter (createFunctionElement already returns a filter)
  • Loading branch information
jef-n committed Aug 18, 2013
1 parent 78be54c commit 6d157123ef91bb46a14207183bb00b193403330c
@@ -1617,15 +1617,12 @@ QgsExpression::QgsExpression( const QString& expr )
mRootNode = ::parseExpression( mExpression, mParserErrorString );

if ( mParserErrorString.isNull() )
{
Q_ASSERT( mRootNode != NULL );
}
Q_ASSERT( mRootNode );
}

QgsExpression::~QgsExpression()
{
if ( mCalc )
delete mCalc;
delete mCalc;
delete mRootNode;
}

@@ -599,7 +599,7 @@ class CORE_EXPORT QgsExpression

protected:
// internally used to create an empty expression
QgsExpression() : mRootNode( NULL ), mRowNumber( 0 ) {}
QgsExpression() : mRootNode( 0 ), mRowNumber( 0 ), mCalc( 0 ) {}

void initGeomCalculator();

@@ -124,12 +124,10 @@ void QgsRendererCategoryV2::toSld( QDomDocument &doc, QDomElement &element, QgsS
ruleElem.appendChild( descrElem );

// create the ogc:Filter for the range
QDomElement filterElem = doc.createElement( "ogc:Filter" );
QString filterFunc = QString( "%1 = '%2'" )
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mValue.toString().replace( "'", "''" ) );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );
ruleElem.appendChild( filterElem );
QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, filterFunc );

mSymbol->toSld( doc, ruleElem, props );
}
@@ -139,12 +139,10 @@ void QgsRendererRangeV2::toSld( QDomDocument &doc, QDomElement &element, QgsStri
ruleElem.appendChild( descrElem );

// create the ogc:Filter for the range
QDomElement filterElem = doc.createElement( "ogc:Filter" );
QString filterFunc = QString( "%1 > %2 AND %1 <= %3" )
.arg( attrName.replace( "\"", "\"\"" ) )
.arg( mLowerValue ).arg( mUpperValue );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );
ruleElem.appendChild( filterElem );
QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, filterFunc );

mSymbol->toSld( doc, ruleElem, props );
}
@@ -255,9 +255,7 @@ void QgsRuleBasedRendererV2::Rule::toSld( QDomDocument& doc, QDomElement &elemen

if ( !props.value( "filter", "" ).isEmpty() )
{
QDomElement filterElem = doc.createElement( "ogc:Filter" );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, props.value( "filter", "" ) );
ruleElem.appendChild( filterElem );
QgsSymbolLayerV2Utils::createFunctionElement( doc, ruleElem, props.value( "filter", "" ) );
}

if ( !props.value( "scaleMinDenom", "" ).isEmpty() )

0 comments on commit 6d15712

Please sign in to comment.