QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
47{
48
49 public:
50
52 static QList< Qgis::MarkerShape > availableShapes();
53
59 static bool shapeIsFilled( Qgis::MarkerShape shape );
60
69 double size = DEFAULT_SIMPLEMARKER_SIZE,
70 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
72
74
79 Qgis::MarkerShape shape() const { return mShape; }
80
86 void setShape( Qgis::MarkerShape shape ) { mShape = shape; }
87
96 static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = nullptr );
97
104 static QString encodeShape( Qgis::MarkerShape shape );
105
106 void startRender( QgsSymbolRenderContext &context ) override;
107 void stopRender( QgsSymbolRenderContext &context ) override;
108 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
109 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
110
111 protected:
112
116 bool prepareMarkerShape( Qgis::MarkerShape shape );
117
121 bool prepareMarkerPath( Qgis::MarkerShape symbol );
122
129 bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
130
137 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
138
147 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
148
150 QPolygonF mPolygon;
151
153 QPainterPath mPath;
154
157
158 private:
159
168 virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
169};
170
177{
178 public:
179
191 double size = DEFAULT_SIMPLEMARKER_SIZE,
192 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
194 const QColor &color = DEFAULT_SIMPLEMARKER_COLOR,
195 const QColor &strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
196 Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
197
199
200 // static methods
201
207 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
208
214 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
215
216 // reimplemented from base classes
217
218 QString layerType() 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
263 Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
264
273 void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
274
283 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
284
294 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
295
304 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
305
314 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
315
322 double strokeWidth() const { return mStrokeWidth; }
323
331 void setStrokeWidth( double w ) { mStrokeWidth = w; }
332
340 void setStrokeWidthUnit( Qgis::RenderUnit u ) { mStrokeWidthUnit = u; }
341
348 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
349
357 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
358
365 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
366
367 protected:
368
375 void drawMarker( QPainter *p, QgsSymbolRenderContext &context );
376
381 bool prepareCache( QgsSymbolRenderContext &context );
382
386 Qt::PenStyle mStrokeStyle = Qt::SolidLine;
388 double mStrokeWidth = 0;
394 Qt::PenJoinStyle mPenJoinStyle;
396 Qt::PenCapStyle mPenCapStyle = Qt::SquareCap;
398 QPen mPen;
400 QBrush mBrush;
401
403 QImage mCache;
407 QBrush mSelBrush;
409 QImage mSelCache;
410
415 bool mUsingCache = false;
416
418 static const int MAXIMUM_CACHE_WIDTH = 3000;
419
420 private:
421 // cppcheck-suppress unusedPrivateFunction
422 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
423
424 double mCachedOpacity = 1.0;
425
426};
427
436{
437 public:
438
447 double size = DEFAULT_SIMPLEMARKER_SIZE,
448 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
450
452
458 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
459
460 QString layerType() const override;
461 void startRender( QgsSymbolRenderContext &context ) override;
462 void stopRender( QgsSymbolRenderContext &context ) override;
463 QVariantMap properties() const override;
464 QgsFilledMarkerSymbolLayer *clone() const override SIP_FACTORY;
465 QgsSymbol *subSymbol() override;
466 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
467 double estimateMaxBleed( const QgsRenderContext &context ) const override;
468 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
469 bool hasDataDefinedProperties() const override;
470 void setColor( const QColor &c ) override;
471 QColor color() const override;
472 bool usesMapUnits() const override;
473 void setOutputUnit( Qgis::RenderUnit unit ) override;
474
475 private:
476#ifdef SIP_RUN
478#endif
479
480 // cppcheck-suppress unusedPrivateFunction
481 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
482
484 std::unique_ptr< QgsFillSymbol > mFill;
485};
486
488
489#define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE
490#define DEFAULT_SVGMARKER_ANGLE 0
491
497{
498 public:
500 QgsSvgMarkerSymbolLayer( const QString &path,
501 double size = DEFAULT_SVGMARKER_SIZE,
502 double angle = DEFAULT_SVGMARKER_ANGLE,
504
506
507 // static stuff
508
510 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
511 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
512
518 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
519
520 // implemented from base classes
521
522 QString layerType() const override;
523
524 void startRender( QgsSymbolRenderContext &context ) override;
525
526 void stopRender( QgsSymbolRenderContext &context ) override;
527
528 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
529
530 QVariantMap properties() const override;
531 bool usesMapUnits() const override;
532
533 QgsSvgMarkerSymbolLayer *clone() const override SIP_FACTORY;
534
535 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
536
541 QString path() const { return mPath; }
542
548 void setPath( const QString &path );
549
554 double defaultAspectRatio() const { return mDefaultAspectRatio; }
555
561 double updateDefaultAspectRatio();
562
567 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
568
575 bool setPreservedAspectRatio( bool par );
576
582 double fixedAspectRatio() const { return mFixedAspectRatio; }
583
590 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
591
592 QColor fillColor() const override { return color(); }
593 void setFillColor( const QColor &color ) override { setColor( color ); }
594
595 QColor strokeColor() const override { return mStrokeColor; }
596 void setStrokeColor( const QColor &c ) override { mStrokeColor = c; }
597
598 double strokeWidth() const { return mStrokeWidth; }
599 void setStrokeWidth( double w ) { mStrokeWidth = w; }
600
605 QMap<QString, QgsProperty> parameters() const { return mParameters; }
606
611 void setParameters( const QMap<QString, QgsProperty> &parameters );
612
618 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
619
624 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
625
626 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
627 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
628
629 void setOutputUnit( Qgis::RenderUnit unit ) override;
630 Qgis::RenderUnit outputUnit() const override;
631
632 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
633 QgsMapUnitScale mapUnitScale() const override;
634
635 bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
636
637 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
638
639 void prepareExpressions( const QgsSymbolRenderContext &context ) override;
640
641 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
642
643 protected:
644
651 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
652
653 QString mPath;
654
656 double mDefaultAspectRatio = 0.0;
658 double mFixedAspectRatio = 0.0;
659 //param(fill), param(stroke), param(stroke-width) are going
660 //to be replaced in memory
661 bool mHasFillParam = false;
664 QMap<QString, QgsProperty> mParameters;
665
668
669 private:
670 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
671 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
672
673};
674
675
677
678#define DEFAULT_RASTERMARKER_SIZE 2*DEFAULT_POINT_SIZE
679#define DEFAULT_RASTERMARKER_ANGLE 0
680
688{
689 public:
691 QgsRasterMarkerSymbolLayer( const QString &path = QString(),
692 double size = DEFAULT_SVGMARKER_SIZE,
693 double angle = DEFAULT_SVGMARKER_ANGLE,
695
697
698 // static stuff
699
704 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
705
711 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
712
713 // implemented from base classes
714
715 QString layerType() const override;
716
717 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
718 QVariantMap properties() const override;
719 QgsRasterMarkerSymbolLayer *clone() const override SIP_FACTORY;
720 bool usesMapUnits() const override;
721 QColor color() const override;
722
729 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
730
735 QString path() const { return mPath; }
736
742 void setPath( const QString &path );
743
749 double opacity() const { return mOpacity; }
750
756 void setOpacity( double opacity ) { mOpacity = opacity; }
757
762 double defaultAspectRatio() const { return mDefaultAspectRatio; }
763
769 double updateDefaultAspectRatio();
770
775 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
776
783 bool setPreservedAspectRatio( bool par );
784
790 double fixedAspectRatio() const { return mFixedAspectRatio; }
791
798 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
799
800 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
801 QgsMapUnitScale mapUnitScale() const override;
802
803 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
804
805 protected:
806
812 void setCommonProperties( const QVariantMap &properties );
813
819 void copyCommonProperties( QgsRasterMarkerSymbolLayer *other ) const;
820
826 virtual QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const SIP_SKIP;
827
828 QString mPath;
830 double mOpacity = 1.0;
832 double mDefaultAspectRatio = 0.0;
834 double mFixedAspectRatio = 0.0;
835
836 private:
837 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
838 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
839
840};
841
842
844
845#define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch
846#define MM2POINT(x) ( (x) * 72 / 25.4 )
847
848#define DEFAULT_FONTMARKER_FONT "Dingbats"
849#define DEFAULT_FONTMARKER_CHR QChar('A')
850#define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
851#define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
852#define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
853#define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
854#define DEFAULT_FONTMARKER_ANGLE 0
855
861{
862 public:
863
865 QgsFontMarkerSymbolLayer( const QString &fontFamily = DEFAULT_FONTMARKER_FONT,
866 QString chr = DEFAULT_FONTMARKER_CHR,
867 double pointSize = DEFAULT_FONTMARKER_SIZE,
868 const QColor &color = DEFAULT_FONTMARKER_COLOR,
869 double angle = DEFAULT_FONTMARKER_ANGLE );
870
872
873 // static stuff
874
878 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
879
883 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
884
891 static void resolveFonts( const QVariantMap &properties, const QgsReadWriteContext &context );
892
893 // implemented from base classes
894
895 QString layerType() const override;
896
897 void startRender( QgsSymbolRenderContext &context ) override;
898
899 void stopRender( QgsSymbolRenderContext &context ) override;
900
901 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
902
903 QVariantMap properties() const override;
904
905 QgsFontMarkerSymbolLayer *clone() const override SIP_FACTORY;
906
907 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
908 bool usesMapUnits() const override;
909 void setOutputUnit( Qgis::RenderUnit unit ) override;
910
911 // new methods
912
918 QString fontFamily() const { return mFontFamily; }
919
925 void setFontFamily( const QString &family ) { mFontFamily = family; }
926
933 QString fontStyle() const { return mFontStyle; }
934
941 void setFontStyle( const QString &style ) { mFontStyle = style; }
942
948 QString character() const { return mString; }
949
955 void setCharacter( QString chr ) { mString = chr; }
956
957 QColor strokeColor() const override { return mStrokeColor; }
958 void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
959
969 double strokeWidth() const { return mStrokeWidth; }
970
980 void setStrokeWidth( double width ) { mStrokeWidth = width; }
981
991 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
992
1001 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
1002
1012 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
1013
1023 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
1024
1032 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1033
1041 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1042
1043 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
1044
1045 private:
1046
1047 QString mFontFamily;
1048 QString mFontStyle;
1049 QFont mFont;
1050 std::unique_ptr< QFontMetrics >mFontMetrics;
1051
1052 QString mString;
1053
1054 double mChrWidth = 0;
1055 QPointF mChrOffset;
1057 double mFontSizeScale = 1.0;
1058 double mOrigSize;
1059
1060 QColor mStrokeColor;
1061 double mStrokeWidth;
1062 Qgis::RenderUnit mStrokeWidthUnit;
1063 QgsMapUnitScale mStrokeWidthMapUnitScale;
1064 Qt::PenJoinStyle mPenJoinStyle;
1065
1066 QPen mPen;
1067 QBrush mBrush;
1068
1069 bool mUseCachedPath = false;
1070 QPainterPath mCachedPath;
1071
1072 // If font has a zero (or nearly zero) size, we skip rendering altogether..
1073 bool mNonZeroFontSize = true;
1074
1075 QString characterToRender( QgsSymbolRenderContext &context, QPointF &charOffset, double &charWidth );
1076 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
1077 double calculateSize( QgsSymbolRenderContext &context );
1078};
1079
1080
1092{
1093 public:
1094
1098 QgsAnimatedMarkerSymbolLayer( const QString &path = QString(),
1099 double size = DEFAULT_RASTERMARKER_SIZE,
1100 double angle = DEFAULT_RASTERMARKER_ANGLE );
1101
1103
1104 // static stuff
1105
1109 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1110
1111 // implemented from base classes
1112
1113 QString layerType() const override;
1114 QVariantMap properties() const override;
1115 QgsAnimatedMarkerSymbolLayer *clone() const override SIP_FACTORY;
1116
1122 void setFrameRate( double rate ) { mFrameRateFps = rate; }
1123
1129 double frameRate() const { return mFrameRateFps; }
1130
1131 void startRender( QgsSymbolRenderContext &context ) override;
1132
1133 protected:
1134 QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const override SIP_SKIP;
1135
1136 private:
1137 double mFrameRateFps = 10;
1138 bool mStaticPath = false;
1139 mutable QSet< QString > mPreparedPaths;
1140
1141};
1142
1143// clazy:excludeall=qstring-allocations
1144
1145#endif
1146
1147
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
ScaleMethod
Scale methods.
Definition qgis.h:382
MarkerShape
Marker shapes.
Definition qgis.h:2237
RenderUnit
Rendering size units.
Definition qgis.h:3627
@ 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.
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:94
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