QGIS API Documentation 3.41.0-Master (88383c3d16f)
Loading...
Searching...
No Matches
qgsmarkersymbollayer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmarkersymbollayer.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
16#ifndef QGSMARKERSYMBOLLAYER_H
17#define QGSMARKERSYMBOLLAYER_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgssymbollayer.h"
22
23#define DEFAULT_SIMPLEMARKER_NAME "circle"
24#define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0)
25#define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor( 35, 35, 35 )
26#define DEFAULT_SIMPLEMARKER_JOINSTYLE Qt::BevelJoin
27#define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE
28#define DEFAULT_SIMPLEMARKER_ANGLE 0
29
30#include <QPen>
31#include <QBrush>
32#include <QPicture>
33#include <QPolygonF>
34#include <QFont>
35
36class QgsFillSymbol;
37class QgsPathResolver;
38
46{
47
48 public:
49
51 static QList< Qgis::MarkerShape > availableShapes();
52
58 static bool shapeIsFilled( Qgis::MarkerShape shape );
59
68 double size = DEFAULT_SIMPLEMARKER_SIZE,
69 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
71
73
78 Qgis::MarkerShape shape() const { return mShape; }
79
85 void setShape( Qgis::MarkerShape shape ) { mShape = shape; }
86
95 static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = nullptr );
96
103 static QString encodeShape( Qgis::MarkerShape shape );
104
105 void startRender( QgsSymbolRenderContext &context ) override;
106 void stopRender( QgsSymbolRenderContext &context ) override;
107 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
108 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
109
110 protected:
111
115 bool prepareMarkerShape( Qgis::MarkerShape shape );
116
120 bool prepareMarkerPath( Qgis::MarkerShape symbol );
121
128 bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
129
136 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
137
146 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
147
149 QPolygonF mPolygon;
150
152 QPainterPath mPath;
153
156
157 private:
158
167 virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
168};
169
176{
177 public:
178
190 double size = DEFAULT_SIMPLEMARKER_SIZE,
191 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
193 const QColor &color = DEFAULT_SIMPLEMARKER_COLOR,
194 const QColor &strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
195 Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
196
198
199 // static methods
200
206 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
207
213 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
214
215 // reimplemented from base classes
216
217 QString layerType() const override;
218 Qgis::SymbolLayerFlags flags() const override;
219 void startRender( QgsSymbolRenderContext &context ) override;
220 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
221 QVariantMap properties() const override;
222 QgsSimpleMarkerSymbolLayer *clone() const override SIP_FACTORY;
223 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
224 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
225 bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
226 void setOutputUnit( Qgis::RenderUnit unit ) override;
227 Qgis::RenderUnit outputUnit() const override;
228 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
229 QgsMapUnitScale mapUnitScale() const override;
230 bool usesMapUnits() const override;
231 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
232 QColor fillColor() const override { return mColor; }
233 void setFillColor( const QColor &color ) override { mColor = color; }
234 void setColor( const QColor &color ) override;
235 QColor color() const override;
236
237 // new methods
238
245 QColor strokeColor() const override { return mStrokeColor; }
246
254 void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
255
262 Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
263
271 void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
272
280 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
281
290 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
291
300 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
301
310 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
311
318 double strokeWidth() const { return mStrokeWidth; }
319
327 void setStrokeWidth( double w ) { mStrokeWidth = w; }
328
336 void setStrokeWidthUnit( Qgis::RenderUnit u ) { mStrokeWidthUnit = u; }
337
344 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
345
353 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
354
361 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
362
363 protected:
364
371 void drawMarker( QPainter *p, QgsSymbolRenderContext &context );
372
377 bool prepareCache( QgsSymbolRenderContext &context );
378
382 Qt::PenStyle mStrokeStyle = Qt::SolidLine;
384 double mStrokeWidth = 0;
390 Qt::PenJoinStyle mPenJoinStyle;
392 Qt::PenCapStyle mPenCapStyle = Qt::SquareCap;
394 QPen mPen;
396 QBrush mBrush;
397
399 QImage mCache;
403 QBrush mSelBrush;
405 QImage mSelCache;
406
411 bool mUsingCache = false;
412
414 static const int MAXIMUM_CACHE_WIDTH = 3000;
415
416 private:
417 // cppcheck-suppress unusedPrivateFunction
418 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
419
420 double mCachedOpacity = 1.0;
421
422};
423
431{
432 public:
433
442 double size = DEFAULT_SIMPLEMARKER_SIZE,
443 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
445
447
453 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
454
455 QString layerType() const override;
456 void startRender( QgsSymbolRenderContext &context ) override;
457 void stopRender( QgsSymbolRenderContext &context ) override;
458 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
459 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
460 QVariantMap properties() const override;
461 QgsFilledMarkerSymbolLayer *clone() const override SIP_FACTORY;
462 QgsSymbol *subSymbol() override;
463 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
464 double estimateMaxBleed( const QgsRenderContext &context ) const override;
465 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
466 bool hasDataDefinedProperties() const override;
467 void setColor( const QColor &c ) override;
468 QColor color() const override;
469 bool usesMapUnits() const override;
470 void setOutputUnit( Qgis::RenderUnit unit ) override;
471
472 private:
473#ifdef SIP_RUN
475#endif
476
477 // cppcheck-suppress unusedPrivateFunction
478 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
479
481 std::unique_ptr< QgsFillSymbol > mFill;
482};
483
485
486#define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE
487#define DEFAULT_SVGMARKER_ANGLE 0
488
494{
495 public:
497 QgsSvgMarkerSymbolLayer( const QString &path,
498 double size = DEFAULT_SVGMARKER_SIZE,
499 double angle = DEFAULT_SVGMARKER_ANGLE,
502
504
505 // static stuff
506
508 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
509 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
510
515 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
516
517 // implemented from base classes
518
519 QString layerType() const override;
520 Qgis::SymbolLayerFlags flags() const override;
521 void startRender( QgsSymbolRenderContext &context ) override;
522 void stopRender( QgsSymbolRenderContext &context ) override;
523 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
524 QVariantMap properties() const override;
525 bool usesMapUnits() const override;
526 QgsSvgMarkerSymbolLayer *clone() const override SIP_FACTORY;
527 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
528
533 QString path() const { return mPath; }
534
540 void setPath( const QString &path );
541
546 double defaultAspectRatio() const { return mDefaultAspectRatio; }
547
553 double updateDefaultAspectRatio();
554
559 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
560
567 bool setPreservedAspectRatio( bool par );
568
575 double fixedAspectRatio() const { return mFixedAspectRatio; }
576
584 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
585
586 QColor fillColor() const override { return color(); }
587 void setFillColor( const QColor &color ) override { setColor( color ); }
588
589 QColor strokeColor() const override { return mStrokeColor; }
590 void setStrokeColor( const QColor &c ) override { mStrokeColor = c; }
591
592 double strokeWidth() const { return mStrokeWidth; }
593 void setStrokeWidth( double w ) { mStrokeWidth = w; }
594
599 QMap<QString, QgsProperty> parameters() const { return mParameters; }
600
605 void setParameters( const QMap<QString, QgsProperty> &parameters );
606
612 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
613
618 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
619
620 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
621 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
622
623 void setOutputUnit( Qgis::RenderUnit unit ) override;
624 Qgis::RenderUnit outputUnit() const override;
625
626 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
627 QgsMapUnitScale mapUnitScale() const override;
628
629 bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
630
631 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
632
633 void prepareExpressions( const QgsSymbolRenderContext &context ) override;
634
635 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
636
637 protected:
638
645 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
646
647 QString mPath;
648
650 double mDefaultAspectRatio = 0.0;
652 double mFixedAspectRatio = 0.0;
653 //param(fill), param(stroke), param(stroke-width) are going
654 //to be replaced in memory
655 bool mHasFillParam = false;
658 QMap<QString, QgsProperty> mParameters;
659
662
663 private:
664 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
665 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
666
667};
668
669
671
672#define DEFAULT_RASTERMARKER_SIZE 2*DEFAULT_POINT_SIZE
673#define DEFAULT_RASTERMARKER_ANGLE 0
674
682{
683 public:
685 QgsRasterMarkerSymbolLayer( const QString &path = QString(),
686 double size = DEFAULT_SVGMARKER_SIZE,
687 double angle = DEFAULT_SVGMARKER_ANGLE,
689
691
692 // static stuff
693
698 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
699
704 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
705
706 // implemented from base classes
707
708 QString layerType() const override;
709 Qgis::SymbolLayerFlags flags() const override;
710 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
711 QVariantMap properties() const override;
712 QgsRasterMarkerSymbolLayer *clone() const override SIP_FACTORY;
713 bool usesMapUnits() const override;
714 QColor color() const override;
715
722 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
723
728 QString path() const { return mPath; }
729
735 void setPath( const QString &path );
736
742 double opacity() const { return mOpacity; }
743
749 void setOpacity( double opacity ) { mOpacity = opacity; }
750
755 double defaultAspectRatio() const { return mDefaultAspectRatio; }
756
762 double updateDefaultAspectRatio();
763
768 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
769
776 bool setPreservedAspectRatio( bool par );
777
784 double fixedAspectRatio() const { return mFixedAspectRatio; }
785
793 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
794
795 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
796 QgsMapUnitScale mapUnitScale() const override;
797
798 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
799
800 protected:
801
807 void setCommonProperties( const QVariantMap &properties );
808
814 void copyCommonProperties( QgsRasterMarkerSymbolLayer *other ) const;
815
821 virtual QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const SIP_SKIP;
822
823 QString mPath;
825 double mOpacity = 1.0;
827 double mDefaultAspectRatio = 0.0;
829 double mFixedAspectRatio = 0.0;
830
831 private:
832 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
833 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
834
835};
836
837
839
840#define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch
841#define MM2POINT(x) ( (x) * 72 / 25.4 )
842
843#define DEFAULT_FONTMARKER_FONT "Dingbats"
844#define DEFAULT_FONTMARKER_CHR QChar('A')
845#define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
846#define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
847#define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
848#define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
849#define DEFAULT_FONTMARKER_ANGLE 0
850
856{
857 public:
858
860 QgsFontMarkerSymbolLayer( const QString &fontFamily = DEFAULT_FONTMARKER_FONT,
861 QString chr = DEFAULT_FONTMARKER_CHR,
862 double pointSize = DEFAULT_FONTMARKER_SIZE,
863 const QColor &color = DEFAULT_FONTMARKER_COLOR,
864 double angle = DEFAULT_FONTMARKER_ANGLE );
865
867
868 // static stuff
869
873 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
874
878 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
879
886 static void resolveFonts( const QVariantMap &properties, const QgsReadWriteContext &context );
887
888 // implemented from base classes
889
890 QString layerType() const override;
891 Qgis::SymbolLayerFlags flags() const override;
892
893 void startRender( QgsSymbolRenderContext &context ) override;
894
895 void stopRender( QgsSymbolRenderContext &context ) override;
896
897 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
898
899 QVariantMap properties() const override;
900
901 QgsFontMarkerSymbolLayer *clone() const override SIP_FACTORY;
902
903 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
904 bool usesMapUnits() const override;
905 void setOutputUnit( Qgis::RenderUnit unit ) override;
906
907 // new methods
908
914 QString fontFamily() const { return mFontFamily; }
915
921 void setFontFamily( const QString &family ) { mFontFamily = family; }
922
929 QString fontStyle() const { return mFontStyle; }
930
937 void setFontStyle( const QString &style ) { mFontStyle = style; }
938
944 QString character() const { return mString; }
945
951 void setCharacter( QString chr ) { mString = chr; }
952
953 QColor strokeColor() const override { return mStrokeColor; }
954 void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
955
964 double strokeWidth() const { return mStrokeWidth; }
965
974 void setStrokeWidth( double width ) { mStrokeWidth = width; }
975
984 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
985
993 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
994
1003 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
1004
1013 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
1014
1021 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1022
1029 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1030
1031 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
1032
1033 private:
1034
1035 QString mFontFamily;
1036 QString mFontStyle;
1037 QFont mFont;
1038 std::unique_ptr< QFontMetrics >mFontMetrics;
1039
1040 QString mString;
1041
1042 double mChrWidth = 0;
1043 QPointF mChrOffset;
1045 double mFontSizeScale = 1.0;
1046 double mOrigSize;
1047
1048 QColor mStrokeColor;
1049 double mStrokeWidth;
1050 Qgis::RenderUnit mStrokeWidthUnit;
1051 QgsMapUnitScale mStrokeWidthMapUnitScale;
1052 Qt::PenJoinStyle mPenJoinStyle;
1053
1054 QPen mPen;
1055 QBrush mBrush;
1056
1057 bool mUseCachedPath = false;
1058 QPainterPath mCachedPath;
1059
1060 // If font has a zero (or nearly zero) size, we skip rendering altogether..
1061 bool mNonZeroFontSize = true;
1062
1063 QString characterToRender( QgsSymbolRenderContext &context, QPointF &charOffset, double &charWidth );
1064 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
1065 double calculateSize( QgsSymbolRenderContext &context );
1066};
1067
1068
1080{
1081 public:
1082
1086 QgsAnimatedMarkerSymbolLayer( const QString &path = QString(),
1087 double size = DEFAULT_RASTERMARKER_SIZE,
1088 double angle = DEFAULT_RASTERMARKER_ANGLE );
1089
1091
1092 // static stuff
1093
1097 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY; // cppcheck-suppress duplInheritedMember
1098
1099 // implemented from base classes
1100
1101 QString layerType() const override;
1102 QVariantMap properties() const override;
1103 QgsAnimatedMarkerSymbolLayer *clone() const override SIP_FACTORY;
1104
1110 void setFrameRate( double rate ) { mFrameRateFps = rate; }
1111
1117 double frameRate() const { return mFrameRateFps; }
1118
1119 void startRender( QgsSymbolRenderContext &context ) override;
1120
1121 protected:
1122 QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const override SIP_SKIP;
1123
1124 private:
1125 double mFrameRateFps = 10;
1126 bool mStaticPath = false;
1127 mutable QSet< QString > mPreparedPaths;
1128
1129};
1130
1131// clazy:excludeall=qstring-allocations
1132
1133#endif
1134
1135
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ScaleMethod
Scale methods.
Definition qgis.h:588
MarkerShape
Marker shapes.
Definition qgis.h:2940
RenderUnit
Rendering size units.
Definition qgis.h:4930
@ Millimeters
Millimeters.
Animated marker symbol layer class.
~QgsAnimatedMarkerSymbolLayer() override
double frameRate() const
Returns the marker frame rate in frame per second.
Exports QGIS layers to the DXF format.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
~QgsFilledMarkerSymbolLayer() override
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the stroke width unit.
~QgsFontMarkerSymbolLayer() override
void setStrokeColor(const QColor &color) override
Sets the stroke color for the symbol layer.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
Qgis::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
double strokeWidth() const
Returns the marker's stroke width.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
void setStrokeWidth(double width)
Set's the marker's stroke width.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
QString character() const
Returns the character(s) used when rendering points.
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QgsMapUnitScale mapUnitScale() const override
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Resolves relative paths into absolute paths and vice versa.
Raster marker symbol layer class.
void setOpacity(double opacity)
Set the marker opacity.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
~QgsRasterMarkerSymbolLayer() override
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
double opacity() const
Returns the marker opacity.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Abstract base class for simple marker symbol layers.
Qgis::MarkerShape mShape
Symbol shape.
QPainterPath mPath
Painter path representing shape. If mPolygon is empty then the shape is stored in mPath.
~QgsSimpleMarkerSymbolLayerBase() override
QPolygonF mPolygon
Polygon of points in shape. If polygon is empty then shape is using mPath.
Qgis::MarkerShape shape() const
Returns the shape for the rendered marker symbol.
void setShape(Qgis::MarkerShape shape)
Sets the rendered marker shape.
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
QPen mSelPen
QPen to use as stroke of selected symbols.
QImage mSelCache
Cached image of selected marker, if using cached version.
QImage mCache
Cached image of marker, if using cached version.
QBrush mSelBrush
QBrush to use as fill of selected symbols.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
Qt::PenJoinStyle penJoinStyle() const
Returns the marker's stroke join style (e.g., miter, bevel, etc).
QPen mPen
QPen corresponding to marker's stroke style.
void setStrokeWidthUnit(Qgis::RenderUnit u)
Sets the unit for the width of the marker's stroke.
~QgsSimpleMarkerSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the marker's stroke cap style (e.g., flat, round, etc).
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker's stroke.
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker's stroke style (e.g., solid, dashed, etc)
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker's stroke.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
QColor strokeColor() const override
Returns the marker's stroke color.
QBrush mBrush
QBrush corresponding to marker's fill style.
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
Qt::PenStyle strokeStyle() const
Returns the marker's stroke style (e.g., solid, dashed, etc)
Qgis::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the marker's stroke cap style (e.g., flat, round, etc).
QgsMapUnitScale mStrokeWidthMapUnitScale
Stroke width map unit scale.
double strokeWidth() const
Returns the width of the marker's stroke.
Qt::PenJoinStyle mPenJoinStyle
Stroke pen join style.
QColor fillColor() const override
Returns the fill color for the symbol layer.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
QMap< QString, QgsProperty > mParameters
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the units for the stroke width.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setStrokeColor(const QColor &c) override
Sets the stroke color for the symbol layer.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
Qgis::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
~QgsSvgMarkerSymbolLayer() override
QMap< QString, QgsProperty > parameters() const
Returns the dynamic SVG parameters.
QgsMapUnitScale mStrokeWidthMapUnitScale
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
virtual void prepareExpressions(const QgsSymbolRenderContext &context)
Prepares all data defined property expressions for evaluation.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
Abstract base class for all rendered symbols.
Definition qgssymbol.h:231
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_FORCE
Definition qgis_sip.h:131
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76
#define DEFAULT_RASTERMARKER_ANGLE
#define DEFAULT_RASTERMARKER_SIZE
#define DEFAULT_SVGMARKER_ANGLE
#define DEFAULT_SIMPLEMARKER_JOINSTYLE
#define DEFAULT_FONTMARKER_CHR
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR
#define DEFAULT_SIMPLEMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_ANGLE
#define DEFAULT_SVGMARKER_SIZE
#define DEFAULT_FONTMARKER_FONT
#define DEFAULT_FONTMARKER_ANGLE
#define DEFAULT_FONTMARKER_COLOR
#define DEFAULT_FONTMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_COLOR
#define DEFAULT_SCALE_METHOD