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.

Parameters
  • pointCount (int = 10) –

  • method (QgsRandomMarkerFillSymbolLayer.CountMethod = QgsRandomMarkerFillSymbolLayer.AbsoluteCount) –

  • densityArea (float = 250) –

  • seed

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()
copyPaintEffect()
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()
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]