Class: QgsShapeburstFillSymbolLayer

A fill symbol layer which applies a gradient from the outer edges of a symbol to the inside.

Class Hierarchy

Inheritance diagram of qgis.core.QgsShapeburstFillSymbolLayer

Base classes

QgsFillSymbolLayer

Abstract base class for fill symbol layers.

QgsSymbolLayer

Abstract base class for symbol layers.

Enums

ShapeburstColorType

alias of GradientColorSource

Methods

blurRadius

Returns the blur radius, which controls the amount of blurring applied to the fill.

color2

Returns the color used for the endpoint of the shapeburst fill.

colorRamp

Returns the color ramp used for the shapeburst fill.

colorType

Returns the color mode used for the shapeburst fill.

distanceMapUnitScale

distanceUnit

Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary.

ignoreRings

Returns whether the shapeburst fill is set to ignore polygon interior rings.

maxDistance

Returns the maximum distance from the shape's boundary which is shaded.

offset

Returns the offset for the shapeburst fill.

offsetMapUnitScale

offsetUnit

Returns the units used for the offset of the shapeburst fill.

setBlurRadius

Sets the blur radius, which controls the amount of blurring applied to the fill.

setColor2

Sets the color for the endpoint of the shapeburst fill.

setColorRamp

Sets the color ramp used to draw the shapeburst fill.

setColorType

Sets the color mode to use for the shapeburst fill.

setDistanceMapUnitScale

setDistanceUnit

Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary.

setIgnoreRings

Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading.

setMaxDistance

Sets the maximum distance to shape inside of the shape from the polygon's boundary.

setOffset

Sets the offset for the shapeburst fill.

setOffsetMapUnitScale

setOffsetUnit

Sets the units used for the offset for the shapeburst fill.

setUseWholeShape

Sets whether the shapeburst fill should be drawn using the entire shape.

useWholeShape

Returns whether the shapeburst fill is set to cover the entire shape.

Static Methods

create

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

class qgis.core.QgsShapeburstFillSymbolLayer[source]

Bases: QgsFillSymbolLayer

__init__(color: QColor | Qt.GlobalColor = DEFAULT_SIMPLEFILL_COLOR, color2: QColor | Qt.GlobalColor = Qt.white, colorType: Qgis.GradientColorSource = Qgis.GradientColorSource.SimpleTwoColor, blurRadius: int = 0, useWholeShape: bool = True, maxDistance: float = 5)

Constructor for QgsShapeburstFillSymbolLayer.

Parameters:
  • color (Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEFILL_COLOR)

  • color2 (Union[QColor, Qt.GlobalColor] = Qt.white)

  • colorType (Qgis.GradientColorSource = Qgis.GradientColorSource.SimpleTwoColor)

  • blurRadius (int = 0)

  • useWholeShape (bool = True)

  • maxDistance (float = 5)

ShapeburstColorType

alias of GradientColorSource

blurRadius(self) int[source]

Returns the blur radius, which controls the amount of blurring applied to the fill.

Return type:

int

Returns:

Integer representing the radius for fill blur. Higher values indicate a stronger blur. A 0 value indicates that blurring is disabled.

See also

setBlurRadius()

color2(self) QColor[source]

Returns the color used for the endpoint of the shapeburst fill. This color is only used if the colorType is set to ShapeburstColorType.SimpleTwoColor

Return type:

QColor

Returns:

a QColor indicating the color of the endpoint of the gradient

See also

setColor2()

See also

colorType()

colorRamp(self) QgsColorRamp | None[source]

Returns the color ramp used for the shapeburst fill. The color ramp is only used if the colorType is set to ShapeburstColorType.ColorRamp

Return type:

Optional[QgsColorRamp]

Returns:

a QgsColorRamp color ramp

See also

setColorRamp()

See also

colorType()

colorType(self) Qgis.GradientColorSource[source]

Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp or by simply specificing a start and end color.

Return type:

Qgis.GradientColorSource

Returns:

current color mode used for the shapeburst fill

See also

setColorType()

See also

color()

See also

color2()

See also

colorRamp()

static create(properties: Dict[str, Any] = {}) QgsSymbolLayer | None[source]

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

Caller takes ownership of the returned symbol layer.

Parameters:

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

Return type:

Optional[QgsSymbolLayer]

distanceMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

distanceUnit(self) Qgis.RenderUnit[source]

Returns the unit for the maximum distance to shade inside of the shape from the polygon’s boundary.

Return type:

Qgis.RenderUnit

Returns:

distance unit for the maximum distance

See also

