[SCM] qgis branch, master, updated. a2ee769957385f4e084c5e8b6ba178a8c877d1db
Giuseppe Sucameli
brush.tyler at gmail.com
Tue Mar 20 13:43:41 UTC 2012
The following commit has been merged in the master branch:
commit c5769bf3799c785ab90d4f37fa1a0c7fe88cfc3f
Author: Giuseppe Sucameli <brush.tyler at gmail.com>
Date: Fri Mar 16 16:50:59 2012 +0100
Append Filter tag to Rule tag when exporting Categorized/Graduated rendererV2 to SLD doc (fix #5191)
diff --git a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
index ea9d014..c55bd76 100644
--- a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
+++ b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
@@ -73,28 +73,27 @@ void QgsRendererCategoryV2::toSld( QDomDocument &doc, QDomElement &element, QgsS
if ( !mSymbol || props.value( "attribute", "" ).isEmpty() )
return;
+ QString attrName = props[ "attribute" ];
+
QDomElement ruleElem = doc.createElement( "se:Rule" );
element.appendChild( ruleElem );
- QString valueStr = QString( "value: %1" ).arg( mValue.toString() );
-
QDomElement nameElem = doc.createElement( "se:Name" );
- nameElem.appendChild( doc.createTextNode( !mLabel.isEmpty() ? mLabel : valueStr ) );
+ nameElem.appendChild( doc.createTextNode( mLabel ) );
ruleElem.appendChild( nameElem );
- QString descrName = props.value( "version", "1.1" ) < "1.1" ? "Abstract" : "se:Description";
- QString descrValue = QString( "Categorized symbol rendererV2 - %1" ).arg( valueStr );
-
- QDomElement descrElem = doc.createElement( descrName );
- descrElem.appendChild( doc.createTextNode( descrValue ) );
+ QDomElement descrElem = doc.createElement( "se:Description" );
+ QString descrStr = QString( "%1 is '%2'" ).arg( attrName ).arg( mValue.toString() );
+ descrElem.appendChild( doc.createTextNode( !mLabel.isEmpty() ? mLabel : descrStr ) );
ruleElem.appendChild( descrElem );
// create the ogc:Filter for the range
QDomElement filterElem = doc.createElement( "ogc:Filter" );
-
QString filterFunc = QString( "%1 = '%2'" )
- .arg( props[ "attribute" ] ).arg( mValue.toString().replace( "'", "''" ) );
+ .arg( attrName.replace( "\"", "\"\"" ) )
+ .arg( mValue.toString().replace( "'", "''" ) );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );
+ ruleElem.appendChild( filterElem );
mSymbol->toSld( doc, ruleElem, props );
}
diff --git a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
index 190c95b..a9b128f 100644
--- a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
+++ b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
@@ -103,27 +103,24 @@ void QgsRendererRangeV2::toSld( QDomDocument &doc, QDomElement &element, QgsStri
if ( !mSymbol || props.value( "attribute", "" ).isEmpty() )
return;
+ QString attrName = props[ "attribute" ];
+
QDomElement ruleElem = doc.createElement( "se:Rule" );
element.appendChild( ruleElem );
- QString valueStr = QString( "range: %1 - %2" ).arg( mLowerValue ).arg( mUpperValue );
-
QDomElement nameElem = doc.createElement( "se:Name" );
- nameElem.appendChild( doc.createTextNode( !mLabel.isEmpty() ? mLabel : valueStr ) );
+ nameElem.appendChild( doc.createTextNode( mLabel ) );
ruleElem.appendChild( nameElem );
- QString descrName = props.value( "version", "1.1" ) < "1.1" ? "Abstract" : "se:Description";
- QString descrValue = QString( "Graduated symbol rendererV2 - %1" ).arg( valueStr );
-
- QDomElement descrElem = doc.createElement( descrName );
- descrElem.appendChild( doc.createTextNode( descrValue ) );
+ QDomElement descrElem = doc.createElement( "se:Description" );
+ QString descrStr = QString( "range: %1 - %2" ).arg( mLowerValue ).arg( mUpperValue );
+ descrElem.appendChild( doc.createTextNode( !mLabel.isEmpty() ? mLabel : descrStr ) );
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( props[ "attribute" ] )
+ .arg( attrName.replace( "\"", "\"\"" ) )
.arg( mLowerValue ).arg( mUpperValue );
QgsSymbolLayerV2Utils::createFunctionElement( doc, filterElem, filterFunc );
--
The Quantum GIS in Debian project
More information about the Pkg-grass-devel
mailing list