Skip to content

Commit

Permalink
moved node value parsing to ogc filter parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Feb 8, 2017
1 parent d722fb9 commit e05a8ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/core/qgsogcutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsgeometry.h"
#include "qgswkbptr.h"
#include "qgscoordinatereferencesystem.h"
#include "qgslogger.h"

#include <QColor>
#include <QStringList>
Expand Down Expand Up @@ -1584,6 +1585,16 @@ QgsExpression* QgsOgcUtils::expressionFromOgcFilter( const QDomElement& element
if ( element.isNull() || !element.hasChildNodes() )
return nullptr;

// check if it is a single string value => no DomElement
if ( element.firstChild().nodeType() == QDomNode::TextNode )
{
QgsExpression *expr = new QgsExpression( element.firstChild().nodeValue() );
expr->d->mParserErrorString = QString();
return expr;
}

// now parse OGC operators. OGC operator does not have a only text value
// but only sub element operators
QgsExpression *expr = new QgsExpression();

QDomElement childElem = element.firstChildElement();
Expand Down
8 changes: 0 additions & 8 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2592,14 +2592,6 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin
return false;
}

// check if it is a single string value
if ( elem.hasChildNodes() &&
elem.firstChild().nodeType() == QDomNode::TextNode )
{
function = elem.firstChild().nodeValue();
return true;
}

// parse ogc:Filter
QgsExpression *expr = QgsOgcUtils::expressionFromOgcFilter( elem );
if ( !expr )
Expand Down

0 comments on commit e05a8ca

Please sign in to comment.