Class: QgsSVGFillSymbolLayer¶
- class qgis.core.QgsSVGFillSymbolLayer¶
Bases:
QgsImageFillSymbolLayer
A class for filling symbols with a repeated SVG file.
QgsSVGFillSymbolLayer(svgFilePath: str, width: float = 20, rotation: float = 0) 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.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
.- param context:
- param context:
- rtype:
bool
- rtype:
str
- rtype:
QgsMapUnitScale
- rtype:
QgsUnitTypes.RenderUnit
Returns the dynamic SVG parameters
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, Any]
- param points:
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 dynamic SVG parameters
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.- param symbol:
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:
- rtype:
QgsSymbol
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:
- param context:
- rtype:
bool
- applyBrushTransformFromContext(self, context: QgsSymbolRenderContext = None) 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, Any] = {}) 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:
- dxfColor(self, context: QgsSymbolRenderContext) QColor ¶
- Parameters:
context (QgsSymbolRenderContext) –
- Return type:
QColor
- estimateMaxBleed(self, context: QgsRenderContext) float ¶
- Parameters:
context (QgsRenderContext) –
- Return type:
float
- hasDataDefinedProperties(self) bool ¶
- Return type:
bool
- layerType(self) str ¶
- Return type:
str
- mapUnitScale(self) QgsMapUnitScale ¶
- Return type:
- outputUnit(self) QgsUnitTypes.RenderUnit ¶
- Return type:
- parameters(self) Dict[str, QgsProperty] ¶
Returns the dynamic SVG parameters
New in version 3.18.
- Return type:
Dict[str, QgsProperty]
- 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, Any] ¶
- Return type:
Dict[str, Any]
- renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)¶
- Parameters:
points (QPolygonF) –
rings (Iterable[QPolygonF]) –
context (QgsSymbolRenderContext) –
- resolvePaths(properties: Dict[str, Any], 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, Any])¶
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) –
- setParameters(self, parameters: Dict[str, QgsProperty])¶
Sets the dynamic SVG parameters
New in version 3.18.
- Parameters:
parameters (Dict[str) –
- 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: QColor | Qt.GlobalColor | QGradient)¶
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: QColor | Qt.GlobalColor | QGradient)¶
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, Any])¶
- Parameters:
doc (QDomDocument) –
element (QDomElement) –
props (Dict[str) –
- usedAttributes(self, context: QgsRenderContext) Set[str] ¶
- Parameters:
context (QgsRenderContext) –
- Return type:
Set[str]
- usesMapUnits(self) bool ¶
- Return type:
bool