Class: QgsGradientFillSymbolLayer¶
- class qgis.core.QgsGradientFillSymbolLayer(color: Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEFILL_COLOR, color2: Union[QColor, Qt.GlobalColor] = Qt.white, gradientColorType: QgsGradientFillSymbolLayer.GradientColorType = QgsGradientFillSymbolLayer.SimpleTwoColor, gradientType: QgsGradientFillSymbolLayer.GradientType = QgsGradientFillSymbolLayer.Linear, coordinateMode: QgsGradientFillSymbolLayer.GradientCoordinateMode = QgsGradientFillSymbolLayer.Feature, gradientSpread: QgsGradientFillSymbolLayer.GradientSpread = QgsGradientFillSymbolLayer.Pad)¶
Bases:
QgsFillSymbolLayer
Methods
- rtype
bool
- rtype
QgsGradientFillSymbolLayer
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor
Returns the color ramp used for the gradient fill.
Coordinate mode for gradient.
Copies all data defined properties of this layer to another symbol layer.
Copies paint effect of this layer to another symbol layer
Creates a new
QgsGradientFillSymbolLayer
using the specifiedproperties
map containing symbol properties (seeproperties()
).- param context
Gradient color mode, controls how gradient color stops are created
Gradient spread mode.
Type of gradient, e.g., linear or radial
- rtype
str
- rtype
QgsMapUnitScale
Returns the offset by which polygons will be translated during rendering.
Returns the map unit scale for the fill’s offset.
Returns the units for the fill’s offset.
- rtype
QgsUnitTypes.RenderUnit
- rtype
Dict[str, Any]
- rtype
QPointF
- rtype
bool
- rtype
QPointF
- rtype
bool
- param points
Restores older data defined properties from string map.
- param color2
Sets the color ramp used for the gradient fill.
- param coordinateMode
- param gradientColorType
- param gradientSpread
- param gradientType
- param scale
Sets an
offset
by which polygons will be translated during rendering.Sets the map unit
scale
for the fill’s offset.Sets the
unit
for the fill’s offset.- param unit
Starting point of gradient fill, in the range [0,0] - [1,1]
Sets the starting point of the gradient to be the feature centroid
End point of gradient fill, in the range [0,0] - [1,1]
Sets the end point of the gradient to be the feature centroid
- param context
- param context
- rtype
bool
Attributes
- ColorRamp = 1¶
- Conical = 2¶
- Feature = 0¶
- class GradientColorType¶
Bases:
int
- class GradientCoordinateMode¶
Bases:
int
- class GradientSpread¶
Bases:
int
- class GradientType¶
Bases:
int
- Linear = 0¶
- Pad = 0¶
- Radial = 1¶
- Reflect = 1¶
- Repeat = 2¶
- SimpleTwoColor = 0¶
- Viewport = 1¶
- canCauseArtifactsBetweenAdjacentTiles(self) → bool¶
- Return type
bool
- clone(self) → QgsGradientFillSymbolLayer¶
- Return type
- color2(self) → QColor¶
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor
- Return type
QColor
- colorRamp(self) → QgsColorRamp¶
Returns the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.
See also
See also
- Return type
- coordinateMode(self) → QgsGradientFillSymbolLayer.GradientCoordinateMode¶
Coordinate mode for gradient. Controls how the gradient stops are positioned.
- 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 new
QgsGradientFillSymbolLayer
using the specifiedproperties
map containing symbol properties (seeproperties()
).Caller takes ownership of the returned symbol layer.
- Parameters
properties (Dict[str) –
- Return type
- estimateMaxBleed(self, context: QgsRenderContext) → float¶
- Parameters
context (QgsRenderContext) –
- Return type
float
- gradientColorType(self) → QgsGradientFillSymbolLayer.GradientColorType¶
Gradient color mode, controls how gradient color stops are created
- Return type
- gradientSpread(self) → QgsGradientFillSymbolLayer.GradientSpread¶
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops
- Return type
- gradientType(self) → QgsGradientFillSymbolLayer.GradientType¶
Type of gradient, e.g., linear or radial
- Return type
- layerType(self) → str¶
- Return type
str
- mapUnitScale(self) → QgsMapUnitScale¶
- Return type
- offset(self) → QPointF¶
Returns the offset by which polygons will be translated during rendering.
Units are specified by
offsetUnit()
.See also
See also
- Return type
QPointF
- offsetMapUnitScale(self) → QgsMapUnitScale¶
Returns the map unit scale for the fill’s offset.
See also
See also
- Return type
- offsetUnit(self) → QgsUnitTypes.RenderUnit¶
Returns the units for the fill’s offset.
See also
See also
- Return type
- outputUnit(self) → QgsUnitTypes.RenderUnit¶
- Return type
- properties(self) → Dict[str, Any]¶
- Return type
Dict[str, Any]
- referencePoint1(self) → QPointF¶
- Return type
QPointF
- referencePoint1IsCentroid(self) → bool¶
- Return type
bool
- referencePoint2(self) → QPointF¶
- Return type
QPointF
- referencePoint2IsCentroid(self) → bool¶
- Return type
bool
- renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)¶
- Parameters
points (QPolygonF) –
rings (Iterable[QPolygonF]) –
context (QgsSymbolRenderContext) –
- restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])¶
Restores older data defined properties from string map.
New in version 3.0.
- setColor2(self, color2: Union[QColor, Qt.GlobalColor])¶
- Parameters
color2 (Union[QColor) –
- setColorRamp(self, ramp: QgsColorRamp)¶
Sets the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.
- Parameters
ramp (QgsColorRamp) – color ramp. Ownership is transferred.
See also
See also
- setCoordinateMode(self, coordinateMode: QgsGradientFillSymbolLayer.GradientCoordinateMode)¶
- Parameters
coordinateMode (QgsGradientFillSymbolLayer.GradientCoordinateMode) –
- setGradientColorType(self, gradientColorType: QgsGradientFillSymbolLayer.GradientColorType)¶
- Parameters
gradientColorType (QgsGradientFillSymbolLayer.GradientColorType) –
- setGradientSpread(self, gradientSpread: QgsGradientFillSymbolLayer.GradientSpread)¶
- Parameters
gradientSpread (QgsGradientFillSymbolLayer.GradientSpread) –
- setGradientType(self, gradientType: QgsGradientFillSymbolLayer.GradientType)¶
- Parameters
gradientType (QgsGradientFillSymbolLayer.GradientType) –
- setMapUnitScale(self, scale: QgsMapUnitScale)¶
- Parameters
scale (QgsMapUnitScale) –
- setOffset(self, offset: Union[QPointF, QPoint])¶
Sets an
offset
by which polygons will be translated during rendering.Units are specified by
offsetUnit()
.See also
See also
- Parameters
offset (Union[QPointF) –
- setOffsetMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the fill’s offset.See also
See also
- Parameters
scale (QgsMapUnitScale) –
- setOffsetUnit(self, unit: QgsUnitTypes.RenderUnit)¶
Sets the
unit
for the fill’s offset.See also
See also
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)¶
- Parameters
unit (QgsUnitTypes.RenderUnit) –
- setReferencePoint1(self, referencePoint: Union[QPointF, QPoint])¶
Starting point of gradient fill, in the range [0,0] - [1,1]
- Parameters
referencePoint (Union[QPointF) –
- setReferencePoint1IsCentroid(self, isCentroid: bool)¶
Sets the starting point of the gradient to be the feature centroid
- Parameters
isCentroid (bool) –
- setReferencePoint2(self, referencePoint: Union[QPointF, QPoint])¶
End point of gradient fill, in the range [0,0] - [1,1]
- Parameters
referencePoint (Union[QPointF) –
- setReferencePoint2IsCentroid(self, isCentroid: bool)¶
Sets the end point of the gradient to be the feature centroid
- Parameters
isCentroid (bool) –
- startRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- stopRender(self, context: QgsSymbolRenderContext)¶
- Parameters
context (QgsSymbolRenderContext) –
- usesMapUnits(self) → bool¶
- Return type
bool