SLD parsing: handling ogc:Literal within CssParameter

This commit is contained in:
Jorge Gustavo Rocha 2017-01-15 19:47:01 +00:00
parent 5abe66b4c7
commit 6ba303e3ad

View File

@ -2566,6 +2566,7 @@ QDomElement QgsSymbolLayerUtils::createSvgParameterElement( QDomDocument &doc, c
QgsStringMap QgsSymbolLayerUtils::getSvgParameterList( QDomElement &element )
{
QgsStringMap params;
QString value;
QDomElement paramElem = element.firstChildElement();
while ( !paramElem.isNull() )
@ -2573,7 +2574,23 @@ QgsStringMap QgsSymbolLayerUtils::getSvgParameterList( QDomElement &element )
if ( paramElem.localName() == QLatin1String( "SvgParameter" ) || paramElem.localName() == QLatin1String( "CssParameter" ) )
{
QString name = paramElem.attribute( QStringLiteral( "name" ) );
QString value = paramElem.firstChild().nodeValue();
if (paramElem.firstChild().nodeType() == QDomNode::TextNode)
{
value = paramElem.firstChild().nodeValue();
}
else
{
if (paramElem.firstChild().nodeType() == QDomNode::ElementNode &&
paramElem.firstChild().localName() == QLatin1String("Literal"))
{
QgsDebugMsg(paramElem.firstChild().localName());
value = paramElem.firstChild().firstChild().nodeValue();
}
else
{
QgsDebugMsg(QString("unexpected child of %1").arg(paramElem.localName()));
}
}
if ( !name.isEmpty() && !value.isEmpty() )
params[ name ] = value;