QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsSymbolLayer Class Referenceabstract

Abstract base class for symbol layers. More...

#include <qgssymbollayer.h>

Inheritance diagram for QgsSymbolLayer:

Public Types

enum class  Property : int {
  Size = 0 , Angle , Name , FillColor ,
  StrokeColor , StrokeWidth , StrokeStyle , Offset ,
  Character , Width , Height , PreserveAspectRatio ,
  FillStyle , JoinStyle , SecondaryColor , LineAngle ,
  LineDistance , GradientType , CoordinateMode , GradientSpread ,
  GradientReference1X , GradientReference1Y , GradientReference2X , GradientReference2Y ,
  GradientReference1IsCentroid , GradientReference2IsCentroid , BlurRadius , ShapeburstUseWholeShape ,
  ShapeburstMaxDistance , ShapeburstIgnoreRings , File , DistanceX ,
  DistanceY , DisplacementX , DisplacementY , Opacity ,
  CustomDash , CapStyle , Placement , Interval ,
  OffsetAlongLine , AverageAngleLength , HorizontalAnchor , VerticalAnchor ,
  LayerEnabled , ArrowWidth , ArrowStartWidth , ArrowHeadLength ,
  ArrowHeadThickness , ArrowHeadType , ArrowType , OffsetX ,
  OffsetY , PointCount , RandomSeed , ClipPoints ,
  DensityArea , FontFamily , FontStyle , DashPatternOffset ,
  TrimStart , TrimEnd , LineStartWidthValue , LineEndWidthValue ,
  LineStartColorValue , LineEndColorValue , MarkerClipping , RandomOffsetX ,
  RandomOffsetY , LineClipping , SkipMultiples , ShowMarker ,
  BlankSegments
}
 Data definable properties. More...

Public Member Functions

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.
virtual QgsSymbolLayerclone () const =0
 Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual QColor color () const
 Returns the "representative" color of the symbol layer.
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the symbol layer's property collection, used for data defined overrides.
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the symbol layer's property collection, used for data defined overrides.
virtual void drawPreviewIcon (QgsSymbolRenderContext &context, QSize size)=0
virtual double dxfAngle (QgsSymbolRenderContext &context) const
 Gets angle.
virtual QColor dxfBrushColor (QgsSymbolRenderContext &context) const
 Gets brush/fill color.
virtual Qt::BrushStyle dxfBrushStyle () const
 Gets brush/fill style.
virtual QColor dxfColor (QgsSymbolRenderContext &context) const
 Gets color.
virtual QVector< qreal > dxfCustomDashPattern (Qgis::RenderUnit &unit) const
 Gets dash pattern.
virtual double dxfOffset (const QgsDxfExport &e, QgsSymbolRenderContext &context) const
 Gets offset.
virtual Qt::PenStyle dxfPenStyle () const
 Gets pen style.
virtual double dxfSize (const QgsDxfExport &e, QgsSymbolRenderContext &context) const
 Gets marker size.
virtual double dxfWidth (const QgsDxfExport &e, QgsSymbolRenderContext &context) const
 Gets line width.
bool enabled () const
 Returns true if symbol layer is enabled and will be drawn.
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.
virtual QColor fillColor () const
 Returns the fill color for the symbol layer.
virtual Qgis::SymbolLayerFlags flags () const
 Returns flags which control the symbol layer's behavior.
virtual bool hasDataDefinedProperties () const
 Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
QString id () const
 Returns symbol layer identifier This id is unique in the whole project.
bool installMasks (QgsRenderContext &context, bool recursive, const QRectF &rect=QRectF())
 When rendering, install masks on context painter.
virtual bool isCompatibleWithSymbol (QgsSymbol *symbol) const
 Returns if the layer can be used below the specified symbol.
bool isLocked () const
 Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color changes.
virtual QString layerType () const =0
 Returns a string that represents this layer type.
virtual QgsMapUnitScale mapUnitScale () const
virtual QList< QgsSymbolLayerReferencemasks () const
 Returns masks defined by this symbol layer.
virtual QString ogrFeatureStyle (double mmScaleFactor, double mapUnitScaleFactor) const
QgsSymbolLayeroperator= (const QgsSymbolLayer &other)=delete
virtual Qgis::RenderUnit outputUnit () const
 Returns the units to use for sizes and widths within the symbol layer.
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the layer.
virtual void prepareExpressions (const QgsSymbolRenderContext &context)
 Prepares all data defined property expressions for evaluation.
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.
virtual QVariantMap properties () const =0
 Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.
