QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
QgsSymbolLayer Class Referenceabstract

#include <qgssymbollayer.h>

Inheritance diagram for QgsSymbolLayer:
Inheritance graph
[legend]

Public Types

enum  Property {
  PropertySize = 0 , PropertyAngle , PropertyName , PropertyFillColor ,
  PropertyStrokeColor , PropertyStrokeWidth , PropertyStrokeStyle , PropertyOffset ,
  PropertyCharacter , PropertyWidth , PropertyHeight , PropertyPreserveAspectRatio ,
  PropertyFillStyle , PropertyJoinStyle , PropertySecondaryColor , PropertyLineAngle ,
  PropertyLineDistance , PropertyGradientType , PropertyCoordinateMode , PropertyGradientSpread ,
  PropertyGradientReference1X , PropertyGradientReference1Y , PropertyGradientReference2X , PropertyGradientReference2Y ,
  PropertyGradientReference1IsCentroid , PropertyGradientReference2IsCentroid , PropertyBlurRadius , PropertyShapeburstUseWholeShape ,
  PropertyShapeburstMaxDistance , PropertyShapeburstIgnoreRings , PropertyFile , PropertyDistanceX ,
  PropertyDistanceY , PropertyDisplacementX , PropertyDisplacementY , PropertyOpacity ,
  PropertyCustomDash , PropertyCapStyle , PropertyPlacement , PropertyInterval ,
  PropertyOffsetAlongLine , PropertyAverageAngleLength , PropertyHorizontalAnchor , PropertyVerticalAnchor ,
  PropertyLayerEnabled , PropertyArrowWidth , PropertyArrowStartWidth , PropertyArrowHeadLength ,
  PropertyArrowHeadThickness , PropertyArrowHeadType , PropertyArrowType , PropertyOffsetX ,
  PropertyOffsetY , PropertyPointCount , PropertyRandomSeed , PropertyClipPoints ,
  PropertyDensityArea , PropertyFontFamily , PropertyFontStyle , PropertyDashPatternOffset ,
  PropertyTrimStart , PropertyTrimEnd , PropertyLineStartWidthValue , PropertyLineEndWidthValue ,
  PropertyLineStartColorValue , PropertyLineEndColorValue , PropertyMarkerClipping , PropertyRandomOffsetX ,
  PropertyRandomOffsetY , PropertyLineClipping
}
 Data definable properties. More...
 

Public Member Functions

 QgsSymbolLayer (const QgsSymbolLayer &other)=delete
 QgsSymbolLayer cannot be copied. More...
 
virtual ~QgsSymbolLayer ()
 
virtual bool canCauseArtifactsBetweenAdjacentTiles () const
 Returns true if the symbol layer rendering can cause visible artifacts across a single feature when the feature is rendered as a series of adjacent map tiles each containing a portion of the feature's geometry. More...
 
virtual QgsSymbolLayerclone () const =0
 Shall be reimplemented by subclasses to create a deep copy of the instance. More...
 
virtual QColor color () const
 Returns the "representative" color of the symbol layer. More...
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the symbol layer's property collection, used for data defined overrides. More...
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the symbol layer's property collection, used for data defined overrides. More...
 
virtual void drawPreviewIcon (QgsSymbolRenderContext &context, QSize size)=0
 
virtual double dxfAngle (QgsSymbolRenderContext &context) const
 Gets angle. More...
 
virtual QColor dxfBrushColor (QgsSymbolRenderContext &context) const
 Gets brush/fill color. More...
 
virtual Qt::BrushStyle dxfBrushStyle () const
 Gets brush/fill style. More...
 
virtual QColor dxfColor (QgsSymbolRenderContext &context) const
 Gets color. More...
 
virtual QVector< qreal > dxfCustomDashPattern (QgsUnitTypes::RenderUnit &unit) const
 Gets dash pattern. More...
 
virtual double dxfOffset (const QgsDxfExport &e, QgsSymbolRenderContext &context) const
 Gets offset. More...
 
virtual Qt::PenStyle dxfPenStyle () const
 Gets pen style. More...
 
virtual double dxfWidth (const QgsDxfExport &e, QgsSymbolRenderContext &context) const
 Gets line width. More...
 
bool enabled () const
 Returns true if symbol layer is enabled and will be drawn. More...
 
virtual double estimateMaxBleed (const QgsRenderContext &context) const
 Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context. More...
 
virtual QColor fillColor () const
 Returns the fill color for the symbol layer. More...
 
virtual Qgis::SymbolLayerFlags flags () const
 Returns flags which control the symbol layer's behavior. More...
 
