Class: QgsRandomMarkerFillSymbolLayer

class qgis.core.QgsRandomMarkerFillSymbolLayer

Bases: QgsFillSymbolLayer

A fill symbol layer which places markers at random locations within polygons.

New in version 3.12.

QgsRandomMarkerFillSymbolLayer(pointCount: int = 10, method: Qgis.PointCountMethod = Qgis.PointCountMethod.Absolute, densityArea: float = 250, seed: int = 0) Constructor for QgsRandomMarkerFillSymbolLayer, with the specified pointCount.

Optionally a specific random number seed can be used when generating points. A seed of 0 indicates that a truly random sequence will be used on every rendering, causing points to appear in different locations with every map refresh.

Enums

CountMethod

alias of PointCountMethod

Methods

canCauseArtifactsBetweenAdjacentTiles

rtype:

bool

clipPoints

Returns True if point markers should be clipped to the polygon boundary.

clone

rtype:

QgsRandomMarkerFillSymbolLayer

color

rtype:

QColor

copyDataDefinedProperties

Copies all data defined properties of this layer to another symbol layer.

copyPaintEffect

Copies paint effect of this layer to another symbol layer

countMethod

Returns the count method used to randomly fill the polygon.

create

Creates a new QgsRandomMarkerFillSymbolLayer using the specified properties map containing symbol properties (see properties()).

densityArea

Returns the density area used to count the number of points to randomly fill the polygon.

densityAreaUnit

Returns the units for the density area.

densityAreaUnitScale

Returns the map scale for the density area.

hasDataDefinedProperties

rtype:

bool

installMasks

When rendering, install masks on context painter if recursive is True masks are installed recursively for all children symbol layers

layerType

rtype:

str

mapUnitScale

rtype:

QgsMapUnitScale

outputUnit

rtype:

Qgis.RenderUnit

pointCount

Returns the count of random points to render in the fill.

properties

rtype:

Dict[str, Any]

removeMasks

When rendering, remove previously installed masks from context painter if recursive is True masks are removed recursively for all children symbol layers

renderPolygon

param points:

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

seed

Returns the random number seed to use when generating points, or 0 if a truly random sequence will be used (causing points to appear in different locations with every map refresh).

setClipPoints

Sets whether point markers should be clipped to the polygon boundary.

setColor

param color:

setCountMethod

Sets the count method used to randomly fill the polygon.

setDensityArea

Sets the density area used to count the number of points to randomly fill the polygon.

setDensityAreaUnit

Sets the units for the density area.

setDensityAreaUnitScale

Sets the map scale for the density area.

setMapUnitScale

param scale:

setOutputUnit

param unit:

setPointCount

Sets the count of random points to render in the fill.

setSeed

Sets the random number seed to use when generating points, or 0 if a truly random sequence will be used on every rendering (causing points to appear in different locations with every map refresh).

setSubSymbol

param symbol:

shouldRenderUsingSelectionColor

Returns True if the symbol layer should be rendered using the selection color from the render context.

startFeatureRender

param feature:

startRender

param context:

stopFeatureRender

param feature:

stopRender

param context:

subSymbol

rtype:

QgsSymbol

usedAttributes

param context:

usesMapUnits

rtype:

bool

CountMethod

alias of PointCountMethod

canCauseArtifactsBetweenAdjacentTiles(self) bool
Return type:

bool

clipPoints(self) bool

Returns True if point markers should be clipped to the polygon boundary.

See also

setClipPoints()

Return type:

bool

clone(self) QgsRandomMarkerFillSymbolLayer
Return type:

QgsRandomMarkerFillSymbolLayer

color(self) QColor
Return type:

QColor

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

countMethod(self) Qgis.PointCountMethod

Returns the count method used to randomly fill the polygon.

See also

setCountMethod()

Return type:

Qgis.PointCountMethod

create(properties: Dict[str, Any] = {}) QgsSymbolLayer

Creates a new QgsRandomMarkerFillSymbolLayer using the specified properties map containing symbol properties (see properties()).

