def testSvgFillPixel(self): symbol = QgsSVGFillSymbolLayer('test/star.svg', 10, 45) symbol.setSvgOutlineWidth(3) symbol.setOutputUnit(QgsUnitTypes.RenderPixels) dom, root = self.symbolToSld(symbol) # print ("Svg fill px: \n" + dom.toString()) self.assertStaticRotation(root, '45') self.assertStaticSize(root, '10') # width of the svg outline self.assertStrokeWidth(root, 1, 3) # width of the polygon outline self.assertStrokeWidth(root, 3, 0.26)
def testSvgFillPixel(self): symbol = QgsSVGFillSymbolLayer('test/star.svg', 10, 45) symbol.setSvgFillColor(QColor('blue')) symbol.setSvgStrokeWidth(3) symbol.setOutputUnit(QgsUnitTypes.RenderPixels) symbol.subSymbol().setWidth(10) dom, root = self.symbolToSld(symbol) # print ("Svg fill px: \n" + dom.toString()) self.assertExternalGraphic(root, 0, 'test/star.svg?fill=%230000ff&fill-opacity=1&outline=%23000000&outline-opacity=1&outline-width=3', 'image/svg+xml') self.assertExternalGraphic(root, 1, 'test/star.svg', 'image/svg+xml') self.assertWellKnownMark(root, 0, 'square', '#0000ff', '#000000', 3) self.assertStaticRotation(root, '45') self.assertStaticSize(root, '10') # width of the polygon stroke lineSymbolizer = root.elementsByTagName('se:LineSymbolizer').item(0).toElement() self.assertStrokeWidth(lineSymbolizer, 1, 10)
def testSvgFillPixel(self): symbol = QgsSVGFillSymbolLayer("test/star.svg", 10, 45) symbol.setSvgFillColor(QColor("blue")) symbol.setSvgOutlineWidth(3) symbol.setOutputUnit(QgsUnitTypes.RenderPixels) symbol.subSymbol().setWidth(10) dom, root = self.symbolToSld(symbol) # print ("Svg fill px: \n" + dom.toString()) self.assertExternalGraphic( root, 0, "test/star.svg?fill=%230000ff&fill-opacity=1&outline=%23000000&outline-opacity=1&outline-width=3", "image/svg+xml", ) self.assertExternalGraphic(root, 1, "test/star.svg", "image/svg+xml") self.assertWellKnownMark(root, 0, "square", "#0000ff", "#000000", 3) self.assertStaticRotation(root, "45") self.assertStaticSize(root, "10") # width of the polygon outline lineSymbolizer = root.elementsByTagName("se:LineSymbolizer").item(0).toElement() self.assertStrokeWidth(lineSymbolizer, 1, 10)