Class: QgsRandomMarkerFillSymbolLayer

class qgis.core.QgsRandomMarkerFillSymbolLayer(pointCount: int = 10, method: QgsRandomMarkerFillSymbolLayer.CountMethod = QgsRandomMarkerFillSymbolLayer.AbsoluteCount, densityArea: float = 250, seed: int = 0)

Bases: QgsFillSymbolLayer

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.

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

New in version 3.12:

Methods

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

layerType

rtype

str

mapUnitScale

rtype

QgsMapUnitScale

outputUnit

rtype

QgsUnitTypes.RenderUnit

pointCount

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

properties

rtype

Dict[str, str]

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

startFeatureRender

param feature

startRender

param context

stopFeatureRender

param feature

stopRender

param context

subSymbol

rtype

QgsSymbol

usedAttributes

param context

usesMapUnits

rtype

bool

Attributes

AbsoluteCount

DensityBasedCount

AbsoluteCount = 0
class CountMethod

Bases: int

DensityBasedCount = 1
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

New in version 2.9.

countMethod(self) QgsRandomMarkerFillSymbolLayer.CountMethod

Returns the count method used to randomly fill the polygon.

See also

setCountMethod()

Return type

QgsRandomMarkerFillSymbolLayer.CountMethod

create(properties: Dict[str, str] = {}) 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) QgsUnitTypes.RenderUnit

Returns the units for the density area.

Return type

QgsUnitTypes.RenderUnit

densityAreaUnitScale(self) QgsMapUnitScale

Returns the map scale for the density area.

See also

densityArea()

Return type

QgsMapUnitScale

hasDataDefinedProperties(self) bool
Return type

bool

layerType(self) str
Return type

str

mapUnitScale(self) QgsMapUnitScale
Return type

QgsMapUnitScale

outputUnit(self) QgsUnitTypes.RenderUnit
Return type

QgsUnitTypes.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, str]
Return type

Dict[str, str]

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

Restores older data defined properties from string map.

New in version 3.0.

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: Union[QColor, Qt.GlobalColor])
Parameters

color (Union[QColor) –

setCountMethod(self, method: QgsRandomMarkerFillSymbolLayer.CountMethod)

Sets the count method used to randomly fill the polygon.

See also

countMethod()

Parameters

method (QgsRandomMarkerFillSymbolLayer.CountMethod) –

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: QgsUnitTypes.RenderUnit)

Sets the units for the density area.

Parameters

unit (QgsUnitTypes.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: QgsUnitTypes.RenderUnit)
Parameters

unit (QgsUnitTypes.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

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