Class: QgsRasterMarkerSymbolLayer¶
- class qgis.core.QgsRasterMarkerSymbolLayer(path: str = '', size: float = DEFAULT_SVGMARKER_SIZE, angle: float = DEFAULT_SVGMARKER_ANGLE, scaleMethod: QgsSymbol.ScaleMethod = DEFAULT_SCALE_METHOD)¶
Bases:
QgsMarkerSymbolLayer
Constructs raster marker symbol layer with picture from given absolute path to a raster image file
Raster marker symbol layer class.
Methods
- param point
Calculates the marker aspect ratio between width and height.
- rtype
QgsRasterMarkerSymbolLayer
Copies all data defined properties of this layer to another symbol layer.
Copies paint effect of this layer to another symbol layer
Creates a raster marker symbol layer from a string map of properties.
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
- 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.
Returns the marker opacity.
Returns the marker raster image path.
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.
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
Set the marker opacity.
Set the marker raster image path.
Set preserved the marker aspect ratio between width and height.
Calculates the default marker aspect ratio between width and height.
- rtype
bool
- 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) → QgsRasterMarkerSymbolLayer¶
- 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 raster marker symbol layer from a string map of properties.
- Parameters
properties (Dict[str) – QVariantMap properties object
- 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
- 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
- opacity(self) → float¶
Returns the marker opacity.
- Return type
float
- Returns
opacity value between 0 (fully transparent) and 1 (fully opaque)
See also
- 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.
- 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) –
- setOpacity(self, opacity: float)¶
Set the marker opacity.
- Parameters
opacity (float) – opacity value between 0 (fully transparent) and 1 (fully opaque)
See also
- setPath(self, path: str)¶
Set the marker raster image path.
- Parameters
path (str) – raster image path
See also
- 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
- updateDefaultAspectRatio(self) → float¶
Calculates the default marker aspect ratio between width and height.
- Return type
float
- Returns
the default aspect ratio value
See also
- usesMapUnits(self) → bool¶
- Return type
bool