int renderingPass () const
 Specifies the rendering pass in which this symbol layer should be rendered.
virtual bool rendersIdenticallyTo (const QgsSymbolLayer *other) const
 Returns true if this symbol layer will always render identically to an other symbol layer.
virtual void setColor (const QColor &color)
 Sets the "representative" color for the symbol layer.
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the symbol layer's property collection, used for data defined overrides.
virtual void setDataDefinedProperty (Property key, const QgsProperty &property)
 Sets a data defined property for the layer.
void setEnabled (bool enabled)
 Sets whether symbol layer is enabled and should be drawn.
virtual void setFillColor (const QColor &color)
 Sets the fill color for the symbol layer.
void setId (const QString &id)
 Set symbol layer identifier This id has to be unique in the whole project.
void setLocked (bool locked)
 Sets whether the layer's colors are locked.
virtual void setMapUnitScale (const QgsMapUnitScale &scale)
virtual void setOutputUnit (Qgis::RenderUnit unit)
 Sets the units to use for sizes and widths within the symbol layer.
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the layer.
void setRenderingPass (int renderingPass)
 Specifies the rendering pass in which this symbol layer should be rendered.
virtual void setStrokeColor (const QColor &color)
 Sets the stroke color for the symbol layer.
virtual bool setSubSymbol (QgsSymbol *symbol)
 Sets layer's subsymbol. takes ownership of the passed symbol.
void setUserFlags (Qgis::SymbolLayerUserFlags flags)
 Sets user-controlled flags which control the symbol layer's behavior.
virtual void startFeatureRender (const QgsFeature &feature, QgsRenderContext &context)
 Called before the layer will be rendered for a particular feature.
virtual void startRender (QgsSymbolRenderContext &context)=0
 Called before a set of rendering operations commences on the supplied render context.
virtual void stopFeatureRender (const QgsFeature &feature, QgsRenderContext &context)
 Called after the layer has been rendered for a particular feature.
virtual void stopRender (QgsSymbolRenderContext &context)=0
 Called after a set of rendering operations has finished on the supplied render context.
virtual QColor strokeColor () const
 Returns the stroke color for the symbol layer.
virtual QgsSymbolsubSymbol ()
 Returns the symbol's sub symbol, if present.
