@@ -1595,25 +1595,37 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
1595
1595
}
1596
1596
1597
1597
QDomElement operandElem = element.firstChildElement ();
1598
- QgsExpression::Node* opLeft = nodeFromOgcFilter ( operandElem, errorMessage );
1599
- if ( !opLeft )
1598
+ QgsExpression::Node *expr = nodeFromOgcFilter ( operandElem, errorMessage ), *leftOp = expr ;
1599
+ if ( !expr )
1600
1600
{
1601
1601
if ( errorMessage.isEmpty () )
1602
1602
errorMessage = QString ( " invalid left operand for '%1' binary operator" ).arg ( element.tagName () );
1603
1603
return NULL ;
1604
1604
}
1605
1605
1606
- operandElem = operandElem.nextSiblingElement ();
1607
- QgsExpression::Node* opRight = nodeFromOgcFilter ( operandElem, errorMessage );
1608
- if ( !opRight )
1606
+ for ( operandElem = operandElem.nextSiblingElement (); !operandElem.isNull (); operandElem = operandElem.nextSiblingElement () )
1607
+ {
1608
+ QgsExpression::Node* opRight = nodeFromOgcFilter ( operandElem, errorMessage );
1609
+ if ( !opRight )
1610
+ {
1611
+ if ( errorMessage.isEmpty () )
1612
+ errorMessage = QString ( " invalid right operand for '%1' binary operator" ).arg ( element.tagName () );
1613
+ delete expr;
1614
+ return NULL ;
1615
+ }
1616
+
1617
+ expr = new QgsExpression::NodeBinaryOperator (( QgsExpression::BinaryOperator ) op, expr, opRight );
1618
+ }
1619
+
1620
+ if ( expr == leftOp )
1609
1621
{
1610
1622
if ( errorMessage.isEmpty () )
1611
- errorMessage = QString ( " invalid right operand for '%1' binary operator" ).arg ( element.tagName () );
1612
- delete opLeft ;
1623
+ errorMessage = QString ( " only one operand for '%1' binary operator" ).arg ( element.tagName () );
1624
+ delete expr ;
1613
1625
return NULL ;
1614
1626
}
1615
1627
1616
- return new QgsExpression::NodeBinaryOperator (( QgsExpression::BinaryOperator ) op, opLeft, opRight );
1628
+ return dynamic_cast < QgsExpression::NodeBinaryOperator * >( expr );
1617
1629
}
1618
1630
1619
1631
@@ -1843,7 +1855,6 @@ QgsExpression::Node* QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement& eleme
1843
1855
}
1844
1856
1845
1857
1846
-
1847
1858
QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodePropertyIsNullFromOgcFilter ( QDomElement& element, QString& errorMessage )
1848
1859
{
1849
1860
// convert ogc:PropertyIsNull to IS operator with NULL right operand
@@ -1865,8 +1876,6 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodePropertyIsNullFromOgcFilter(
1865
1876
// ///////////////
1866
1877
1867
1878
1868
-
1869
-
1870
1879
QDomElement QgsOgcUtils::expressionToOgcFilter ( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage )
1871
1880
{
1872
1881
if ( !exp.rootNode () )
0 commit comments