Class: QgsSvgMarkerSymbolLayer¶
- class qgis.core.QgsSvgMarkerSymbolLayer(path: str, size: float = DEFAULT_SVGMARKER_SIZE, angle: float = DEFAULT_SVGMARKER_ANGLE, scaleMethod: Qgis.ScaleMethod = DEFAULT_SCALE_METHOD)¶
Bases:
QgsMarkerSymbolLayer
Constructs SVG marker symbol layer with picture from given absolute path to a SVG file
Methods
- param point
Calculates the marker aspect ratio between width and height.
- rtype
QgsSvgMarkerSymbolLayer
Copies all data defined properties of this layer to another symbol layer.
Copies paint effect of this layer to another symbol layer
Creates the symbol
- param element
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
- rtype
QColor
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
- rtype
str
- rtype
QgsMapUnitScale
Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.
Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.
- rtype
QgsUnitTypes.RenderUnit
Returns the dynamic SVG parameters
Returns the marker SVG path.
- param context
Returns the preserved aspect ratio value,
True
if fixed aspect ratio has been lower or equal to 0.- rtype
Dict[str, Any]
- param point
Turns relative paths in properties map to absolute when reading and vice versa when writing.
Restores older data defined properties from string map.
- param color
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
- param scale
- param unit
Sets the dynamic SVG parameters
Set the marker SVG path.
Set preserved the marker aspect ratio between width and height.
- param c
- param w
- param scale
Sets the units for the stroke width.
- param context
- param context
- rtype
QColor
- rtype
float
- rtype
QgsMapUnitScale
Returns the units for the stroke width.
Calculates the default marker aspect ratio between width and height.
- param context
- rtype
bool
- param e
- param doc
- bounds(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext) QRectF ¶
- Parameters
point (Union[QPointF) –
context (QgsSymbolRenderContext) –
- Return type
QRectF
- calculateAspectRatio(self, context: QgsSymbolRenderContext, scaledSize: float) Tuple[float, bool] ¶
Calculates the marker aspect ratio between width and height.
- Parameters
context (QgsSymbolRenderContext) – symbol render context
scaledSize (float) – size of symbol to render
hasDataDefinedAspectRatio – will be set to
True
if marker has data defined aspectRatio
- Return type
Tuple[float, bool]
- clone(self) QgsSvgMarkerSymbolLayer ¶
- 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 the symbol
- Parameters
properties (Dict[str) –
- Return type
- createFromSld(element: QDomElement) QgsSymbolLayer ¶
- Parameters
element (QDomElement) –
- Return type
- defaultAspectRatio(self) float ¶
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
See also
- Return type
float
- fillColor(self) QColor ¶
- Return type
QColor
- fixedAspectRatio(self) float ¶
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
- Return type
float
- layerType(self) str ¶
- Return type
str
- mapUnitScale(self) QgsMapUnitScale ¶
- Return type
- markerOffset(self, context: QgsSymbolRenderContext) Tuple[float, float] ¶
Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.
- Parameters
context – symbol render context
offsetX – will be set to required horizontal offset (in painter units)
offsetY – will be set to required vertical offset (in painter units)
- markerOffset2(self, context: QgsSymbolRenderContext, width: float, height: float, widthUnit: QgsUnitTypes.RenderUnit, heightUnit: QgsUnitTypes.RenderUnit, widthMapUnitScale: QgsMapUnitScale, heightMapUnitScale: QgsMapUnitScale) Tuple[float, float] ¶
Note
available in Python bindings as markerOffset2
- markerOffsetWithWidthAndHeight(self, context: QgsSymbolRenderContext, width: float, height: float) Tuple[float, float] ¶
Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.
- Parameters
context – symbol render context
width – marker width
height – marker height
offsetX – will be set to required horizontal offset (in painter units)
offsetY – will be set to required vertical offset (in painter units)
Note
available in Python as markerOffsetWithWidthAndHeight
- 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]
- prepareExpressions(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- preservedAspectRatio(self) bool ¶
Returns the preserved aspect ratio value,
True
if fixed aspect ratio has been lower or equal to 0.See also
- Return type
bool
- properties(self) Dict[str, Any] ¶
- Return type
Dict[str, Any]
- renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)¶
- Parameters
point (Union[QPointF) –
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.
- setFillColor(self, color: Union[QColor, Qt.GlobalColor])¶
- Parameters
color (Union[QColor) –
- setFixedAspectRatio(self, ratio: float)¶
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
- 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) –
- setPreservedAspectRatio(self, par: bool) bool ¶
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
- setStrokeColor(self, c: Union[QColor, Qt.GlobalColor])¶
- Parameters
c (Union[QColor) –
- setStrokeWidth(self, w: float)¶
- Parameters
w (float) –
- setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)¶
- Parameters
scale (QgsMapUnitScale) –
- setStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the units for the stroke width.
- Parameters
unit (QgsUnitTypes.RenderUnit) – width units
See also
- startRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- stopRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- strokeColor(self) QColor ¶
- Return type
QColor
- strokeWidth(self) float ¶
- Return type
float
- strokeWidthMapUnitScale(self) QgsMapUnitScale ¶
- Return type
- strokeWidthUnit(self) QgsUnitTypes.RenderUnit ¶
Returns the units for the stroke width.
See also
- Return type
- updateDefaultAspectRatio(self) float ¶
Calculates the default marker aspect ratio between width and height.
- Return type
float
- Returns
the default aspect ratio value
See also
- usedAttributes(self, context: QgsRenderContext) Set[str] ¶
- Parameters
context (QgsRenderContext) –
- Return type
Set[str]
- usesMapUnits(self) bool ¶
- Return type
bool
- writeDxf(self, e: QgsDxfExport, mmMapUnitScaleFactor: float, layerName: str, context: QgsSymbolRenderContext, shift: Union[QPointF, QPoint] = QPointF(0, 0)) bool ¶
- Parameters
e (QgsDxfExport) –
mmMapUnitScaleFactor (float) –
layerName (str) –
context (QgsSymbolRenderContext) –
shift (Union[QPointF) –
- Return type
bool
- writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any])¶
- Parameters
doc (QDomDocument) –
element (QDomElement) –
props (Dict[str) –