maxDistance()

ignoreRings(self) bool[source]

Returns whether the shapeburst fill is set to ignore polygon interior rings.

Return type:

bool

Returns:

True if the shapeburst fill will ignore interior rings when calculating buffered shading.

See also

setIgnoreRings()

maxDistance(self) float[source]

Returns the maximum distance from the shape’s boundary which is shaded. This parameter is only effective if useWholeShape is False.

Return type:

float

Returns:

the maximum distance from the polygon’s boundary which is shaded. Distance units are indicated by distanceUnit.

See also

useWholeShape()

See also

setMaxDistance()

See also

distanceUnit()

offset(self) QPointF[source]

Returns the offset for the shapeburst fill.

Return type:

QPointF

Returns:

a QPointF indicating the horizontal/vertical offset amount

See also

setOffset()

See also

offsetUnit()

offsetMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

offsetUnit(self) Qgis.RenderUnit[source]

Returns the units used for the offset of the shapeburst fill.

Return type:

Qgis.RenderUnit

Returns:

units used for the fill offset

See also

offset()

See also

setOffsetUnit()

setBlurRadius(self, blurRadius: int)[source]

Sets the blur radius, which controls the amount of blurring applied to the fill.

Parameters:

blurRadius (int) – Radius for fill blur. Values between 0 - 17 are valid, where higher values results in a stronger blur. Set to 0 to disable blur.

See also

blurRadius()

setColor2(self, color2: QColor | Qt.GlobalColor)[source]

Sets the color for the endpoint of the shapeburst fill. This color is only used if setColorType is set ShapeburstColorType.SimpleTwoColor.

Parameters:

color2 (Union[QColor, Qt.GlobalColor]) – QColor to use for endpoint of gradient

See also

setColorType()

See also

color2()

setColorRamp(self, ramp: QgsColorRamp | None)[source]

Sets the color ramp used to draw the shapeburst fill. Color ramps are only used if setColorType is set ShapeburstColorType.ColorRamp.

Ownership of ramp is transferred to the fill.

See also

setColorType()

See also

colorRamp()

Parameters:

ramp (Optional[QgsColorRamp])

setColorType(self, colorType: Qgis.GradientColorSource)[source]

Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp or by simply specificing a start and end color. setColorType is used to specify which mode to use for the fill.

Parameters:

colorType (Qgis.GradientColorSource) – color type to use for shapeburst fill

See also

colorType()

See also

setColor()

See also

setColor2()

See also

setColorRamp()

setDistanceMapUnitScale(self, scale: QgsMapUnitScale)[source]
Parameters:

scale (QgsMapUnitScale)

setDistanceUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the maximum distance to shade inside of the shape from the polygon’s boundary.

Parameters:

unit (Qgis.RenderUnit) – distance unit for the maximum distance

See also

setMaxDistance()

See also

distanceUnit()

setIgnoreRings(self, ignoreRings: bool)[source]

Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading.

Parameters:

ignoreRings (bool) – Set to True if buffers should ignore interior rings for polygons.

See also

ignoreRings()

setMaxDistance(self, maxDistance: float)[source]

Sets the maximum distance to shape inside of the shape from the polygon’s boundary.

Parameters:

maxDistance (float) – distance from boundary to shade. setUseWholeShape must be set to False for this parameter to take effect. Distance unit is controlled by setDistanceUnit.

See also

maxDistance()

setOffset(self, offset: QPointF | QPoint)[source]

Sets the offset for the shapeburst fill.

Parameters:

offset (Union[QPointF, QPoint]) – QPointF indicating the horizontal/vertical offset amount

See also

offset()

See also

setOffsetUnit()

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)[source]
Parameters:

scale (QgsMapUnitScale)

setOffsetUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units used for the offset for the shapeburst fill.

Parameters:

unit (Qgis.RenderUnit) – units for fill offset

See also

setOffset()

See also

offsetUnit()

setUseWholeShape(self, useWholeShape: bool)[source]

Sets whether the shapeburst fill should be drawn using the entire shape.

Parameters:

useWholeShape (bool) – Set to True if shapeburst should cover entire shape. If False, setMaxDistance is used to calculate how far from the boundary of the shape should be shaded

See also

useWholeShape()

See also

setMaxDistance()

useWholeShape(self) bool[source]

Returns whether the shapeburst fill is set to cover the entire shape.

Return type:

bool

Returns:

True if shapeburst fill will cover the entire shape. If False, shapeburst is drawn to a distance of maxDistance from the polygon’s boundary.

See also

maxDistance()