QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgssymbollayer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssymbollayer.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSSYMBOLLAYER_H
16#define QGSSYMBOLLAYER_H
17
18#define DEG2RAD(x) ((x)*M_PI/180)
19#define DEFAULT_SCALE_METHOD Qgis::ScaleMethod::ScaleDiameter
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include "qgsfields.h"
26
27#include <QColor>
28#include <QMap>
29#include <QPointF>
30#include <QSet>
31#include <QDomDocument>
32#include <QDomElement>
33#include <QPainterPath>
34#include <QImage>
35
36class QPainter;
37class QSize;
38class QPolygonF;
39
40class QgsDxfExport;
41class QgsExpression;
43class QgsPaintEffect;
45
46#ifndef SIP_RUN
47typedef QMap<QString, QString> QgsStringMap;
48#endif
49
54class CORE_EXPORT QgsSymbolLayer
55{
56#ifdef SIP_RUN
57#include <qgslinesymbollayer.h>
58#endif
59
60
61#ifdef SIP_RUN
63 switch ( sipCpp->type() )
64 {
66 if ( sipCpp->layerType() == "EllipseMarker" )
67 sipType = sipType_QgsEllipseSymbolLayer;
68 else if ( sipCpp->layerType() == "FontMarker" )
69 sipType = sipType_QgsFontMarkerSymbolLayer;
70 else if ( sipCpp->layerType() == "SimpleMarker" )
71 sipType = sipType_QgsSimpleMarkerSymbolLayer;
72 else if ( sipCpp->layerType() == "FilledMarker" )
73 sipType = sipType_QgsFilledMarkerSymbolLayer;
74 else if ( sipCpp->layerType() == "SvgMarker" )
75 sipType = sipType_QgsSvgMarkerSymbolLayer;
76 else if ( sipCpp->layerType() == "RasterMarker" )
77 sipType = sipType_QgsRasterMarkerSymbolLayer;
78 else if ( sipCpp->layerType() == "AnimatedMarker" )
79 sipType = sipType_QgsAnimatedMarkerSymbolLayer;
80 else if ( sipCpp->layerType() == "VectorField" )
81 sipType = sipType_QgsVectorFieldSymbolLayer;
82 else if ( sipCpp->layerType() == "MaskMarker" )
83 sipType = sipType_QgsMaskMarkerSymbolLayer;
84 else
85 sipType = sipType_QgsMarkerSymbolLayer;
86 break;
87
89 if ( sipCpp->layerType() == "MarkerLine" )
90 sipType = sipType_QgsMarkerLineSymbolLayer;
91 else if ( sipCpp->layerType() == "SimpleLine" )
92 sipType = sipType_QgsSimpleLineSymbolLayer;
93 else if ( sipCpp->layerType() == "HashLine" )
94 sipType = sipType_QgsHashedLineSymbolLayer;
95 else if ( sipCpp->layerType() == "ArrowLine" )
96 sipType = sipType_QgsArrowSymbolLayer;
97 else if ( sipCpp->layerType() == "InterpolatedLine" )
98 sipType = sipType_QgsInterpolatedLineSymbolLayer;
99 else if ( sipCpp->layerType() == "RasterLine" )
100 sipType = sipType_QgsRasterLineSymbolLayer;
101 else if ( sipCpp->layerType() == "Lineburst" )
102 sipType = sipType_QgsLineburstSymbolLayer;
103 else
104 sipType = sipType_QgsLineSymbolLayer;
105 break;
106
108 if ( sipCpp->layerType() == "SimpleFill" )
109 sipType = sipType_QgsSimpleFillSymbolLayer;
110 else if ( sipCpp->layerType() == "LinePatternFill" )
111 sipType = sipType_QgsLinePatternFillSymbolLayer;
112 else if ( sipCpp->layerType() == "PointPatternFill" )
113 sipType = sipType_QgsPointPatternFillSymbolLayer;
114 else if ( sipCpp->layerType() == "SVGFill" )
115 sipType = sipType_QgsSVGFillSymbolLayer;
116 else if ( sipCpp->layerType() == "RasterFill" )
117 sipType = sipType_QgsRasterFillSymbolLayer;
118 else if ( sipCpp->layerType() == "CentroidFill" )
119 sipType = sipType_QgsCentroidFillSymbolLayer;
120 else if ( sipCpp->layerType() == "GradientFill" )
121 sipType = sipType_QgsGradientFillSymbolLayer;
122 else if ( sipCpp->layerType() == "ShapeburstFill" )
123 sipType = sipType_QgsShapeburstFillSymbolLayer;
124 else if ( sipCpp->layerType() == "RandomMarkerFill" )
125 sipType = sipType_QgsRandomMarkerFillSymbolLayer;
126 else
127 sipType = sipType_QgsFillSymbolLayer;
128 break;
129
131 sipType = sipType_QgsGeometryGeneratorSymbolLayer;
132 break;
133 }
134 SIP_END
135#endif
136 public:
137
143 {
144 PropertySize = 0,
214 };
215
220 static const QgsPropertiesDefinition &propertyDefinitions();
221
223
225 QgsSymbolLayer( const QgsSymbolLayer &other ) = delete;
226
228 QgsSymbolLayer &operator=( const QgsSymbolLayer &other ) = delete;
229
235 virtual Qgis::SymbolLayerFlags flags() const;
236
242 bool enabled() const { return mEnabled; }
243
251 void setEnabled( bool enabled ) { mEnabled = enabled; }
252
267 virtual QColor color() const;
268
280 virtual void setColor( const QColor &color );
281
293 virtual void setStrokeColor( const QColor &color );
294
307 virtual QColor strokeColor() const;
308
320 virtual void setFillColor( const QColor &color );
321
334 virtual QColor fillColor() const;
335
340 virtual QString layerType() const = 0;
341
354 virtual void startRender( QgsSymbolRenderContext &context ) = 0;
355
367 virtual void stopRender( QgsSymbolRenderContext &context ) = 0;
368
387 virtual void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context );
388
407 virtual void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context );
408
412 virtual QgsSymbolLayer *clone() const = 0 SIP_FACTORY;
413
415 virtual void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const
416 { Q_UNUSED( props ) element.appendChild( doc.createComment( QStringLiteral( "SymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); }
417
418 virtual QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const { Q_UNUSED( mmScaleFactor ) Q_UNUSED( mapUnitScaleFactor ); return QString(); }
419
425 virtual QVariantMap properties() const = 0;
426
427 virtual void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) = 0;
428
432 virtual QgsSymbol *subSymbol();
433
435 virtual bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER );
436
437 Qgis::SymbolType type() const { return mType; }
438
440 virtual bool isCompatibleWithSymbol( QgsSymbol *symbol ) const;
441
450 virtual bool canCauseArtifactsBetweenAdjacentTiles() const;
451
459 void setLocked( bool locked ) { mLocked = locked; }
460
466 bool isLocked() const { return mLocked; }
467
475 virtual double estimateMaxBleed( const QgsRenderContext &context ) const { Q_UNUSED( context ) return 0; }
476
485 virtual void setOutputUnit( Qgis::RenderUnit unit ) { Q_UNUSED( unit ) }
486
495 virtual Qgis::RenderUnit outputUnit() const { return Qgis::RenderUnit::Unknown; }
496
502 virtual bool usesMapUnits() const;
503
504 virtual void setMapUnitScale( const QgsMapUnitScale &scale ) { Q_UNUSED( scale ) }
505 virtual QgsMapUnitScale mapUnitScale() const { return QgsMapUnitScale(); }
506
513 void setRenderingPass( int renderingPass );
514
521 int renderingPass() const;
522
527 virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
528
536 virtual void setDataDefinedProperty( Property key, const QgsProperty &property );
537
539 virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
540
542 virtual double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
543
545 virtual double dxfSize( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
546
548 virtual double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
549
551 virtual QColor dxfColor( QgsSymbolRenderContext &context ) const;
552
554 virtual double dxfAngle( QgsSymbolRenderContext &context ) const;
555
557 virtual QVector<qreal> dxfCustomDashPattern( Qgis::RenderUnit &unit ) const;
558
560 virtual Qt::PenStyle dxfPenStyle() const;
561
563 virtual QColor dxfBrushColor( QgsSymbolRenderContext &context ) const;
564
566 virtual Qt::BrushStyle dxfBrushStyle() const;
567
574 QgsPaintEffect *paintEffect() const;
575
582 void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
583
590 virtual void prepareExpressions( const QgsSymbolRenderContext &context );
591
598 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
599
605 const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } SIP_SKIP
606
613 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
614
620 virtual bool hasDataDefinedProperties() const;
621
627 virtual QList<QgsSymbolLayerReference> masks() const;
628
636 virtual void prepareMasks( const QgsSymbolRenderContext &context );
637
643 void setId( const QString &id );
644
650 QString id() const;
651
652 protected:
653
659 QgsSymbolLayer( Qgis::SymbolType type, bool locked = false );
660
662
664 bool mEnabled = true;
665
666 bool mLocked = false;
667 QColor mColor;
668 int mRenderingPass = 0;
669 QString mId;
671
672 std::unique_ptr< QgsPaintEffect > mPaintEffect;
674
675 // clip path to be used during rendering
676 QPainterPath mClipPath;
677
678 // Configuration of selected symbology implementation
680 static const bool SELECTION_IS_OPAQUE = true;
682 static const bool SELECT_FILL_BORDER = false;
684 static const bool SELECT_FILL_STYLE = false;
685
690 void restoreOldDataDefinedProperties( const QVariantMap &stringMap );
691
696 void copyDataDefinedProperties( QgsSymbolLayer *destLayer ) const;
697
703 void copyPaintEffect( QgsSymbolLayer *destLayer ) const;
704
712 void installMasks( QgsRenderContext &context, bool recursive );
713
721 void removeMasks( QgsRenderContext &context, bool recursive );
722
723 private:
724 static void initPropertyDefinitions();
725
727 static QgsPropertiesDefinition sPropertyDefinitions;
728
729#ifdef SIP_RUN
730 QgsSymbolLayer( const QgsSymbolLayer &other );
731#endif
732
733};
734
736
742class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
743{
744 public:
745
748 {
752 };
753
756 {
760 };
761
764
767
768 void startRender( QgsSymbolRenderContext &context ) override;
769
770 void stopRender( QgsSymbolRenderContext &context ) override;
771
778 virtual void renderPoint( QPointF point, QgsSymbolRenderContext &context ) = 0;
779
780 void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
781
788 void setAngle( double angle ) { mAngle = angle; }
789
794 double angle() const { return mAngle; }
795
805 void setLineAngle( double lineAngle ) { mLineAngle = lineAngle; }
806
814 virtual void setSize( double size ) { mSize = size; }
815
822 double size() const { return mSize; }
823
831 void setSizeUnit( Qgis::RenderUnit unit ) { mSizeUnit = unit; }
832
839 Qgis::RenderUnit sizeUnit() const { return mSizeUnit; }
840
848 void setSizeMapUnitScale( const QgsMapUnitScale &scale ) { mSizeMapUnitScale = scale; }
849
856 const QgsMapUnitScale &sizeMapUnitScale() const { return mSizeMapUnitScale; }
857
863 void setScaleMethod( Qgis::ScaleMethod scaleMethod ) { mScaleMethod = scaleMethod; }
864
869 Qgis::ScaleMethod scaleMethod() const { return mScaleMethod; }
870
879 void setOffset( QPointF offset ) { mOffset = offset; }
880
888 QPointF offset() const { return mOffset; }
889
897 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
898
905 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
906
914 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
915
922 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
923
931 void setHorizontalAnchorPoint( HorizontalAnchorPoint h ) { mHorizontalAnchorPoint = h; }
932
939 HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizontalAnchorPoint; }
940
948 void setVerticalAnchorPoint( VerticalAnchorPoint v ) { mVerticalAnchorPoint = v; }
949
956 VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAnchorPoint; }
957
958 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
959
966 virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const
967 { Q_UNUSED( props ) element.appendChild( doc.createComment( QStringLiteral( "QgsMarkerSymbolLayer %1 not implemented yet" ).arg( layerType() ) ) ); }
968
969 void setOutputUnit( Qgis::RenderUnit unit ) override;
970 Qgis::RenderUnit outputUnit() const override;
971 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
972 QgsMapUnitScale mapUnitScale() const override;
973 virtual double dxfSize( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
974 virtual double dxfAngle( QgsSymbolRenderContext &context ) const override;
975
982 virtual QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) = 0;
983
984 protected:
985
990 QgsMarkerSymbolLayer( bool locked = false );
991
999 void markerOffset( QgsSymbolRenderContext &context, double &offsetX, double &offsetY ) const;
1000
1011 void markerOffset( QgsSymbolRenderContext &context, double width, double height, double &offsetX, double &offsetY ) const SIP_PYNAME( markerOffsetWithWidthAndHeight );
1012
1014 void markerOffset( QgsSymbolRenderContext &context, double width, double height,
1015 Qgis::RenderUnit widthUnit, Qgis::RenderUnit heightUnit,
1016 double &offsetX, double &offsetY,
1017 const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const SIP_PYNAME( markerOffset2 );
1018
1025 static QPointF _rotatedOffset( QPointF offset, double angle );
1026
1028 double mAngle = 0;
1030 double mLineAngle = 0;
1032 double mSize = 2.0;
1034 Qgis::RenderUnit mSizeUnit = Qgis::RenderUnit::Millimeters;
1038 QPointF mOffset;
1040 Qgis::RenderUnit mOffsetUnit = Qgis::RenderUnit::Millimeters;
1046 HorizontalAnchorPoint mHorizontalAnchorPoint = HCenter;
1048 VerticalAnchorPoint mVerticalAnchorPoint = VCenter;
1049
1050 private:
1051 static QgsMarkerSymbolLayer::HorizontalAnchorPoint decodeHorizontalAnchorPoint( const QString &str );
1052 static QgsMarkerSymbolLayer::VerticalAnchorPoint decodeVerticalAnchorPoint( const QString &str );
1053
1054#ifdef SIP_RUN
1056#endif
1057};
1058
1063class CORE_EXPORT QgsLineSymbolLayer : public QgsSymbolLayer
1064{
1065 public:
1066
1069 {
1073 };
1074
1076 QgsLineSymbolLayer( const QgsLineSymbolLayer &other ) = delete;
1077
1080
1081 void setOutputUnit( Qgis::RenderUnit unit ) override;
1082 Qgis::RenderUnit outputUnit() const override;
1083 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1084 QgsMapUnitScale mapUnitScale() const override;
1085 void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
1086 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
1087
1092 virtual void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) = 0;
1093
1102 virtual void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context );
1103
1117 virtual void setWidth( double width ) { mWidth = width; }
1118
1128 virtual double width() const { return mWidth; }
1129
1140 virtual double width( const QgsRenderContext &context ) const;
1141
1151 double offset() const { return mOffset; }
1152
1162 void setOffset( double offset ) { mOffset = offset; }
1163
1170 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
1171
1178 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
1179
1186 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
1187
1194 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
1195
1196 // TODO QGIS 4.0 - setWidthUnit(), widthUnit(), setWidthUnitScale(), widthUnitScale()
1197 // only apply to simple line symbol layers and do not belong here.
1198
1204 void setWidthUnit( Qgis::RenderUnit unit ) { mWidthUnit = unit; }
1205
1210 Qgis::RenderUnit widthUnit() const { return mWidthUnit; }
1211
1212 void setWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWidthMapUnitScale = scale; }
1213 const QgsMapUnitScale &widthMapUnitScale() const { return mWidthMapUnitScale; }
1214
1225 RenderRingFilter ringFilter() const;
1226
1237 void setRingFilter( QgsLineSymbolLayer::RenderRingFilter filter );
1238
1239 protected:
1240 QgsLineSymbolLayer( bool locked = false );
1241
1242 double mWidth = 0;
1243 Qgis::RenderUnit mWidthUnit = Qgis::RenderUnit::Millimeters;
1245 double mOffset = 0;
1246 Qgis::RenderUnit mOffsetUnit = Qgis::RenderUnit::Millimeters;
1248
1249 RenderRingFilter mRingFilter = AllRings;
1250
1251 private:
1252#ifdef SIP_RUN
1253 QgsLineSymbolLayer( const QgsLineSymbolLayer &other );
1254#endif
1255};
1256
1261class CORE_EXPORT QgsFillSymbolLayer : public QgsSymbolLayer
1262{
1263 public:
1264
1266 QgsFillSymbolLayer( const QgsFillSymbolLayer &other ) = delete;
1267
1270
1276 virtual void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) = 0;
1277
1278 void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
1279
1287 void setAngle( double angle ) { mAngle = angle; }
1288
1296 double angle() const { return mAngle; }
1297
1308 virtual QImage toTiledPatternImage( ) const;
1309
1310 protected:
1311 QgsFillSymbolLayer( bool locked = false );
1313 void _renderPolygon( QPainter *p, const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context );
1314
1315 double mAngle = 0.0;
1316
1317 private:
1318#ifdef SIP_RUN
1319 QgsFillSymbolLayer( const QgsFillSymbolLayer &other );
1320#endif
1321};
1322
1323class QgsSymbolLayerWidget; // why does SIP fail, when this isn't here
1324
1325#endif
ScaleMethod
Scale methods.
Definition: qgis.h:354
@ ScaleDiameter
Calculate scale by the diameter.
RenderUnit
Rendering size units.
Definition: qgis.h:3441
SymbolType
Attribute editing capabilities which may be supported by vector data providers.
Definition: qgis.h:340
@ Marker
Marker symbol.
@ Line
Line symbol.
@ Fill
Fill symbol.
@ Hybrid
Hybrid symbol.
Exports QGIS layers to the DXF format.
Definition: qgsdxfexport.h:65
Class for parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Container of fields for a vector layer.
Definition: qgsfields.h:45
virtual void renderPolygon(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)=0
Renders the fill symbol layer for the polygon whose outer ring is defined by points,...
double angle() const
Returns the rotation angle of the fill symbol, in degrees clockwise.
void setAngle(double angle)
Sets the rotation angle of the pattern, in degrees clockwise.
QgsFillSymbolLayer & operator=(const QgsFillSymbolLayer &other)=delete
QgsFillSymbolLayer cannot be copied.
QgsFillSymbolLayer(const QgsFillSymbolLayer &other)=delete
QgsFillSymbolLayer cannot be copied.
const QgsMapUnitScale & widthMapUnitScale() const
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon's rings.
@ ExteriorRingOnly
Render the exterior ring only.
@ InteriorRingsOnly
Render the interior rings only.
@ AllRings
Render both exterior and interior rings.
QgsLineSymbolLayer & operator=(const QgsLineSymbolLayer &other)=delete
QgsLineSymbolLayer cannot be copied.
QgsMapUnitScale mWidthMapUnitScale
virtual void setWidth(double width)
Sets the width of the line symbol layer.
QgsLineSymbolLayer(const QgsLineSymbolLayer &other)=delete
QgsLineSymbolLayer cannot be copied.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
void setOffset(double offset)
Sets the line's offset.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context.
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the line's offset.
void setWidthUnit(Qgis::RenderUnit unit)
Sets the units for the line's width.
virtual double width() const
Returns the estimated width for the line symbol layer.
QgsMapUnitScale mOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the line's offset.
double offset() const
Returns the line's offset.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line's offset.
Qgis::RenderUnit offsetUnit() const
Returns the units for the line's offset.
Qgis::RenderUnit widthUnit() const
Returns the units for the line's width.
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual void setSize(double size)
Sets the symbol size.
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
HorizontalAnchorPoint
Symbol horizontal anchor points.
@ Right
Align to right side of symbol.
@ HCenter
Align to horizontal center of symbol.
@ Left
Align to left side of symbol.
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's offset.
void setAngle(double angle)
Sets the rotation angle for the marker.
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QPointF mOffset
Marker offset.
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
double size() const
Returns the symbol size.
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
QgsMarkerSymbolLayer(const QgsMarkerSymbolLayer &other)=delete
QgsMarkerSymbolLayer cannot be copied.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the symbol's offset.
Qgis::RenderUnit offsetUnit() const
Returns the units for the symbol's offset.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
QgsMarkerSymbolLayer & operator=(const QgsMarkerSymbolLayer &other)=delete
QgsMarkerSymbolLayer cannot be copied.
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
Qgis::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's size.
VerticalAnchorPoint
Symbol vertical anchor points.
@ VCenter
Align to vertical center of symbol.
@ Bottom
Align to bottom of symbol.
@ Top
Align to top of symbol.
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
Writes the symbol layer definition as a SLD XML element.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
Base class for visual effects which can be applied to QPicture drawings.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
A store for object properties.
Definition: qgsproperty.h:230
Contains information about the context of a rendering operation.
Type used to refer to a specific symbol layer in a symbol of a layer.
Property
Data definable properties.
@ PropertyGradientReference1X
Gradient reference point 1 x.
@ PropertyShapeburstIgnoreRings
Shapeburst ignore rings.
@ PropertyGradientReference2X
Gradient reference point 2 x.
@ PropertyStrokeStyle
Stroke style (eg solid, dashed)
@ PropertyPlacement
Line marker placement.
@ PropertyHorizontalAnchor
Horizontal anchor point.
@ PropertyPreserveAspectRatio
Preserve aspect ratio between width and height.
@ PropertyDistanceX
Horizontal distance between points.
@ PropertyFile
Filename, eg for svg files.
@ PropertyGradientType
Gradient fill type.
@ PropertyCapStyle
Line cap style.
@ PropertyLineEndWidthValue
End line width for interpolated line renderer (since QGIS 3.22)
@ PropertyLineEndColorValue
End line color for interpolated line renderer (since QGIS 3.22)
@ PropertyAngle
Symbol angle.
@ PropertyLineClipping
Line clipping mode (since QGIS 3.24)
@ PropertyDistanceY
Vertical distance between points.
@ PropertyDisplacementX
Horizontal displacement.
@ PropertyVerticalAnchor
Vertical anchor point.
@ PropertyGradientSpread
Gradient spread mode.
@ PropertyOffsetY
Vertical offset.
@ PropertyGradientReference1Y
Gradient reference point 1 y.
@ PropertyLineDistance
Distance between lines, or length of lines for hash line symbols.
@ PropertyOffsetAlongLine
Offset along line.
@ PropertyLineStartColorValue
Start line color for interpolated line renderer (since QGIS 3.22)
@ PropertyArrowStartWidth
Arrow tail start width.
@ PropertyBlurRadius
Shapeburst blur radius.
@ PropertyGradientReference2Y
Gradient reference point 2 y.
@ PropertyMarkerClipping
Marker clipping mode (since QGIS 3.24)
@ PropertyDensityArea
Density area.
@ PropertyArrowHeadLength
Arrow head length.
@ PropertyGradientReference1IsCentroid
Gradient reference point 1 is centroid.
@ PropertyCustomDash
Custom dash pattern.
@ PropertyShapeburstUseWholeShape
Shapeburst use whole shape.
@ PropertyArrowHeadThickness
Arrow head thickness.
@ PropertyOffsetX
Horizontal offset.
@ PropertyJoinStyle
Line join style.
@ PropertyLineStartWidthValue
Start line width for interpolated line renderer (since QGIS 3.22)
@ PropertyTrimEnd
Trim distance from end of line (since QGIS 3.20)
@ PropertyOpacity
Opacity.
@ PropertySecondaryColor
Secondary color (eg for gradient fills)
@ PropertyCharacter
Character, eg for font marker symbol layers.
@ PropertyCoordinateMode
Gradient coordinate mode.
@ PropertyRandomOffsetY
Random offset Y (since QGIS 3.24)
@ PropertyLineAngle
Line angle, or angle of hash lines for hash line symbols.
@ PropertyShapeburstMaxDistance
Shapeburst fill from edge distance.
@ PropertyTrimStart
Trim distance from start of line (since QGIS 3.20)
@ PropertyOffset
Symbol offset.
@ PropertyStrokeWidth
Stroke width.
@ PropertyDashPatternOffset
Dash pattern offset,.
@ PropertyFillColor
Fill color.
@ PropertyArrowHeadType
Arrow head type.
@ PropertyFontStyle
Font style.
@ PropertyHeight
Symbol height.
@ PropertyClipPoints
Whether markers should be clipped to polygon boundaries.
@ PropertyFontFamily
Font family.
@ PropertyPointCount
Point count.
@ PropertyRandomSeed
Random number seed.
@ PropertyLayerEnabled
Whether symbol layer is enabled.
@ PropertyName
Name, eg shape name for simple markers.
@ PropertyAverageAngleLength
Length to average symbol angles over.
@ PropertyInterval
Line marker interval.
@ PropertyRandomOffsetX
Random offset X (since QGIS 3.24)
@ PropertyFillStyle
Fill style (eg solid, dots)
@ PropertyArrowType
Arrow type.
@ PropertyDisplacementY
Vertical displacement.
@ PropertyStrokeColor
Stroke color.
@ PropertyGradientReference2IsCentroid
Gradient reference point 2 is centroid.
@ PropertyArrowWidth
Arrow tail width.
@ PropertyWidth
Symbol width.
QgsFields mFields
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Qgis::SymbolType type() const
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the symbol layer's property collection, used for data defined overrides.
QPainterPath mClipPath
bool isLocked() const
Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color c...
virtual QgsMapUnitScale mapUnitScale() const
Qgis::SymbolType mType
virtual void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
Saves the symbol layer as SLD.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
QgsSymbolLayer(const QgsSymbolLayer &other)=delete
QgsSymbolLayer cannot be copied.
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
std::unique_ptr< QgsPaintEffect > mPaintEffect
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
virtual Qgis::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol layer.
void setLocked(bool locked)
Sets whether the layer's colors are locked.
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
virtual ~QgsSymbolLayer()
virtual void setOutputUnit(Qgis::RenderUnit unit)
Sets the units to use for sizes and widths within the symbol layer.
virtual void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size)=0
QgsPropertyCollection mDataDefinedProperties
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
QgsSymbolLayer & operator=(const QgsSymbolLayer &other)=delete
QgsSymbolLayer cannot be copied.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol layer's property collection, used for data defined overrides.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:94
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
#define str(x)
Definition: qgis.cpp:38
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:203
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
QMap< QString, QString > QgsStringMap