Subgroup: Symbol
Class: QgsSymbolLayer¶
-
class
qgis.core.
QgsSymbolLayer
(type: QgsSymbol.SymbolType, locked: bool = False)¶ Bases:
sip.wrapper
QgsSymbolLayer(QgsSymbolLayer)
Methods
clone
Shall be reimplemented by subclasses to create a deep copy of the instance. color
The fill color. copyDataDefinedProperties
Copies all data defined properties of this layer to another symbol layer. copyPaintEffect
Copies paint effect of this layer to another symbol layer dataDefinedProperties
Returns a reference to the symbol layer’s property collection, used for data defined overrides. drawPreviewIcon
dxfAngle
Gets angle dxfBrushColor
Gets brush/fill color dxfBrushStyle
Gets brush/fill style dxfColor
Gets color dxfCustomDashPattern
Gets dash pattern dxfOffset
Gets offset dxfPenStyle
Gets pen style dxfWidth
Gets line width enabled
Returns true if symbol layer is enabled and will be drawn. estimateMaxBleed
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context. fillColor
Gets fill color. isCompatibleWithSymbol
Returns if the layer can be used below the specified symbol isLocked
layerType
Returns a string that represents this layer type. mapUnitScale
ogrFeatureStyle
outputUnit
Returns the units to use for sizes and widths within the symbol layer. paintEffect
Returns the current paint effect for the layer. prepareExpressions
Prepares all data defined property expressions for evaluation. properties
Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer. propertyDefinitions
Returns the symbol layer property definitions. renderingPass
restoreOldDataDefinedProperties
Restores older data defined properties from string map. setColor
The fill color. setDataDefinedProperties
Sets the symbol layer’s property collection, used for data defined overrides. setDataDefinedProperty
Sets a data defined property for the layer. setEnabled
Sets whether symbol layer is enabled and should be drawn. setFillColor
Set fill color. setLocked
setMapUnitScale
setOutputUnit
Sets the units to use for sizes and widths within the symbol layer. setPaintEffect
Sets the current paint effect for the layer. setRenderingPass
setStrokeColor
Set stroke color. setSubSymbol
Sets layer’s subsymbol. startRender
stopRender
strokeColor
Gets stroke color. subSymbol
Returns the symbol’s sub symbol, if present. toSld
type
usedAttributes
Returns the set of attributes referenced by the layer. writeDxf
write as DXF Signals
Attributes
-
class
Property
¶ Bases:
int
-
PropertyAngle
= 1¶
-
PropertyArrowHeadLength
= 46¶
-
PropertyArrowHeadThickness
= 47¶
-
PropertyArrowHeadType
= 48¶
-
PropertyArrowStartWidth
= 45¶
-
PropertyArrowType
= 49¶
-
PropertyArrowWidth
= 44¶
-
PropertyBlurRadius
= 26¶
-
PropertyCapStyle
= 37¶
-
PropertyCharacter
= 8¶
-
PropertyCoordinateMode
= 18¶
-
PropertyCustomDash
= 36¶
-
PropertyDisplacementX
= 33¶
-
PropertyDisplacementY
= 34¶
-
PropertyDistanceX
= 31¶
-
PropertyDistanceY
= 32¶
-
PropertyFile
= 30¶
-
PropertyFillColor
= 3¶
-
PropertyFillStyle
= 12¶
-
PropertyGradientReference1IsCentroid
= 24¶
-
PropertyGradientReference1X
= 20¶
-
PropertyGradientReference1Y
= 21¶
-
PropertyGradientReference2IsCentroid
= 25¶
-
PropertyGradientReference2X
= 22¶
-
PropertyGradientReference2Y
= 23¶
-
PropertyGradientSpread
= 19¶
-
PropertyGradientType
= 17¶
-
PropertyHeight
= 10¶
-
PropertyHorizontalAnchor
= 41¶
-
PropertyInterval
= 39¶
-
PropertyJoinStyle
= 13¶
-
PropertyLayerEnabled
= 43¶
-
PropertyLineAngle
= 15¶
-
PropertyLineDistance
= 16¶
-
PropertyName
= 2¶
-
PropertyOffset
= 7¶
-
PropertyOffsetAlongLine
= 40¶
-
PropertyOpacity
= 35¶
-
PropertyPlacement
= 38¶
-
PropertyPreserveAspectRatio
= 11¶
-
PropertySecondaryColor
= 14¶
-
PropertyShapeburstIgnoreRings
= 29¶
-
PropertyShapeburstMaxDistance
= 28¶
-
PropertyShapeburstUseWholeShape
= 27¶
-
PropertySize
= 0¶
-
PropertyStrokeColor
= 4¶
-
PropertyStrokeStyle
= 6¶
-
PropertyStrokeWidth
= 5¶
-
PropertyVerticalAnchor
= 42¶
-
PropertyWidth
= 9¶
-
clone
(self) → QgsSymbolLayer¶ Shall be reimplemented by subclasses to create a deep copy of the instance.
-
color
(self) → QColor¶ The fill color.
-
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.
-
dataDefinedProperties
(self) → QgsPropertyCollection¶ Returns a reference to the symbol layer’s property collection, used for data defined overrides.
See also
New in version 3.0.
-
drawPreviewIcon
(self, context: QgsSymbolRenderContext, size: QSize)¶
-
dxfAngle
(self, context: QgsSymbolRenderContext) → float¶ Gets angle
-
dxfBrushColor
(self, context: QgsSymbolRenderContext) → QColor¶ Gets brush/fill color
-
dxfBrushStyle
(self) → Qt.BrushStyle¶ Gets brush/fill style
-
dxfColor
(self, context: QgsSymbolRenderContext) → QColor¶ Gets color
-
dxfCustomDashPattern
(self) → Tuple[List[float], QgsUnitTypes.RenderUnit]¶ Gets dash pattern
-
dxfOffset
(self, e: QgsDxfExport, context: QgsSymbolRenderContext) → float¶ Gets offset
-
dxfPenStyle
(self) → Qt.PenStyle¶ Gets pen style
-
dxfWidth
(self, e: QgsDxfExport, context: QgsSymbolRenderContext) → float¶ Gets line width
-
enabled
(self) → bool¶ Returns true if symbol layer is enabled and will be drawn.
See also
New in version 3.0.
-
estimateMaxBleed
(self, context: QgsRenderContext) → float¶ Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context. For example, polygons drawn with an stroke will draw half the width of the stroke outside of the polygon. This amount is estimated, since it may be affected by data defined symbology rules.*
-
fillColor
(self) → QColor¶ Gets fill color. Supported by marker and fill layers.
New in version 2.1.
-
isCompatibleWithSymbol
(self, symbol: QgsSymbol) → bool¶ Returns if the layer can be used below the specified symbol
-
isLocked
(self) → bool¶
-
layerType
(self) → str¶ Returns a string that represents this layer type. Used for serialization. Should match with the string used to register this symbol layer in the registry.
-
mapUnitScale
(self) → QgsMapUnitScale¶
-
ogrFeatureStyle
(self, mmScaleFactor: float, mapUnitScaleFactor: float) → str¶
-
outputUnit
(self) → QgsUnitTypes.RenderUnit¶ Returns the units to use for sizes and widths within the symbol layer. Individual symbol layer subclasses will interpret this in different ways, e.g., a marker symbol layer may use it to specify the units for the marker size, while a line symbol layer may use it to specify the units for the line width.
Returns: output unit, or QgsUnitTypes.RenderUnknownUnit if the symbol layer contains mixed units See also
-
paintEffect
(self) → QgsPaintEffect¶ Returns the current paint effect for the layer.
Returns: paint effect See also
New in version 2.9.
-
prepareExpressions
(self, context: QgsSymbolRenderContext)¶ Prepares all data defined property expressions for evaluation. This should be called prior to evaluating data defined properties.
Parameters: context – symbol render context New in version 2.12.
-
properties
(self) → Dict[str, str]¶ Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer. This is used to serialize a symbol layer perstistently.
-
propertyDefinitions
() → object¶ Returns the symbol layer property definitions.
New in version 3.0.
-
renderingPass
(self) → int¶
-
restoreOldDataDefinedProperties
(self, stringMap: Dict[str, str])¶ Restores older data defined properties from string map.
New in version 3.0.
-
setColor
(self, color: Union[QColor, Qt.GlobalColor])¶ The fill color.
-
setDataDefinedProperties
(self, collection: QgsPropertyCollection)¶ Sets the symbol layer’s property collection, used for data defined overrides.
Parameters: collection – property collection. Existing properties will be replaced. See also
New in version 3.0.
-
setDataDefinedProperty
(self, key: QgsSymbolLayer.Property, property: QgsProperty)¶ Sets a data defined property for the layer. Any existing property with the same key will be overwritten.
See also
New in version 3.0.
-
setEnabled
(self, enabled: bool)¶ Sets whether symbol layer is enabled and should be drawn. Disabled layers are not drawn, but remain part of the symbol and can be re-enabled when desired.
See also
New in version 3.0.
-
setFillColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Set fill color. Supported by marker and fill layers.
New in version 2.1.
-
setLocked
(self, locked: bool)¶
-
setMapUnitScale
(self, scale: QgsMapUnitScale)¶
-
setOutputUnit
(self, unit: QgsUnitTypes.RenderUnit)¶ Sets the units to use for sizes and widths within the symbol layer. Individual symbol layer subclasses will interpret this in different ways, e.g., a marker symbol layer may use it to specify the units for the marker size, while a line symbol layer may use it to specify the units for the line width.
Parameters: unit – output units See also
-
setPaintEffect
(self, effect: QgsPaintEffect)¶ Sets the current paint effect for the layer.
Parameters: effect – paint effect. Ownership is transferred to the layer. See also
New in version 2.9.
-
setRenderingPass
(self, renderingPass: int)¶
-
setStrokeColor
(self, color: Union[QColor, Qt.GlobalColor])¶ Set stroke color. Supported by marker and fill layers.
New in version 2.1.
-
setSubSymbol
(self, symbol: QgsSymbol) → bool¶ Sets layer’s subsymbol. takes ownership of the passed symbol
-
startRender
(self, context: QgsSymbolRenderContext)¶
-
stopRender
(self, context: QgsSymbolRenderContext)¶
-
strokeColor
(self) → QColor¶ Gets stroke color. Supported by marker and fill layers.
New in version 2.1.
-
subSymbol
(self) → QgsSymbol¶ Returns the symbol’s sub symbol, if present.
-
toSld
(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])¶
-
type
(self) → QgsSymbol.SymbolType¶
-
usedAttributes
(self, context: QgsRenderContext) → Set[str]¶ Returns the set of attributes referenced by the layer. This includes attributes required by any data defined properties associated with the layer.
-
writeDxf
(self, e: QgsDxfExport, mmMapUnitScaleFactor: float, layerName: str, context: QgsSymbolRenderContext, shift: Union[QPointF, QPoint] = QPointF(0, 0)) → bool¶ write as DXF
-
class