Caller takes ownership of the returned symbol layer.

Parameters:

properties (Dict[str) –

Return type:

QgsSymbolLayer

densityArea(self) float

Returns the density area used to count the number of points to randomly fill the polygon.

Only used when the count method is set to QgsRandomMarkerFillSymbolLayer.DensityBasedCount.

Units are specified by setDensityAreaUnit().

See also

setDensityArea()

Return type:

float

densityAreaUnit(self) Qgis.RenderUnit

Returns the units for the density area.

Return type:

Qgis.RenderUnit

densityAreaUnitScale(self) QgsMapUnitScale

Returns the map scale for the density area.

See also

densityArea()

Return type:

QgsMapUnitScale

hasDataDefinedProperties(self) bool
Return type:

bool

installMasks(self, context: QgsRenderContext, recursive: bool)

When rendering, install masks on context painter if recursive is True masks are installed recursively for all children symbol layers

See also

prepareMasks()

See also

removeMasks()

New in version 3.30.

layerType(self) str
Return type:

str

mapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

outputUnit(self) Qgis.RenderUnit
Return type:

Qgis.RenderUnit

pointCount(self) int

Returns the count of random points to render in the fill.

See also

setPointCount()

Return type:

int

properties(self) Dict[str, Any]
Return type:

Dict[str, Any]

removeMasks(self, context: QgsRenderContext, recursive: bool)

When rendering, remove previously installed masks from context painter if recursive is True masks are removed recursively for all children symbol layers

See also

prepareMasks()

See also

installMasks()

New in version 3.30.

renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)
Parameters:
restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])

Restores older data defined properties from string map.

seed(self) int

Returns the random number seed to use when generating points, or 0 if a truly random sequence will be used (causing points to appear in different locations with every map refresh).

See also

setSeed()

Return type:

int

setClipPoints(self, clipped: bool)

Sets whether point markers should be clipped to the polygon boundary.

See also

clipPoints()

Parameters:

clipped (bool) –

setColor(self, color: QColor | Qt.GlobalColor | QGradient)
Parameters:

color (Union[QColor) –

setCountMethod(self, method: Qgis.PointCountMethod)

Sets the count method used to randomly fill the polygon.

See also

countMethod()

Parameters:

method (Qgis.PointCountMethod) –

setDensityArea(self, area: float)

Sets the density area used to count the number of points to randomly fill the polygon.

See also

densityArea()

Parameters:

area (float) –

setDensityAreaUnit(self, unit: Qgis.RenderUnit)

Sets the units for the density area.

Parameters:

unit (Qgis.RenderUnit) – width units

setDensityAreaUnitScale(self, scale: QgsMapUnitScale)

Sets the map scale for the density area.

Parameters:

scale (QgsMapUnitScale) – density area map unit scale

See also

setDensityArea()

setMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setOutputUnit(self, unit: Qgis.RenderUnit)
Parameters:

unit (Qgis.RenderUnit) –

setPointCount(self, count: int)

Sets the count of random points to render in the fill.

See also

pointCount()

Parameters:

count (int) –

setSeed(self, seed: int)

Sets the random number seed to use when generating points, or 0 if a truly random sequence will be used on every rendering (causing points to appear in different locations with every map refresh).

See also

seed()

Parameters:

seed (int) –

setSubSymbol(self, symbol: QgsSymbol) bool
Parameters:

symbol (QgsSymbol) –

Return type:

bool

shouldRenderUsingSelectionColor(self, context: QgsSymbolRenderContext) bool

Returns True if the symbol layer should be rendered using the selection color from the render context.

New in version 3.34.

startFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)
Parameters:
startRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

stopFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)
Parameters:
stopRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

subSymbol(self) QgsSymbol
Return type:

QgsSymbol

usedAttributes(self, context: QgsRenderContext) Set[str]
Parameters:

context (QgsRenderContext) –

Return type:

Set[str]

usesMapUnits(self) bool
Return type:

bool