diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index 75835c9fffb2..a68a730f9ba2 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -1955,6 +1955,7 @@ QDomElement QgsOgcUtils::expressionToOgcExpression( const QgsExpression &express case QgsExpressionNode::ntFunction: case QgsExpressionNode::ntLiteral: case QgsExpressionNode::ntColumnRef: + case QgsExpressionNode::ntUnaryOperator: { QgsOgcUtilsExprToFilter utils( doc, gmlVersion, filterVersion, QString(), QString(), geometryName, srsName, honourAxisOrientation, invertAxisOrientation, fieldNameToXPathMap, namespacePrefixToUriMap ); const QDomElement exprRootElem = utils.expressionNodeToOgcFilter( node, &exp, &context ); diff --git a/tests/src/python/test_qgssymbollayer_createsld.py b/tests/src/python/test_qgssymbollayer_createsld.py index 9de983114773..d31f6d1ce153 100644 --- a/tests/src/python/test_qgssymbollayer_createsld.py +++ b/tests/src/python/test_qgssymbollayer_createsld.py @@ -83,6 +83,12 @@ def testSimpleMarkerRotation(self): self.assertStaticRotation(root, '50') + symbol.setAngle(-50) + dom, root = self.symbolToSld(symbol) + # print( "Simple marker rotation: " + root.ownerDocument().toString()) + + self.assertStaticRotation(root, '-50') + def testSimpleMarkerUnitDefault(self): symbol = QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase.Shape.Star, color=QColor(255, 0, 0), strokeColor=QColor(0, 255, 0), size=10) @@ -145,6 +151,10 @@ def testSvgMarkerUnitDefault(self): self.assertStaticRotation(root, '90') self.assertStaticDisplacement(root, 18, 36) + symbol.setAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testSvgMarkerUnitPixels(self): symbol = QgsSvgMarkerSymbolLayer('symbols/star.svg', 10, 0) symbol.setFillColor(QColor("blue")) @@ -178,6 +188,10 @@ def testFontMarkerUnitDefault(self): self.assertStaticRotation(root, '45') self.assertStaticDisplacement(root, 18, 36) + symbol.setAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testFontMarkerUnitPixel(self): symbol = QgsFontMarkerSymbolLayer('sans', ',', 10, QColor('black'), 45) symbol.setOffset(QPointF(5, 10)) @@ -190,6 +204,10 @@ def testFontMarkerUnitPixel(self): self.assertStaticRotation(root, '45') self.assertStaticDisplacement(root, 5, 10) + symbol.setAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def createEllipseSymbolLayer(self): # No way to build it programmatically... mTestName = 'QgsEllipseSymbolLayer' @@ -348,6 +366,10 @@ def testSvgFillDefault(self): lineSymbolizer = root.elementsByTagName('se:LineSymbolizer').item(0).toElement() self.assertStrokeWidth(lineSymbolizer, 1, 36) + symbol.setAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testSvgFillPixel(self): symbol = QgsSVGFillSymbolLayer('test/star.svg', 10, 45) symbol.setSubSymbol(QgsLineSymbol()) @@ -373,6 +395,10 @@ def testSvgFillPixel(self): lineSymbolizer = root.elementsByTagName('se:LineSymbolizer').item(0).toElement() self.assertStrokeWidth(lineSymbolizer, 1, 10) + symbol.setAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testLineFillDefault(self): symbol = QgsLinePatternFillSymbolLayer() symbol.setLineAngle(45) @@ -387,6 +413,10 @@ def testLineFillDefault(self): self.assertStaticSize(root, '18') self.assertStaticDisplacement(root, 15, 9) + symbol.setLineAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testLineFillPixels(self): symbol = QgsLinePatternFillSymbolLayer() symbol.setLineAngle(45) @@ -402,6 +432,10 @@ def testLineFillPixels(self): self.assertStaticSize(root, '5') self.assertStaticDisplacement(root, 4.25, 2.63) + symbol.setLineAngle(-45) + dom, root = self.symbolToSld(symbol) + self.assertStaticRotation(root, '-45') + def testPointFillDefault(self): symbol = QgsPointPatternFillSymbolLayer() dom, root = self.symbolToSld(symbol)