virtual bool hasDataDefinedProperties () const
 Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties. More...
 
virtual bool isCompatibleWithSymbol (QgsSymbol *symbol) const
 Returns if the layer can be used below the specified symbol. More...
 
bool isLocked () const
 Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color changes. More...
 
virtual QString layerType () const =0
 Returns a string that represents this layer type. More...
 
virtual QgsMapUnitScale mapUnitScale () const
 
virtual QList< QgsSymbolLayerReferencemasks () const
 Returns masks defined by this symbol layer. More...
 
virtual QString ogrFeatureStyle (double mmScaleFactor, double mapUnitScaleFactor) const
 
QgsSymbolLayeroperator= (const QgsSymbolLayer &other)=delete
 QgsSymbolLayer cannot be copied. More...
 
virtual QgsUnitTypes::RenderUnit outputUnit () const
 Returns the units to use for sizes and widths within the symbol layer. More...
 
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the layer. More...
 
virtual void prepareExpressions (const QgsSymbolRenderContext &context)
 Prepares all data defined property expressions for evaluation. More...
 
virtual void prepareMasks (const QgsSymbolRenderContext &context)
 Prepares all mask internal objects according to what is defined in context This should be called prior to calling startRender() method. More...
 
virtual QVariantMap properties () const =0
 Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer. More...
 
int renderingPass () const
 Specifies the rendering pass in which this symbol layer should be rendered. More...
 
virtual void setColor (const QColor &color)
 Sets the "representative" color for the symbol layer. More...
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the symbol layer's property collection, used for data defined overrides. More...
 
virtual void setDataDefinedProperty (Property key, const QgsProperty &property)
 Sets a data defined property for the layer. More...
 
void setEnabled (bool enabled)
 Sets whether symbol layer is enabled and should be drawn. More...
 
virtual void setFillColor (const QColor &color)
 Sets the fill color for the symbol layer. More...
 
void setLocked (bool locked)
 Sets whether the layer's colors are locked. More...
 
virtual void setMapUnitScale (const QgsMapUnitScale &scale)
 
virtual void setOutputUnit (QgsUnitTypes::RenderUnit unit)
 Sets the units to use for sizes and widths within the symbol layer. More...
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the layer. More...
 
void setRenderingPass (int renderingPass)
 Specifies the rendering pass in which this symbol layer should be rendered. More...
 
virtual void setStrokeColor (const QColor &color)
 Sets the stroke color for the symbol layer. More...
 
virtual bool setSubSymbol (QgsSymbol *symbol)
 Sets layer's subsymbol. takes ownership of the passed symbol. More...
 
virtual void startFeatureRender (const QgsFeature &feature, QgsRenderContext &context)
 Called before the layer will be rendered for a particular feature. More...
 
virtual void startRender (QgsSymbolRenderContext &context)=0
 Called before a set of rendering operations commences on the supplied render context. More...
 
virtual void stopFeatureRender (const QgsFeature &feature, QgsRenderContext &context)
 Called after the layer has been rendered for a particular feature. More...
 
virtual void stopRender (QgsSymbolRenderContext &context)=0
 Called after a set of rendering operations has finished on the supplied render context. More...
 
virtual QColor strokeColor () const
 Returns the stroke color for the symbol layer. More...
 
virtual QgsSymbolsubSymbol ()
 Returns the symbol's sub symbol, if present. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
 Saves the symbol layer as SLD. More...
 
Qgis::SymbolType type () const
 
virtual QSet< QString > usedAttributes (const QgsRenderContext &context) const
 Returns the set of attributes referenced by the layer. More...
 
virtual bool usesMapUnits () const
 Returns true if the symbol layer has any components which use map unit based sizes. More...
 
virtual bool writeDxf (QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
 write as DXF More...
 

Static Public Member Functions

static const QgsPropertiesDefinitionpropertyDefinitions ()
 Returns the symbol layer property definitions. More...
 

Protected Member Functions

 QgsSymbolLayer (Qgis::SymbolType type, bool locked=false)
 Constructor for QgsSymbolLayer. More...
 
void copyDataDefinedProperties (QgsSymbolLayer *destLayer) const
 Copies all data defined properties of this layer to another symbol layer. More...
 
void copyPaintEffect (QgsSymbolLayer *destLayer) const
 Copies paint effect of this layer to another symbol layer. More...
 
void restoreOldDataDefinedProperties (const QVariantMap &stringMap)
 Restores older data defined properties from string map. More...
 

Protected Attributes

QPainterPath mClipPath
 
QColor mColor
 
QgsPropertyCollection mDataDefinedProperties
 
bool mEnabled = true
 True if layer is enabled and should be drawn. More...
 
QgsFields mFields
 
bool mLocked = false
 
std::unique_ptr< QgsPaintEffectmPaintEffect
 
int mRenderingPass = 0
 
Qgis::SymbolType mType
 

Static Protected Attributes

static const bool SELECT_FILL_BORDER = false
 Whether fill styles for selected features also highlight symbol stroke. More...
 
static const bool SELECT_FILL_STYLE = false
 Whether fill styles for selected features uses symbol layer style. More...
 
static const bool SELECTION_IS_OPAQUE = true
 Whether styles for selected features ignore symbol alpha. More...
 

Detailed Description

Definition at line 54 of file qgssymbollayer.h.

Member Enumeration Documentation

◆ Property

Data definable properties.

Since
QGIS 3.0
Enumerator
PropertySize 

Symbol size.

PropertyAngle 

Symbol angle.

PropertyName 

Name, eg shape name for simple markers.

PropertyFillColor 

Fill color.

PropertyStrokeColor 

Stroke color.

PropertyStrokeWidth 

Stroke width.

PropertyStrokeStyle 

Stroke style (eg solid, dashed)

PropertyOffset 

Symbol offset.

PropertyCharacter 

Character, eg for font marker symbol layers.

PropertyWidth 

Symbol width.

PropertyHeight 

Symbol height.

PropertyPreserveAspectRatio 

Preserve aspect ratio between width and height.

PropertyFillStyle 

Fill style (eg solid, dots)

PropertyJoinStyle 

Line join style.

PropertySecondaryColor 

Secondary color (eg for gradient fills)

PropertyLineAngle 

Line angle, or angle of hash lines for hash line symbols.

PropertyLineDistance 

Distance between lines, or length of lines for hash line symbols.

PropertyGradientType 

Gradient fill type.

PropertyCoordinateMode 

Gradient coordinate mode.

PropertyGradientSpread 

Gradient spread mode.

PropertyGradientReference1X 

Gradient reference point 1 x.

PropertyGradientReference1Y 

Gradient reference point 1 y.

PropertyGradientReference2X 

Gradient reference point 2 x.

PropertyGradientReference2Y 

Gradient reference point 2 y.

PropertyGradientReference1IsCentroid 

Gradient reference point 1 is centroid.

PropertyGradientReference2IsCentroid 

Gradient reference point 2 is centroid.

PropertyBlurRadius 

Shapeburst blur radius.

PropertyShapeburstUseWholeShape 

Shapeburst use whole shape.

PropertyShapeburstMaxDistance 

Shapeburst fill from edge distance.

PropertyShapeburstIgnoreRings 

Shapeburst ignore rings.

PropertyFile 

Filename, eg for svg files.

PropertyDistanceX 

Horizontal distance between points.

PropertyDistanceY 

Vertical distance between points.

PropertyDisplacementX 

Horizontal displacement.

PropertyDisplacementY 

Vertical displacement.

PropertyOpacity 

Opacity.

PropertyCustomDash 

Custom dash pattern.

PropertyCapStyle 

Line cap style.

PropertyPlacement 

Line marker placement.

PropertyInterval 

Line marker interval.

PropertyOffsetAlongLine 

Offset along line.

PropertyAverageAngleLength 

Length to average symbol angles over.

PropertyHorizontalAnchor 

Horizontal anchor point.

PropertyVerticalAnchor 

Vertical anchor point.

PropertyLayerEnabled 

Whether symbol layer is enabled.

PropertyArrowWidth 

Arrow tail width.

PropertyArrowStartWidth 

Arrow tail start width.

PropertyArrowHeadLength 

Arrow head length.

PropertyArrowHeadThickness 

Arrow head thickness.

PropertyArrowHeadType 

Arrow head type.

PropertyArrowType 

Arrow type.

PropertyOffsetX 

Horizontal offset.

PropertyOffsetY 

Vertical offset.

PropertyPointCount 

Point count.

PropertyRandomSeed 

Random number seed.

PropertyClipPoints 

Whether markers should be clipped to polygon boundaries.

PropertyDensityArea 

Density area.

PropertyFontFamily 

Font family.

PropertyFontStyle 

Font style.

PropertyDashPatternOffset 

Dash pattern offset,.

PropertyTrimStart 

Trim distance from start of line (since QGIS 3.20)

PropertyTrimEnd 

Trim distance from end of line (since QGIS 3.20)

PropertyLineStartWidthValue 

Start line width for interpolated line renderer (since QGIS 3.22)

PropertyLineEndWidthValue 

End line width for interpolated line renderer (since QGIS 3.22)

PropertyLineStartColorValue 

Start line color for interpolated line renderer (since QGIS 3.22)

PropertyLineEndColorValue 

End line color for interpolated line renderer (since QGIS 3.22)

PropertyMarkerClipping 

Marker clipping mode (since QGIS 3.24)

PropertyRandomOffsetX 

Random offset X (since QGIS 3.24)

PropertyRandomOffsetY 

Random offset Y (since QGIS 3.24)

PropertyLineClipping 

Line clipping mode (since QGIS 3.24)

Definition at line 142 of file qgssymbollayer.h.

Constructor & Destructor Documentation

◆ ~QgsSymbolLayer()

QgsSymbolLayer::~QgsSymbolLayer ( )
virtualdefault

◆ QgsSymbolLayer() [1/2]

QgsSymbolLayer::QgsSymbolLayer ( const QgsSymbolLayer other)
delete

QgsSymbolLayer cannot be copied.

◆ QgsSymbolLayer() [2/2]

QgsSymbolLayer::QgsSymbolLayer ( Qgis::SymbolType  type,
bool  locked = false 
)
protected

Constructor for QgsSymbolLayer.

Parameters
typespecifies the associated symbol type
lockedif true, then symbol layer colors will be locked and will ignore any symbol-level color changes.

Definition at line 236 of file qgssymbollayer.cpp.

Member Function Documentation

◆ canCauseArtifactsBetweenAdjacentTiles()

bool QgsSymbolLayer::canCauseArtifactsBetweenAdjacentTiles ( ) const
virtual

Returns true if the symbol layer rendering can cause visible artifacts across a single feature when the feature is rendered as a series of adjacent map tiles each containing a portion of the feature's geometry.

The default implementation returns false.

Since
QGIS 3.18

Reimplemented in QgsArrowSymbolLayer, QgsGradientFillSymbolLayer, QgsShapeburstFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsSimpleLineSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 308 of file qgssymbollayer.cpp.

◆ clone()

virtual QgsSymbolLayer * QgsSymbolLayer::clone ( ) const
pure virtual

◆ color()

QColor QgsSymbolLayer::color ( ) const
virtual

Returns the "representative" color of the symbol layer.

Depending on the symbol layer type, this will have different meaning. For instance, a line symbol layer will generally return the stroke color of the layer, while a fill symbol layer will return the "fill" color instead of stroke.

Some symbol layer types will return an invalid QColor if they have no representative color associated (e.g. raster image based symbol layers).

See also
setColor()
strokeColor()
fillColor()

Reimplemented in QgsArrowSymbolLayer, QgsRasterFillSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsMarkerLineSymbolLayer, QgsHashedLineSymbolLayer, QgsRasterLineSymbolLayer, QgsLineburstSymbolLayer, QgsSimpleMarkerSymbolLayer, QgsFilledMarkerSymbolLayer, QgsRasterMarkerSymbolLayer, QgsMaskMarkerSymbolLayer, and QgsVectorFieldSymbolLayer.

Definition at line 247 of file qgssymbollayer.cpp.

◆ copyDataDefinedProperties()

void QgsSymbolLayer::copyDataDefinedProperties ( QgsSymbolLayer destLayer) const
protected

Copies all data defined properties of this layer to another symbol layer.

Parameters
destLayerdestination layer

Definition at line 483 of file qgssymbollayer.cpp.

◆ copyPaintEffect()

void QgsSymbolLayer::copyPaintEffect ( QgsSymbolLayer destLayer) const
protected

Copies paint effect of this layer to another symbol layer.

Parameters
destLayerdestination layer
Since
QGIS 2.9

Definition at line 491 of file qgssymbollayer.cpp.

◆ dataDefinedProperties() [1/2]

QgsPropertyCollection & QgsSymbolLayer::dataDefinedProperties ( )
inline

Returns a reference to the symbol layer's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Property
Since
QGIS 3.0

Definition at line 595 of file qgssymbollayer.h.

◆ dataDefinedProperties() [2/2]

const QgsPropertyCollection & QgsSymbolLayer::dataDefinedProperties ( ) const
inline

Returns a reference to the symbol layer's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Since
QGIS 3.0

Definition at line 602 of file qgssymbollayer.h.

◆ drawPreviewIcon()

virtual void QgsSymbolLayer::drawPreviewIcon ( QgsSymbolRenderContext context,
QSize  size 
)
pure virtual

◆ dxfAngle()

double QgsSymbolLayer::dxfAngle ( QgsSymbolRenderContext context) const
virtual

Gets angle.

Reimplemented in QgsSimpleFillSymbolLayer.

Definition at line 195 of file qgssymbollayer.cpp.

◆ dxfBrushColor()

QColor QgsSymbolLayer::dxfBrushColor ( QgsSymbolRenderContext context) const
virtual

Gets brush/fill color.

Reimplemented in QgsSimpleFillSymbolLayer.

Definition at line 212 of file qgssymbollayer.cpp.

◆ dxfBrushStyle()

Qt::BrushStyle QgsSymbolLayer::dxfBrushStyle ( ) const
virtual

Gets brush/fill style.

Reimplemented in QgsSimpleFillSymbolLayer.

Definition at line 218 of file qgssymbollayer.cpp.

◆ dxfColor()

QColor QgsSymbolLayer::dxfColor ( QgsSymbolRenderContext context) const
virtual

Gets color.

Reimplemented in QgsSimpleFillSymbolLayer, QgsSVGFillSymbolLayer, and QgsSimpleLineSymbolLayer.

Definition at line 189 of file qgssymbollayer.cpp.

◆ dxfCustomDashPattern()

QVector< qreal > QgsSymbolLayer::dxfCustomDashPattern ( QgsUnitTypes::RenderUnit unit) const
virtual

Gets dash pattern.

Reimplemented in QgsSimpleLineSymbolLayer.

Definition at line 201 of file qgssymbollayer.cpp.

◆ dxfOffset()

double QgsSymbolLayer::dxfOffset ( const QgsDxfExport e,
QgsSymbolRenderContext context 
) const
virtual

Gets offset.

Reimplemented in QgsSimpleLineSymbolLayer.

Definition at line 182 of file qgssymbollayer.cpp.

◆ dxfPenStyle()

Qt::PenStyle QgsSymbolLayer::dxfPenStyle ( ) const
virtual

Gets pen style.

Reimplemented in QgsSimpleFillSymbolLayer, QgsImageFillSymbolLayer, and QgsSimpleLineSymbolLayer.

Definition at line 207 of file qgssymbollayer.cpp.

◆ dxfWidth()

double QgsSymbolLayer::dxfWidth ( const QgsDxfExport e,
QgsSymbolRenderContext context 
) const
virtual

Gets line width.

Reimplemented in QgsSimpleFillSymbolLayer, QgsImageFillSymbolLayer, QgsSimpleLineSymbolLayer, and QgsLineSymbolLayer.

Definition at line 175 of file qgssymbollayer.cpp.

◆ enabled()

bool QgsSymbolLayer::enabled ( ) const
inline

Returns true if symbol layer is enabled and will be drawn.

See also
setEnabled()
Since
QGIS 3.0

Definition at line 242 of file qgssymbollayer.h.

◆ estimateMaxBleed()

virtual double QgsSymbolLayer::estimateMaxBleed ( const QgsRenderContext context) const
inlinevirtual

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.

Reimplemented in QgsSimpleFillSymbolLayer, QgsGradientFillSymbolLayer, QgsShapeburstFillSymbolLayer, QgsRasterFillSymbolLayer, QgsSVGFillSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsSimpleLineSymbolLayer, QgsMarkerLineSymbolLayer, QgsHashedLineSymbolLayer, QgsRasterLineSymbolLayer, QgsLineburstSymbolLayer, and QgsFilledMarkerSymbolLayer.

Definition at line 475 of file qgssymbollayer.h.

◆ fillColor()

QColor QgsSymbolLayer::fillColor ( ) const
virtual

Returns the fill color for the symbol layer.

This property is not supported by all symbol layer types, only those with a fill component. Symbol layers without a fill component will return an invalid QColor.

See also
setFillColor()
color()
strokeColor()
Since
QGIS 2.1

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsSvgMarkerSymbolLayer.

Definition at line 271 of file qgssymbollayer.cpp.

◆ flags()

Qgis::SymbolLayerFlags QgsSymbolLayer::flags ( ) const
virtual

Returns flags which control the symbol layer's behavior.

Since
QGIS 3.22

Reimplemented in QgsInterpolatedLineSymbolLayer.

Definition at line 242 of file qgssymbollayer.cpp.

◆ hasDataDefinedProperties()

bool QgsSymbolLayer::hasDataDefinedProperties ( ) const
virtual

◆ isCompatibleWithSymbol()

bool QgsSymbolLayer::isCompatibleWithSymbol ( QgsSymbol symbol) const
virtual

Returns if the layer can be used below the specified symbol.

Reimplemented in QgsGeometryGeneratorSymbolLayer, and QgsInterpolatedLineSymbolLayer.

Definition at line 300 of file qgssymbollayer.cpp.

◆ isLocked()

bool QgsSymbolLayer::isLocked ( ) const
inline

Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color changes.

See also
setLocked()

Definition at line 466 of file qgssymbollayer.h.

◆ layerType()

virtual QString QgsSymbolLayer::layerType ( ) const
pure virtual

◆ mapUnitScale()

virtual QgsMapUnitScale QgsSymbolLayer::mapUnitScale ( ) const
inlinevirtual

◆ masks()

QList< QgsSymbolLayerReference > QgsSymbolLayer::masks ( ) const
virtual

Returns masks defined by this symbol layer.

This is a list of symbol layers of other layers that should be occluded.

Since
QGIS 3.12

Reimplemented in QgsMaskMarkerSymbolLayer.

Definition at line 905 of file qgssymbollayer.cpp.

◆ ogrFeatureStyle()

virtual QString QgsSymbolLayer::ogrFeatureStyle ( double  mmScaleFactor,
double  mapUnitScaleFactor 
) const
inlinevirtual

◆ operator=()

QgsSymbolLayer & QgsSymbolLayer::operator= ( const QgsSymbolLayer other)
delete

QgsSymbolLayer cannot be copied.

◆ outputUnit()

virtual QgsUnitTypes::RenderUnit QgsSymbolLayer::outputUnit ( ) const
inlinevirtual

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
setOutputUnit()

Reimplemented in QgsTemplatedLineSymbolLayerBase, QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsGradientFillSymbolLayer, QgsShapeburstFillSymbolLayer, QgsImageFillSymbolLayer, QgsSVGFillSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsSimpleLineSymbolLayer, QgsRasterLineSymbolLayer, QgsLineburstSymbolLayer, QgsSimpleMarkerSymbolLayer, QgsSvgMarkerSymbolLayer, QgsMarkerSymbolLayer, QgsLineSymbolLayer, and QgsVectorFieldSymbolLayer.

Definition at line 495 of file qgssymbollayer.h.

◆ paintEffect()

QgsPaintEffect * QgsSymbolLayer::paintEffect ( ) const

Returns the current paint effect for the layer.

Returns
paint effect
See also
setPaintEffect
Since
QGIS 2.9

Definition at line 223 of file qgssymbollayer.cpp.

◆ prepareExpressions()

void QgsSymbolLayer::prepareExpressions ( const QgsSymbolRenderContext context)
virtual

Prepares all data defined property expressions for evaluation.

This should be called prior to evaluating data defined properties.

Parameters
contextsymbol render context
Since
QGIS 2.12

Reimplemented in QgsSvgMarkerSymbolLayer.

Definition at line 276 of file qgssymbollayer.cpp.

◆ prepareMasks()

void QgsSymbolLayer::prepareMasks ( const QgsSymbolRenderContext context)
virtual

Prepares all mask internal objects according to what is defined in context This should be called prior to calling startRender() method.

Since
QGIS 3.26

Definition at line 910 of file qgssymbollayer.cpp.

◆ properties()

virtual QVariantMap QgsSymbolLayer::properties ( ) const
pure virtual

◆ propertyDefinitions()

const QgsPropertiesDefinition & QgsSymbolLayer::propertyDefinitions ( )
static

Returns the symbol layer property definitions.

Since
QGIS 3.0

Definition at line 292 of file qgssymbollayer.cpp.

◆ renderingPass()

int QgsSymbolLayer::renderingPass ( ) const

Specifies the rendering pass in which this symbol layer should be rendered.

The lower the number, the lower the symbol will be rendered. 0: first pass, 1: second pass, ... Defaults to 0

Definition at line 323 of file qgssymbollayer.cpp.

◆ restoreOldDataDefinedProperties()

void QgsSymbolLayer::restoreOldDataDefinedProperties ( const QVariantMap &  stringMap)
protected

Restores older data defined properties from string map.

Since
QGIS 3.0

Definition at line 362 of file qgssymbollayer.cpp.

◆ setColor()

void QgsSymbolLayer::setColor ( const QColor &  color)
virtual

Sets the "representative" color for the symbol layer.

Depending on the symbol layer type, this will have different meaning. For instance, a line symbol layer will generally set the stroke color of the layer, while a fill symbol layer will set the "fill" color instead of stroke.

See also
color()
setStrokeColor()
setFillColor()

Reimplemented in QgsArrowSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsFilledMarkerSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsMarkerLineSymbolLayer, QgsHashedLineSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsVectorFieldSymbolLayer.

Definition at line 252 of file qgssymbollayer.cpp.

◆ setDataDefinedProperties()

void QgsSymbolLayer::setDataDefinedProperties ( const QgsPropertyCollection collection)
inline

Sets the symbol layer's property collection, used for data defined overrides.

Parameters
collectionproperty collection. Existing properties will be replaced.
See also
dataDefinedProperties()
Since
QGIS 3.0

Definition at line 610 of file qgssymbollayer.h.

◆ setDataDefinedProperty()

void QgsSymbolLayer::setDataDefinedProperty ( QgsSymbolLayer::Property  key,
const QgsProperty property 
)
virtual

Sets a data defined property for the layer.

Any existing property with the same key will be overwritten.

See also
dataDefinedProperties()
Property
Since
QGIS 3.0

Reimplemented in QgsMarkerLineSymbolLayer, and QgsHashedLineSymbolLayer.

Definition at line 126 of file qgssymbollayer.cpp.

◆ setEnabled()

void QgsSymbolLayer::setEnabled ( bool  enabled)
inline

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
enabled()
Since
QGIS 3.0

Definition at line 251 of file qgssymbollayer.h.

◆ setFillColor()

void QgsSymbolLayer::setFillColor ( const QColor &  color)
virtual

Sets the fill color for the symbol layer.

This property is not supported by all symbol layer types, only those with a fill component.

See also
fillColor()
setColor()
setStrokeColor()
Since
QGIS 2.1

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsSvgMarkerSymbolLayer.

Definition at line 267 of file qgssymbollayer.cpp.

◆ setLocked()

void QgsSymbolLayer::setLocked ( bool  locked)
inline

Sets whether the layer's colors are locked.

If locked is true then the symbol layer colors are locked and the layer will ignore any symbol-level color changes.

See also
isLocked()

Definition at line 459 of file qgssymbollayer.h.

◆ setMapUnitScale()

virtual void QgsSymbolLayer::setMapUnitScale ( const QgsMapUnitScale scale)
inlinevirtual

◆ setOutputUnit()

virtual void QgsSymbolLayer::setOutputUnit ( QgsUnitTypes::RenderUnit  unit)
inlinevirtual

◆ setPaintEffect()

void QgsSymbolLayer::setPaintEffect ( QgsPaintEffect effect)

Sets the current paint effect for the layer.

Parameters
effectpaint effect. Ownership is transferred to the layer.
See also
paintEffect
Since
QGIS 2.9

Definition at line 228 of file qgssymbollayer.cpp.

◆ setRenderingPass()

void QgsSymbolLayer::setRenderingPass ( int  renderingPass)

Specifies the rendering pass in which this symbol layer should be rendered.

The lower the number, the lower the symbol will be rendered. 0: first pass, 1: second pass, ... Defaults to 0

Definition at line 318 of file qgssymbollayer.cpp.

◆ setStrokeColor()

void QgsSymbolLayer::setStrokeColor ( const QColor &  color)
virtual

Sets the stroke color for the symbol layer.

This property is not supported by all symbol layer types, only those with a stroke component.

See also
strokeColor()
setColor()
setFillColor()
Since
QGIS 2.1

Reimplemented in QgsEllipseSymbolLayer, QgsSvgMarkerSymbolLayer, QgsSimpleMarkerSymbolLayer, QgsFontMarkerSymbolLayer, and QgsSimpleFillSymbolLayer.

Definition at line 257 of file qgssymbollayer.cpp.

◆ setSubSymbol()

bool QgsSymbolLayer::setSubSymbol ( QgsSymbol symbol)
virtual

◆ startFeatureRender()

void QgsSymbolLayer::startFeatureRender ( const QgsFeature feature,
QgsRenderContext context 
)
virtual

Called before the layer will be rendered for a particular feature.

This is always followed by a call to stopFeatureRender() after the feature has been completely rendered (i.e. all parts have been rendered).

The default implementation does nothing.

Note
In some circumstances, startFeatureRender() and stopFeatureRender() may not be called before a symbol layer is rendered. E.g., when a symbol layer is being rendered in isolation and not as a result of rendering a feature (for instance, when rendering a legend patch or other non-feature based shape).
See also
stopFeatureRender()
startRender()
Since
QGIS 3.12

Reimplemented in QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsInterpolatedLineSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 131 of file qgssymbollayer.cpp.

◆ startRender()

virtual void QgsSymbolLayer::startRender ( QgsSymbolRenderContext context)
pure virtual

◆ stopFeatureRender()

void QgsSymbolLayer::stopFeatureRender ( const QgsFeature feature,
QgsRenderContext context 
)
virtual

Called after the layer has been rendered for a particular feature.

This is always preceded by a call to startFeatureRender() just before the feature will be rendered.

The default implementation does nothing.

Note
In some circumstances, startFeatureRender() and stopFeatureRender() may not be called before a symbol layer is rendered. E.g., when a symbol layer is being rendered in isolation and not as a result of rendering a feature (for instance, when rendering a legend patch or other non-feature based shape).
See also
startFeatureRender()
stopRender()
Since
QGIS 3.12

Reimplemented in QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsCentroidFillSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsInterpolatedLineSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 143 of file qgssymbollayer.cpp.

◆ stopRender()

virtual void QgsSymbolLayer::stopRender ( QgsSymbolRenderContext context)
pure virtual

◆ strokeColor()

QColor QgsSymbolLayer::strokeColor ( ) const
virtual

Returns the stroke color for the symbol layer.

This property is not supported by all symbol layer types, only those with a stroke component. Symbol layers without a stroke component will return an invalid QColor.

See also
setStrokeColor()
color()
fillColor()
Since
QGIS 2.1

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleMarkerSymbolLayer, QgsSvgMarkerSymbolLayer, and QgsFontMarkerSymbolLayer.

Definition at line 262 of file qgssymbollayer.cpp.

◆ subSymbol()

QgsSymbol * QgsSymbolLayer::subSymbol ( )
virtual

◆ toSld()

virtual void QgsSymbolLayer::toSld ( QDomDocument &  doc,
QDomElement &  element,
const QVariantMap &  props 
) const
inlinevirtual

◆ type()

Qgis::SymbolType QgsSymbolLayer::type ( ) const
inline

Definition at line 437 of file qgssymbollayer.h.

◆ usedAttributes()

QSet< QString > QgsSymbolLayer::usedAttributes ( const QgsRenderContext context) const
virtual

◆ usesMapUnits()

bool QgsSymbolLayer::usesMapUnits ( ) const
virtual

◆ writeDxf()

bool QgsSymbolLayer::writeDxf ( QgsDxfExport e,
double  mmMapUnitScaleFactor,
const QString &  layerName,
QgsSymbolRenderContext context,
QPointF  shift = QPointF( 0.0, 0.0 ) 
) const
virtual

write as DXF

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsSvgMarkerSymbolLayer.

Definition at line 165 of file qgssymbollayer.cpp.

Member Data Documentation

◆ mClipPath

QPainterPath QgsSymbolLayer::mClipPath
protected

Definition at line 657 of file qgssymbollayer.h.

◆ mColor

QColor QgsSymbolLayer::mColor
protected

Definition at line 648 of file qgssymbollayer.h.

◆ mDataDefinedProperties

QgsPropertyCollection QgsSymbolLayer::mDataDefinedProperties
protected

Definition at line 651 of file qgssymbollayer.h.

◆ mEnabled

bool QgsSymbolLayer::mEnabled = true
protected

True if layer is enabled and should be drawn.

Definition at line 645 of file qgssymbollayer.h.

◆ mFields

QgsFields QgsSymbolLayer::mFields
protected

Definition at line 654 of file qgssymbollayer.h.

◆ mLocked

bool QgsSymbolLayer::mLocked = false
protected

Definition at line 647 of file qgssymbollayer.h.

◆ mPaintEffect

std::unique_ptr< QgsPaintEffect > QgsSymbolLayer::mPaintEffect
protected

Definition at line 653 of file qgssymbollayer.h.

◆ mRenderingPass

int QgsSymbolLayer::mRenderingPass = 0
protected

Definition at line 649 of file qgssymbollayer.h.

◆ mType

Qgis::SymbolType QgsSymbolLayer::mType
protected

Definition at line 642 of file qgssymbollayer.h.

◆ SELECT_FILL_BORDER

const bool QgsSymbolLayer::SELECT_FILL_BORDER = false
staticprotected

Whether fill styles for selected features also highlight symbol stroke.

Definition at line 663 of file qgssymbollayer.h.

◆ SELECT_FILL_STYLE

const bool QgsSymbolLayer::SELECT_FILL_STYLE = false
staticprotected

Whether fill styles for selected features uses symbol layer style.

Definition at line 665 of file qgssymbollayer.h.

◆ SELECTION_IS_OPAQUE

const bool QgsSymbolLayer::SELECTION_IS_OPAQUE = true
staticprotected

Whether styles for selected features ignore symbol alpha.

Definition at line 661 of file qgssymbollayer.h.


The documentation for this class was generated from the following files: