Class: QgsSVGFillSymbolLayer¶
- class qgis.core.QgsSVGFillSymbolLayer(svgFilePath: str, width: float = 20, rotation: float = 0)¶
Bases:
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
Returns
True
if the image brush should be transformed using the render context's texture origin.- param context
- rtype
QgsSVGFillSymbolLayer
Copies all data defined properties of this layer to another symbol layer.
Copies paint effect of this layer to another symbol layer
Creates a new
QgsSVGFillSymbolLayer
from aproperties
map.Creates a new
QgsSVGFillSymbolLayer
from a SLDelement
.- rtype
str
- rtype
QgsMapUnitScale
- rtype
QgsUnitTypes.RenderUnit
Returns the width of the rendered SVG content within the fill (i.e.
Returns the map unit scale for the pattern's width.
Returns the units for the width of the SVG images in the pattern.
- rtype
Dict[str, str]
Turns relative paths in properties map to absolute when reading and vice versa when writing.
Restores older data defined properties from string map.
- param scale
- param unit
Sets the
width
to render the SVG content as within the fill (i.e.Sets the map unit
scale
for the pattern's width.Sets the
unit
for the width of the SVG images in the pattern.Sets the path to the SVG file to render in the fill.
Sets the fill color used for rendering the SVG content.
Sets the stroke color used for rendering the SVG content.
Sets the stroke width used for rendering the SVG content.
Sets the map unit
scale
for the pattern's stroke.Sets the
unit
for the stroke width.- param context
- param context
Returns the path to the SVG file used to render the fill.
Returns the fill color used for rendering the SVG content.
Returns the stroke color used for rendering the SVG content.
Returns the stroke width used for rendering the SVG content.
Returns the map unit scale for the pattern's stroke.
Returns the units for the stroke width.
- param doc
- rtype
bool
- applyBrushTransformFromContext(self) bool ¶
Returns
True
if the image brush should be transformed using the render context’s texture origin.New in version 3.16.
- applyDataDefinedSettings(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- clone(self) QgsSVGFillSymbolLayer ¶
- Return type
- copyDataDefinedProperties(self, destLayer: QgsSymbolLayer)¶
Copies all data defined properties of this layer to another symbol layer.
- Parameters
destLayer – destination layer
- copyPaintEffect(self, destLayer: QgsSymbolLayer)¶
Copies paint effect of this layer to another symbol layer
- Parameters
destLayer – destination layer
New in version 2.9.
- create(properties: Dict[str, str] = {}) QgsSymbolLayer ¶
Creates a new
QgsSVGFillSymbolLayer
from aproperties
map. The caller takes ownership of the returned object.- Parameters
properties (Dict[str) –
- Return type
- createFromSld(element: QDomElement) QgsSymbolLayer ¶
Creates a new
QgsSVGFillSymbolLayer
from a SLDelement
. The caller takes ownership of the returned object.- Parameters
element (QDomElement) –
- Return type
- layerType(self) str ¶
- Return type
str
- mapUnitScale(self) QgsMapUnitScale ¶
- Return type
- outputUnit(self) QgsUnitTypes.RenderUnit ¶
- Return type
- 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()
See also
See also
See also
- Return type
float
- patternWidthMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the pattern’s width.
See also
See also
See also
- Return type
- patternWidthUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the width of the SVG images in the pattern.
See also
See also
See also
- Return type
- properties(self) Dict[str, str] ¶
- Return type
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.
- Parameters
properties (Dict[str) –
pathResolver (QgsPathResolver) –
saving (bool) –
- restoreOldDataDefinedProperties(self, stringMap: Dict[str, str])¶
Restores older data defined properties from string map.
New in version 3.0.
- setMapUnitScale(self, scale: QgsMapUnitScale)¶
- Parameters
scale (QgsMapUnitScale) –
- setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)¶
- Parameters
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
See also
See also
- Parameters
width (float) –
- setPatternWidthMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the pattern’s width.See also
See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setPatternWidthUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the width of the SVG images in the pattern.See also
See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- 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
- Parameters
svgPath (str) –
- 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
See also
- Parameters
c (Union[QColor) –
- 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
See also
- Parameters
c (Union[QColor) –
- 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
See also
See also
- Parameters
w (float) –
- setSvgStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the pattern’s stroke.See also
See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setSvgStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the stroke width.See also
See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- startRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- stopRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- svgFilePath(self) str ¶
Returns the path to the SVG file used to render the fill.
See also
- Return type
str
- svgFillColor(self) QColor ¶
Returns the fill color used for rendering the SVG content.
Fill color is only supported for parametrized SVG files.
See also
See also
- Return type
QColor
- svgStrokeColor(self) QColor ¶
Returns the stroke color used for rendering the SVG content.
Stroke color is only supported for parametrized SVG files.
See also
See also
- Return type
QColor
- 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()
See also
See also
See also
- Return type
float
- svgStrokeWidthMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the pattern’s stroke.
See also
See also
See also
- Return type
- svgStrokeWidthUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the stroke width.
See also
See also
See also
- Return type
- toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])¶
- Parameters
doc (QDomDocument) –
element (QDomElement) –
props (Dict[str) –
- usesMapUnits(self) bool ¶
- Return type
bool