virtual Q_DECL_DEPRECATED void toSld (QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
 Saves the symbol layer as SLD.
virtual bool toSld (QDomDocument &doc, QDomElement &element, QgsSldExportContext &context) const
 Saves the symbol layer as SLD.
Qgis::SymbolType type () const
virtual QSet< QString > usedAttributes (const QgsRenderContext &context) const
 Returns the set of attributes referenced by the layer.
Qgis::SymbolLayerUserFlags userFlags () const
 Returns user-controlled flags which control the symbol layer's behavior.
virtual bool usesMapUnits () const
 Returns true if the symbol layer has any components which use map unit based sizes.
virtual bool writeDxf (QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
 write as DXF

Static Public Member Functions

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

Protected Member Functions

 QgsSymbolLayer (const QgsSymbolLayer &other)
 QgsSymbolLayer (Qgis::SymbolType type, bool locked=false)
 Constructor for QgsSymbolLayer.
void copyDataDefinedProperties (QgsSymbolLayer *destLayer) const
 Copies all data defined properties of this layer to another symbol layer.
void copyPaintEffect (QgsSymbolLayer *destLayer) const
 Copies paint effect of this layer to another symbol layer.
void removeMasks (QgsRenderContext &context, bool recursive)
 When rendering, remove previously installed masks from context painter if recursive is true masks are removed recursively for all children symbol layers.
void restoreOldDataDefinedProperties (const QVariantMap &stringMap)
 Restores older data defined properties from string map.
bool shouldRenderUsingSelectionColor (const QgsSymbolRenderContext &context) const
 Returns true if the symbol layer should be rendered using the selection color from the render context.

Protected Attributes

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

Static Protected Attributes

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

Detailed Description

Abstract base class for symbol layers.

Definition at line 56 of file qgssymbollayer.h.

Member Enumeration Documentation

◆ Property

enum class QgsSymbolLayer::Property : int
strong

Data definable properties.

Enumerator
Size 

Symbol size.

Angle 

Symbol angle.

Name 

Name, eg shape name for simple markers.

FillColor 

Fill color.

StrokeColor 

Stroke color.

StrokeWidth 

Stroke width.

StrokeStyle 

Stroke style (eg solid, dashed).

Offset 

Symbol offset.

Character 

Character, eg for font marker symbol layers.

Width 

Symbol width.

Height 

Symbol height.

PreserveAspectRatio 

Preserve aspect ratio between width and height.

FillStyle 

Fill style (eg solid, dots).

JoinStyle 

Line join style.

SecondaryColor 

Secondary color (eg for gradient fills).

LineAngle 

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

LineDistance 

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

GradientType 

Gradient fill type.

CoordinateMode 

Gradient coordinate mode.

GradientSpread 

Gradient spread mode.

GradientReference1X 

Gradient reference point 1 x.

GradientReference1Y 

Gradient reference point 1 y.

GradientReference2X 

Gradient reference point 2 x.

GradientReference2Y 

Gradient reference point 2 y.

GradientReference1IsCentroid 

Gradient reference point 1 is centroid.

GradientReference2IsCentroid 

Gradient reference point 2 is centroid.

BlurRadius 

Shapeburst blur radius.

ShapeburstUseWholeShape 

Shapeburst use whole shape.

ShapeburstMaxDistance 

Shapeburst fill from edge distance.

ShapeburstIgnoreRings 

Shapeburst ignore rings.

File 

Filename, eg for svg files.

DistanceX 

Horizontal distance between points.

DistanceY 

Vertical distance between points.

DisplacementX 

Horizontal displacement.

DisplacementY 

Vertical displacement.

Opacity 

Opacity.

CustomDash 

Custom dash pattern.

CapStyle 

Line cap style.

Placement 

Line marker placement.

Interval 

Line marker interval.

OffsetAlongLine 

Offset along line.

AverageAngleLength 

Length to average symbol angles over.

HorizontalAnchor 

Horizontal anchor point.

VerticalAnchor 

Vertical anchor point.

LayerEnabled 

Whether symbol layer is enabled.

ArrowWidth 

Arrow tail width.

ArrowStartWidth 

Arrow tail start width.

ArrowHeadLength 

Arrow head length.

ArrowHeadThickness 

Arrow head thickness.

ArrowHeadType 

Arrow head type.

ArrowType 

Arrow type.

OffsetX 

Horizontal offset.

OffsetY 

Vertical offset.

PointCount 

Point count.

RandomSeed 

Random number seed.

ClipPoints 

Whether markers should be clipped to polygon boundaries.

DensityArea 

Density area.

FontFamily 

Font family.

FontStyle 

Font style.

DashPatternOffset 

Dash pattern offset,.

TrimStart 

Trim distance from start of line.

Since
QGIS 3.20
TrimEnd 

Trim distance from end of line.

Since
QGIS 3.20
LineStartWidthValue 

Start line width for interpolated line renderer.

Since
QGIS 3.22
LineEndWidthValue 

End line width for interpolated line renderer.

Since
QGIS 3.22
LineStartColorValue 

Start line color for interpolated line renderer.

Since
QGIS 3.22
LineEndColorValue 

End line color for interpolated line renderer.

Since
QGIS 3.22
MarkerClipping 

Marker clipping mode.

Since
QGIS 3.24
RandomOffsetX 

Random offset X.

Since
QGIS 3.24
RandomOffsetY 

Random offset Y.

Since
QGIS 3.24
LineClipping 

Line clipping mode.

Since
QGIS 3.24
SkipMultiples 

Skip multiples of.

Since
QGIS 3.40
ShowMarker 

Show markers.

Since
QGIS 3.40
BlankSegments 

String list of distance to define blank segments along line for templated line symbol layers.

Since
QGIS 4.0

Definition at line 147 of file qgssymbollayer.h.

Constructor & Destructor Documentation

◆ ~QgsSymbolLayer()

QgsSymbolLayer::~QgsSymbolLayer ( )
virtualdefault

◆ QgsSymbolLayer() [1/2]

QgsSymbolLayer::QgsSymbolLayer ( const QgsSymbolLayer & other)
protected

Definition at line 237 of file qgssymbollayer.cpp.

◆ 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 252 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, QgsCentroidFillSymbolLayer, QgsGradientFillSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsShapeburstFillSymbolLayer, QgsSimpleLineSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 363 of file qgssymbollayer.cpp.

◆ clone()

◆ 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, QgsCentroidFillSymbolLayer, QgsFilledLineSymbolLayer, QgsFilledMarkerSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsHashedLineSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsLinePatternFillSymbolLayer, QgsMarkerLineSymbolLayer, QgsMaskMarkerSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsRasterFillSymbolLayer, QgsRasterLineSymbolLayer, QgsRasterMarkerSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsVectorFieldSymbolLayer.

Definition at line 302 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 538 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

Definition at line 546 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

Definition at line 634 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()

Definition at line 640 of file qgssymbollayer.h.

◆ drawPreviewIcon()

◆ dxfAngle()

double QgsSymbolLayer::dxfAngle ( QgsSymbolRenderContext & context) const
virtual

Gets angle.

Reimplemented in QgsMarkerSymbolLayer, and QgsSimpleFillSymbolLayer.

Definition at line 196 of file qgssymbollayer.cpp.

◆ dxfBrushColor()

QColor QgsSymbolLayer::dxfBrushColor ( QgsSymbolRenderContext & context) const
virtual

Gets brush/fill color.

Reimplemented in QgsSimpleFillSymbolLayer.

Definition at line 213 of file qgssymbollayer.cpp.

◆ dxfBrushStyle()

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

Gets brush/fill style.

Reimplemented in QgsSimpleFillSymbolLayer.

Definition at line 219 of file qgssymbollayer.cpp.

◆ dxfColor()

QColor QgsSymbolLayer::dxfColor ( QgsSymbolRenderContext & context) const
virtual

Gets color.

Reimplemented in QgsSimpleFillSymbolLayer, QgsSimpleLineSymbolLayer, and QgsSVGFillSymbolLayer.

Definition at line 190 of file qgssymbollayer.cpp.

◆ dxfCustomDashPattern()

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

Gets dash pattern.

Reimplemented in QgsSimpleLineSymbolLayer.

Definition at line 202 of file qgssymbollayer.cpp.

◆ dxfOffset()

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

Gets offset.

Reimplemented in QgsSimpleLineSymbolLayer.

Definition at line 183 of file qgssymbollayer.cpp.

◆ dxfPenStyle()

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

Gets pen style.

Reimplemented in QgsImageFillSymbolLayer, QgsSimpleFillSymbolLayer, and QgsSimpleLineSymbolLayer.

Definition at line 208 of file qgssymbollayer.cpp.

◆ dxfSize()

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

Gets marker size.

Reimplemented in QgsMarkerSymbolLayer.

Definition at line 176 of file qgssymbollayer.cpp.

◆ dxfWidth()

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

Gets line width.

Reimplemented in QgsImageFillSymbolLayer, QgsLineSymbolLayer, QgsSimpleFillSymbolLayer, and QgsSimpleLineSymbolLayer.

Definition at line 169 of file qgssymbollayer.cpp.

◆ enabled()

bool QgsSymbolLayer::enabled ( ) const
inline

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

See also
setEnabled()

Definition at line 245 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 QgsFilledLineSymbolLayer, QgsFilledMarkerSymbolLayer, QgsGradientFillSymbolLayer, QgsHashedLineSymbolLayer, QgsLineburstSymbolLayer, QgsLinePatternFillSymbolLayer, QgsMarkerLineSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRasterFillSymbolLayer, QgsRasterLineSymbolLayer, QgsShapeburstFillSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleLineSymbolLayer, and QgsSVGFillSymbolLayer.

Definition at line 516 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()

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsSvgMarkerSymbolLayer.

Definition at line 326 of file qgssymbollayer.cpp.

◆ flags()

◆ hasDataDefinedProperties()

bool QgsSymbolLayer::hasDataDefinedProperties ( ) const
virtual

◆ id()

QString QgsSymbolLayer::id ( ) const

Returns symbol layer identifier This id is unique in the whole project.

Since
QGIS 3.30

Definition at line 1151 of file qgssymbollayer.cpp.

◆ installMasks()

bool QgsSymbolLayer::installMasks ( QgsRenderContext & context,
bool recursive,
const QRectF & rect = QRectF() )

When rendering, install masks on context painter.

If recursive is true masks are installed recursively for all children symbol layers.

Since QGIS 3.38 the rect argument can be used to specify a target bounds (in painter coordinates) for mask geometries. Only mask geometries which intersect rect will be installed.

Returns
true if any masks were installed (since QGIS 3.38)
See also
prepareMasks()
removeMasks()
Since
QGIS 3.30

Definition at line 1095 of file qgssymbollayer.cpp.

◆ isCompatibleWithSymbol()

bool QgsSymbolLayer::isCompatibleWithSymbol ( QgsSymbol * symbol) const
virtual

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

Reimplemented in QgsGeometryGeneratorSymbolLayer.

Definition at line 355 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 507 of file qgssymbollayer.h.

◆ layerType()

◆ mapUnitScale()

◆ 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 1003 of file qgssymbollayer.cpp.

◆ ogrFeatureStyle()

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

◆ operator=()

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

◆ outputUnit()

virtual Qgis::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 QgsCentroidFillSymbolLayer, QgsEllipseSymbolLayer, QgsFilledLineSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsGradientFillSymbolLayer, QgsImageFillSymbolLayer, QgsLineburstSymbolLayer, QgsLinePatternFillSymbolLayer, QgsLineSymbolLayer, QgsMarkerSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsRasterLineSymbolLayer, QgsShapeburstFillSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleLineSymbolLayer, QgsSimpleMarkerSymbolLayer, QgsSVGFillSymbolLayer, QgsSvgMarkerSymbolLayer, QgsTemplatedLineSymbolLayerBase, and QgsVectorFieldSymbolLayer.

Definition at line 536 of file qgssymbollayer.h.

◆ paintEffect()

QgsPaintEffect * QgsSymbolLayer::paintEffect ( ) const

Returns the current paint effect for the layer.

Returns
paint effect
See also
setPaintEffect

Definition at line 224 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

Reimplemented in QgsSvgMarkerSymbolLayer.

Definition at line 331 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.

See also
QgsRenderContext::addSymbolLayerClipPath()
QgsRenderContext::symbolLayerClipPaths()
Since
QGIS 3.26

Definition at line 1087 of file qgssymbollayer.cpp.

◆ properties()

◆ propertyDefinitions()

const QgsPropertiesDefinition & QgsSymbolLayer::propertyDefinitions ( )
static

Returns the symbol layer property definitions.

Definition at line 347 of file qgssymbollayer.cpp.

◆ removeMasks()

void QgsSymbolLayer::removeMasks ( QgsRenderContext & context,
bool recursive )
protected

When rendering, remove previously installed masks from context painter if recursive is true masks are removed recursively for all children symbol layers.

See also
prepareMasks()
installMasks()
Since
QGIS 3.30

Definition at line 1126 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 378 of file qgssymbollayer.cpp.

◆ rendersIdenticallyTo()

bool QgsSymbolLayer::rendersIdenticallyTo ( const QgsSymbolLayer * other) const
virtual

Returns true if this symbol layer will always render identically to an other symbol layer.

Note
This method is pessimistic, in that it will return false in circumstances where it is not possible to guarantee that in 100% of cases the layer will render pixel-identically to the other layer. For instance, calling rendersIdenticallyTo() with the same symbol layer as other may return false if the symbol layer contains data-defined overrides, such as those using feature attributes or expression variables.
Since
QGIS 4.0

Reimplemented in QgsGeometryGeneratorSymbolLayer, and QgsRandomMarkerFillSymbolLayer.

Definition at line 259 of file qgssymbollayer.cpp.

◆ restoreOldDataDefinedProperties()

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

Restores older data defined properties from string map.

Definition at line 417 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, QgsCentroidFillSymbolLayer, QgsFilledLineSymbolLayer, QgsFilledMarkerSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsHashedLineSymbolLayer, QgsLinePatternFillSymbolLayer, QgsMarkerLineSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsVectorFieldSymbolLayer.

Definition at line 307 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()

Definition at line 647 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

Reimplemented in QgsHashedLineSymbolLayer, and QgsMarkerLineSymbolLayer.

Definition at line 127 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()

Definition at line 253 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()

Reimplemented in QgsEllipseSymbolLayer, QgsSimpleFillSymbolLayer, QgsSimpleMarkerSymbolLayer, and QgsSvgMarkerSymbolLayer.

Definition at line 322 of file qgssymbollayer.cpp.

◆ setId()

void QgsSymbolLayer::setId ( const QString & id)

Set symbol layer identifier This id has to be unique in the whole project.

Since
QGIS 3.30

Definition at line 1146 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 500 of file qgssymbollayer.h.

◆ setMapUnitScale()

◆ setOutputUnit()

virtual void QgsSymbolLayer::setOutputUnit ( Qgis::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

Definition at line 229 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 373 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()

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

Definition at line 312 of file qgssymbollayer.cpp.

◆ setSubSymbol()

◆ setUserFlags()

void QgsSymbolLayer::setUserFlags ( Qgis::SymbolLayerUserFlags flags)

Sets user-controlled flags which control the symbol layer's behavior.

See also
userFlags()
Since
QGIS 3.34

Definition at line 297 of file qgssymbollayer.cpp.

◆ shouldRenderUsingSelectionColor()

bool QgsSymbolLayer::shouldRenderUsingSelectionColor ( const QgsSymbolRenderContext & context) const
protected

Returns true if the symbol layer should be rendered using the selection color from the render context.

Since
QGIS 3.34

Definition at line 1141 of file qgssymbollayer.cpp.

◆ 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 QgsArrowSymbolLayer, QgsCentroidFillSymbolLayer, QgsFilledLineSymbolLayer, QgsFilledMarkerSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 132 of file qgssymbollayer.cpp.

◆ startRender()

◆ 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 QgsArrowSymbolLayer, QgsCentroidFillSymbolLayer, QgsFilledLineSymbolLayer, QgsFilledMarkerSymbolLayer, QgsGeometryGeneratorSymbolLayer, QgsInterpolatedLineSymbolLayer, QgsLinePatternFillSymbolLayer, QgsPointPatternFillSymbolLayer, QgsRandomMarkerFillSymbolLayer, and QgsTemplatedLineSymbolLayerBase.

Definition at line 140 of file qgssymbollayer.cpp.

◆ stopRender()

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

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

Definition at line 317 of file qgssymbollayer.cpp.

◆ subSymbol()

◆ toSld() [1/2]

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

◆ toSld() [2/2]

bool QgsSymbolLayer::toSld ( QDomDocument & doc,
QDomElement & element,
QgsSldExportContext & context ) const
virtual

◆ type()

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

Definition at line 463 of file qgssymbollayer.h.

◆ usedAttributes()

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

◆ userFlags()

Qgis::SymbolLayerUserFlags QgsSymbolLayer::userFlags ( ) const

Returns user-controlled flags which control the symbol layer's behavior.

See also
setUserFlags()
Since
QGIS 3.34

Definition at line 292 of file qgssymbollayer.cpp.

◆ usesMapUnits()

◆ 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 159 of file qgssymbollayer.cpp.

Member Data Documentation

◆ mClipPath

QPainterPath QgsSymbolLayer::mClipPath
protected

Definition at line 731 of file qgssymbollayer.h.

◆ mColor

QColor QgsSymbolLayer::mColor
protected

Definition at line 722 of file qgssymbollayer.h.

◆ mDataDefinedProperties

QgsPropertyCollection QgsSymbolLayer::mDataDefinedProperties
protected

Definition at line 725 of file qgssymbollayer.h.

◆ mEnabled

bool QgsSymbolLayer::mEnabled = true
protected

True if layer is enabled and should be drawn.

Definition at line 716 of file qgssymbollayer.h.

◆ mFields

QgsFields QgsSymbolLayer::mFields
protected

Definition at line 728 of file qgssymbollayer.h.

◆ mId

QString QgsSymbolLayer::mId
protected

Definition at line 724 of file qgssymbollayer.h.

◆ mLocked

bool QgsSymbolLayer::mLocked = false
protected

Definition at line 721 of file qgssymbollayer.h.

◆ mPaintEffect

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

Definition at line 727 of file qgssymbollayer.h.

◆ mRenderingPass

int QgsSymbolLayer::mRenderingPass = 0
protected

Definition at line 723 of file qgssymbollayer.h.

◆ mType

Qgis::SymbolType QgsSymbolLayer::mType
protected

Definition at line 713 of file qgssymbollayer.h.

◆ mUserFlags

Qgis::SymbolLayerUserFlags QgsSymbolLayer::mUserFlags
protected

User controlled flags.

Definition at line 719 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 737 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 739 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 735 of file qgssymbollayer.h.


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