Class: QgsSvgMarkerSymbolLayer¶
A marker symbol layer which renders an SVG graphic.
Class Hierarchy¶
Base classes¶
Abstract base class for marker symbol layers. |
|
Abstract base class for symbol layers. |
Methods
Calculates the marker aspect ratio between width and height. |
|
Returns the default marker aspect ratio between width and height, 0 if not yet calculated. |
|
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering |
|
Returns the dynamic SVG parameters |
|
Returns the marker SVG path. |
|
Returns the preserved aspect ratio value, |
|
Set the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering |
|
Sets the dynamic SVG parameters |
|
Set the marker SVG path. |
|
Set preserved the marker aspect ratio between width and height. |
|
Sets the units for the stroke width. |
|
Returns the units for the stroke width. |
|
Calculates the default marker aspect ratio between width and height. |
Static Methods
Creates the symbol |
|
Turns relative paths in properties map to absolute when reading and vice versa when writing. |
- class qgis.core.QgsSvgMarkerSymbolLayer[source]¶
Bases:
QgsMarkerSymbolLayer
- __init__(path: str | None, size: float = DEFAULT_SVGMARKER_SIZE, angle: float = DEFAULT_SVGMARKER_ANGLE, scaleMethod: Qgis.ScaleMethod = DEFAULT_SCALE_METHOD)
Constructs SVG marker symbol layer with picture from given absolute path to a SVG file
- Parameters:
path (Optional[str])
size (float = DEFAULT_SVGMARKER_SIZE)
angle (float = DEFAULT_SVGMARKER_ANGLE)
scaleMethod (Qgis.ScaleMethod = DEFAULT_SCALE_METHOD)
- calculateAspectRatio(self, context: QgsSymbolRenderContext, scaledSize: float)[source]¶
Calculates the marker aspect ratio between width and height.
- Parameters:
context (QgsSymbolRenderContext) – symbol render context
scaledSize (float) -> (float) – size of symbol to render
hasDataDefinedAspectRatio – will be set to
True
if marker has data defined aspectRatio
- static create(properties: Dict[str, Any] = {}) QgsSymbolLayer | None [source]¶
Creates the symbol
- Parameters:
properties (Dict[str, Any] = {})
- Return type:
Optional[QgsSymbolLayer]
- static createFromSld(element: QDomElement) QgsSymbolLayer | None [source]¶
- Parameters:
element (QDomElement)
- Return type:
Optional[QgsSymbolLayer]
- defaultAspectRatio(self) float [source]¶
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
See also
- Return type:
float
- fixedAspectRatio(self) float [source]¶
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering
See also
See also
- Return type:
float
- parameters(self) Dict[str, QgsProperty] ¶
Returns the dynamic SVG parameters
Added in version 3.18.
- Return type:
Dict[str, QgsProperty]
- preservedAspectRatio(self) bool [source]¶
Returns the preserved aspect ratio value,
True
if fixed aspect ratio has been lower or equal to 0.See also
- Return type:
bool
- static resolvePaths(properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)[source]¶
Turns relative paths in properties map to absolute when reading and vice versa when writing. Used internally when reading/writing symbols.
- Parameters:
properties (Dict[str, Any])
pathResolver (QgsPathResolver)
saving (bool)
- setFixedAspectRatio(self, ratio: float)[source]¶
Set the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering
- Parameters:
ratio (float) – Fixed Aspect Ratio
See also
See also
- setParameters(self, parameters: Dict[str | None, QgsProperty])[source]¶
Sets the dynamic SVG parameters
Added in version 3.18.
- Parameters:
parameters (Dict[Optional[str], QgsProperty])
- setPath(self, path: str | None)[source]¶
Set the marker SVG path.
- Parameters:
path (Optional[str]) – SVG path
See also
- setPreservedAspectRatio(self, par: bool) bool [source]¶
Set preserved the marker aspect ratio between width and height.
- Parameters:
par (bool) – Preserved Aspect Ratio
- Return type:
bool
- Returns:
the preserved aspect ratio value,
True
if fixed aspect ratio has been lower or equal to 0
See also
- setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)[source]¶
- Parameters:
scale (QgsMapUnitScale)
- setStrokeWidthUnit(self, unit: Qgis.RenderUnit)[source]¶
Sets the units for the stroke width.
- Parameters:
unit (Qgis.RenderUnit) – width units
See also
- strokeWidthMapUnitScale(self) QgsMapUnitScale ¶
- Return type:
- strokeWidthUnit(self) Qgis.RenderUnit [source]¶
Returns the units for the stroke width.
See also
- Return type: