Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sldfix 11863 #1975

Merged
merged 4 commits into from
May 4, 2015
Merged

Sldfix 11863 #1975

merged 4 commits into from
May 4, 2015

Conversation

rduivenvoorde
Copy link
Contributor

This fixes http://hub.qgis.org/issues/11863

in which non valid xml was generated due to the dual generation of literal layers.

not sure if this is the obvious solution, but it works for the example case which is in the issue.

I also found out that using a minus in a column name raises other problems. Not related to this one as there the minus is not seen as an unary operator.

6122a9f is a minimal dump fix.

when a unary-minus is encountered, add a minus to the operand
@@ -2218,7 +2218,7 @@ bool QgsExpression::NodeUnaryOperator::prepare( QgsExpression* parent, const Qgs

QString QgsExpression::NodeUnaryOperator::dump() const
{
return QString( "%1 %2" ).arg( UnaryOperatorText[mOp] ).arg( mOperand->dump() );
return QString( "%1%2" ).arg( UnaryOperatorText[mOp] ).arg( mOperand->dump() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also output NOT with no space which isn't correct. I was thinking about this and I'm not sure this needs to change even though I though it was wrong at the start.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, happy to remove this, as it was only because you asked :-)

}
else // not sure if this will ever happen
{
uoElem.appendChild( doc.createTextNode( "-" ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory this may happen - e.g. with expression "-fldA + fldB = 0"

From a quick look into OGC Filter Encoding specs it seems to me that v1.1 defined arithmetic operators like [Add] and [Sub], the latest v2.0 does not mention them anymore. The expression "-X" could be handled the same way as "0-X" is handled - with [Sub] tag.

Or we could just return an error message stating it is not supported - better than just creating invalid filter...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wonder-sk I kept that line to not break historical use of it...

I'm fine with an error message, as I think (espcially in the ogc/sld context) this will never be used/happen.

Should I change it and add it to this PR then?

@rduivenvoorde
Copy link
Contributor Author

@wonder-sk Martin ok, like this? Please pull, so it will be in 2.8.2 :-)

wonder-sk added a commit that referenced this pull request May 4, 2015
Fixes #11863 (invalid SLD with negative values)
@wonder-sk wonder-sk merged commit f800ac6 into qgis:master May 4, 2015
@rduivenvoorde
Copy link
Contributor Author

Thanks Martin

@wonder-sk
Copy link
Member

thanks for patience :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants