Subgroup: S

Class: QgsSVGFillSymbolLayer

class qgis.core.QgsSVGFillSymbolLayer(svgFilePath: str, width: float = 20, rotation: float = 0)

Bases: qgis._core.QgsImageFillSymbolLayer

Constructor for QgsSVGFillSymbolLayer, using the SVG picture at the specified absolute file path.

QgsSVGFillSymbolLayer(svgData: Union[QByteArray, bytes, bytearray], width: float = 20, rotation: float = 0) Constructor for QgsSVGFillSymbolLayer, using the specified SVG picture data.

A class for filling symbols with a repeated SVG file.

Methods

applyDataDefinedSettings
clone
copyDataDefinedProperties
copyPaintEffect
create Creates a new QgsSVGFillSymbolLayer from a properties map.
createFromSld Creates a new QgsSVGFillSymbolLayer from a SLD element.
layerType
mapUnitScale
outputUnit
patternWidth Returns the width of the rendered SVG content within the fill (i.e.
patternWidthMapUnitScale Returns the map unit scale for the pattern’s width.
patternWidthUnit Returns the units for the width of the SVG images in the pattern.
properties
resolvePaths Turns relative paths in properties map to absolute when reading and vice versa when writing.
restoreOldDataDefinedProperties
setMapUnitScale
setOutputUnit
setPatternWidth Sets the width to render the SVG content as within the fill (i.e.
setPatternWidthMapUnitScale Sets the map unit scale for the pattern’s width.
setPatternWidthUnit Sets the unit for the width of the SVG images in the pattern.
setSvgFilePath Sets the path to the SVG file to render in the fill.
setSvgFillColor Sets the fill color used for rendering the SVG content.
setSvgStrokeColor Sets the stroke color used for rendering the SVG content.
setSvgStrokeWidth Sets the stroke width used for rendering the SVG content.
setSvgStrokeWidthMapUnitScale Sets the map unit scale for the pattern’s stroke.
setSvgStrokeWidthUnit Sets the unit for the stroke width.
startRender
stopRender
svgFilePath Returns the path to the SVG file used to render the fill.
svgFillColor Returns the fill color used for rendering the SVG content.
svgStrokeColor Returns the stroke color used for rendering the SVG content.
svgStrokeWidth Returns the stroke width used for rendering the SVG content.
svgStrokeWidthMapUnitScale Returns the map unit scale for the pattern’s stroke.
svgStrokeWidthUnit Returns the units for the stroke width.
toSld

Signals

Attributes

applyDataDefinedSettings(self, context: QgsSymbolRenderContext)
clone(self) → QgsSVGFillSymbolLayer
copyDataDefinedProperties()
copyPaintEffect()
create(properties: Dict[str, str] = {}) → QgsSymbolLayer

Creates a new QgsSVGFillSymbolLayer from a properties map. The caller takes ownership of the returned object.

createFromSld(element: QDomElement) → QgsSymbolLayer

Creates a new QgsSVGFillSymbolLayer from a SLD element. The caller takes ownership of the returned object.

layerType(self) → str
mapUnitScale(self) → QgsMapUnitScale
outputUnit(self) → QgsUnitTypes.RenderUnit
patternWidth(self) → float

Returns the width of the rendered SVG content within the fill (i.e. the pattern repeat/tile size).

Units are retrieved by patternWidthUnit()

patternWidthMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the pattern’s width.

See also

patternWidth()

patternWidthUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the width of the SVG images in the pattern.

See also

patternWidth()

properties(self) → Dict[str, str]
resolvePaths(properties: Dict[str, str], pathResolver: QgsPathResolver, saving: bool)

Turns relative paths in properties map to absolute when reading and vice versa when writing. Used internally when reading/writing symbols.

New in version 3.0.

restoreOldDataDefinedProperties()
setMapUnitScale(self, scale: QgsMapUnitScale)
setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
setPatternWidth(self, width: float)

Sets the width to render the SVG content as within the fill (i.e. the pattern repeat/tile size).

Units are specified by setPatternWidthUnit()

See also

patternWidth()

setPatternWidthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the pattern’s width.

setPatternWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the width of the SVG images in the pattern.

setSvgFilePath(self, svgPath: str)

Sets the path to the SVG file to render in the fill.

This is usually an absolute file path. Other supported options include - relative paths to folders from the user’s SVG search paths - base64 encoded content, prefixed with a ‘base64:’ string - http(s) paths

See also

svgFilePath()

setSvgFillColor(self, c: Union[QColor, Qt.GlobalColor])

Sets the fill color used for rendering the SVG content.

Fill color is only supported for parametrized SVG files. Color opacity is ignored if the SVG file does not support parametrized fill opacity.

See also

svgFillColor()

setSvgStrokeColor(self, c: Union[QColor, Qt.GlobalColor])

Sets the stroke color used for rendering the SVG content.

Stroke color is only supported for parametrized SVG files. Color opacity is ignored if the SVG file does not support parametrized outline opacity.

See also

svgStrokeColor()

setSvgStrokeWidth(self, w: float)

Sets the stroke width used for rendering the SVG content.

Stroke width is only supported for parametrized SVG files. Units are specified via setSvgStrokeWidthUnit()

See also

svgStrokeWidth()

setSvgStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the pattern’s stroke.

setSvgStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the stroke width.

startRender(self, context: QgsSymbolRenderContext)
stopRender(self, context: QgsSymbolRenderContext)
svgFilePath(self) → str

Returns the path to the SVG file used to render the fill.

See also

setSvgFilePath()

svgFillColor(self) → QColor

Returns the fill color used for rendering the SVG content.

Fill color is only supported for parametrized SVG files.

See also

svgStrokeColor()

svgStrokeColor(self) → QColor

Returns the stroke color used for rendering the SVG content.

Stroke color is only supported for parametrized SVG files.

See also

svgFillColor()

svgStrokeWidth(self) → float

Returns the stroke width used for rendering the SVG content.

Stroke width is only supported for parametrized SVG files. Units are retrieved via setSvgStrokeWidthUnit()

svgStrokeWidthMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the pattern’s stroke.

See also

svgStrokeWidth()

svgStrokeWidthUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the stroke width.

See also

svgStrokeWidth()

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])