Class: QgsSvgMarkerSymbolLayer

class qgis.core.QgsSvgMarkerSymbolLayer(path: str, size: float = DEFAULT_SVGMARKER_SIZE, angle: float = DEFAULT_SVGMARKER_ANGLE, scaleMethod: QgsSymbol.ScaleMethod = DEFAULT_SCALE_METHOD)

Bases: qgis._core.QgsMarkerSymbolLayer

Constructs SVG marker symbol layer with picture from given absolute path to a SVG file

QgsSvgMarkerSymbolLayer(QgsSvgMarkerSymbolLayer)

Methods

bounds
calculateAspectRatio Calculates the marker aspect ratio between width and height.
clone
copyDataDefinedProperties
copyPaintEffect
create
createFromSld
defaultAspectRatio Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
fillColor
fixedAspectRatio 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
layerType
mapUnitScale
markerOffset
markerOffset2
markerOffsetWithWidthAndHeight
outputUnit
path Returns the marker SVG path.
preservedAspectRatio Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
properties
renderPoint
resolvePaths Turns relative paths in properties map to absolute when reading and vice versa when writing.
restoreOldDataDefinedProperties
setFillColor
setFixedAspectRatio 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
setMapUnitScale
setOutputUnit
setPath Set the marker SVG path.
setPreservedAspectRatio Set preserved the marker aspect ratio between width and height.
setStrokeColor
setStrokeWidth
setStrokeWidthMapUnitScale
setStrokeWidthUnit Sets the units for the stroke width.
startRender
stopRender
strokeColor
strokeWidth
strokeWidthMapUnitScale
strokeWidthUnit Returns the units for the stroke width.
updateDefaultAspectRatio Calculates the default marker aspect ratio between width and height.
writeDxf
writeSldMarker

Signals

Attributes

bounds(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext) → QRectF
calculateAspectRatio(self, context: QgsSymbolRenderContext, scaledSize: float) → Tuple[float, bool]

Calculates the marker aspect ratio between width and height.

Parameters:
  • context – symbol render context
  • scaledSize – size of symbol to render
  • hasDataDefinedAspectRatio – will be set to true if marker has data defined aspectRatio
clone(self) → QgsSvgMarkerSymbolLayer
copyDataDefinedProperties()
copyPaintEffect()
create(properties: Dict[str, str] = {}) → QgsSymbolLayer
createFromSld(element: QDomElement) → QgsSymbolLayer
defaultAspectRatio(self) → float

Returns the default marker aspect ratio between width and height, 0 if not yet calculated.

fillColor(self) → 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

layerType(self) → str
mapUnitScale(self) → QgsMapUnitScale
markerOffset()
markerOffset2()
markerOffsetWithWidthAndHeight()
outputUnit(self) → QgsUnitTypes.RenderUnit
path(self) → str

Returns the marker SVG path.

See also

setPath()

preservedAspectRatio(self) → bool

Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.

properties(self) → Dict[str, str]
renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)
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()
setFillColor(self, color: Union[QColor, Qt.GlobalColor])
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 – Fixed Aspect Ratio
setMapUnitScale(self, scale: QgsMapUnitScale)
setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
setPath(self, path: str)

Set the marker SVG path.

Parameters:path – SVG path

See also

path()

setPreservedAspectRatio(self, par: bool) → bool

Set preserved the marker aspect ratio between width and height.

Parameters:par – Preserved Aspect Ratio
Returns:the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0
setStrokeColor(self, c: Union[QColor, Qt.GlobalColor])
setStrokeWidth(self, w: float)
setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)
setStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the stroke width.

Parameters:unit – width units
startRender(self, context: QgsSymbolRenderContext)
stopRender(self, context: QgsSymbolRenderContext)
strokeColor(self) → QColor
strokeWidth(self) → float
strokeWidthMapUnitScale(self) → QgsMapUnitScale
strokeWidthUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the stroke width.

updateDefaultAspectRatio(self) → float

Calculates the default marker aspect ratio between width and height.

Returns:the default aspect ratio value
writeDxf(self, e: QgsDxfExport, mmMapUnitScaleFactor: float, layerName: str, context: QgsSymbolRenderContext, shift: Union[QPointF, QPoint] = QPointF(0, 0)) → bool
writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])