QGIS API Documentation 3.99.0-Master (a26b91b364d)
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 Qgis::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
48{
49
50 public:
51
53 static QList< Qgis::MarkerShape > availableShapes();
54
60 static bool shapeIsFilled( Qgis::MarkerShape shape );
61
70 double size = DEFAULT_SIMPLEMARKER_SIZE,
71 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
73
75
80 Qgis::MarkerShape shape() const { return mShape; }
81
87 void setShape( Qgis::MarkerShape shape ) { mShape = shape; }
88
97 static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = nullptr );
98
105 static QString encodeShape( Qgis::MarkerShape shape );
106
107 void startRender( QgsSymbolRenderContext &context ) override;
108 void stopRender( QgsSymbolRenderContext &context ) override;
109 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
110 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
111
112 protected:
113
117 bool prepareMarkerShape( Qgis::MarkerShape shape );
118
122 bool prepareMarkerPath( Qgis::MarkerShape symbol );
123
130 bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
131
138 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
139
148 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
149
151 QPolygonF mPolygon;
152
154 QPainterPath mPath;
155
158
159 private:
160
169 virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
170};
171
178{
179 public:
180
192 double size = DEFAULT_SIMPLEMARKER_SIZE,
193 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
195 const QColor &color = DEFAULT_SIMPLEMARKER_COLOR,
196 const QColor &strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
197 Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
198
200
201 // static methods
202
208 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
209
215 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
216
217 // reimplemented from base classes
218
219 QString layerType() const override;
220 Qgis::SymbolLayerFlags flags() const override;
221 void startRender( QgsSymbolRenderContext &context ) override;
222 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
223 QVariantMap properties() const override;
224 QgsSimpleMarkerSymbolLayer *clone() const override SIP_FACTORY;
225 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
226 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
227
228 Q_DECL_DEPRECATED void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
229 bool writeSldMarker( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
230 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
231 bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
232 void setOutputUnit( Qgis::RenderUnit unit ) override;
233 Qgis::RenderUnit outputUnit() const override;
234 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
235 QgsMapUnitScale mapUnitScale() const override;
236 bool usesMapUnits() const override;
237 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
238 QColor fillColor() const override { return mColor; }
239 void setFillColor( const QColor &color ) override { mColor = color; }
240 void setColor( const QColor &color ) override;
241 QColor color() const override;
242
243 // new methods
244
251 QColor strokeColor() const override { return mStrokeColor; }
252
260 void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
261
268 Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
269
277 void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
278
286 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
287
296 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
297
306 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
307
316 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
317
324 double strokeWidth() const { return mStrokeWidth; }
325
333 void setStrokeWidth( double w ) { mStrokeWidth = w; }
334
342 void setStrokeWidthUnit( Qgis::RenderUnit u ) { mStrokeWidthUnit = u; }
343
350 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
351
359 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
360
367 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
368
369 protected:
370
377 void drawMarker( QPainter *p, QgsSymbolRenderContext &context );
378
383 bool prepareCache( QgsSymbolRenderContext &context );
384
388 Qt::PenStyle mStrokeStyle = Qt::SolidLine;
390 double mStrokeWidth = 0;
396 Qt::PenJoinStyle mPenJoinStyle;
398 Qt::PenCapStyle mPenCapStyle = Qt::SquareCap;
400 QPen mPen;
402 QBrush mBrush;
403
405 QImage mCache;
409 QBrush mSelBrush;
411 QImage mSelCache;
412
417 bool mUsingCache = false;
418
420 static const int MAXIMUM_CACHE_WIDTH = 3000;
421
422 private:
423 // cppcheck-suppress unusedPrivateFunction
424 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
425
426 double mCachedOpacity = 1.0;
427
428};
429
437{
438 public:
439
448 double size = DEFAULT_SIMPLEMARKER_SIZE,
449 double angle = DEFAULT_SIMPLEMARKER_ANGLE,
451
453
459 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
460
461 QString layerType() const override;
462 void startRender( QgsSymbolRenderContext &context ) override;
463 void stopRender( QgsSymbolRenderContext &context ) override;
464 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
465 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
466 QVariantMap properties() const override;
467 QgsFilledMarkerSymbolLayer *clone() const override SIP_FACTORY;
468 QgsSymbol *subSymbol() override;
469 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
470 double estimateMaxBleed( const QgsRenderContext &context ) const override;
471 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
472 bool hasDataDefinedProperties() const override;
473 void setColor( const QColor &c ) override;
474 QColor color() const override;
475 bool usesMapUnits() const override;
476 void setOutputUnit( Qgis::RenderUnit unit ) override;
477
478 private:
479#ifdef SIP_RUN
481#endif
482
483 // cppcheck-suppress unusedPrivateFunction
484 void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
485
487 std::unique_ptr< QgsFillSymbol > mFill;
488};
489
491
492#define DEFAULT_SVGMARKER_SIZE ( 2 * Qgis::DEFAULT_POINT_SIZE )
493#define DEFAULT_SVGMARKER_ANGLE 0
494
501{
502 public:
504 QgsSvgMarkerSymbolLayer( const QString &path,
505 double size = DEFAULT_SVGMARKER_SIZE,
506 double angle = DEFAULT_SVGMARKER_ANGLE,
509
511
512 // static stuff
513
515 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
516 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
517
522 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
523
524 // implemented from base classes
525
526 QString layerType() const override;
527 Qgis::SymbolLayerFlags flags() const override;
528 void startRender( QgsSymbolRenderContext &context ) override;
529 void stopRender( QgsSymbolRenderContext &context ) override;
530 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
531 QVariantMap properties() const override;
532 bool usesMapUnits() const override;
533 QgsSvgMarkerSymbolLayer *clone() const override SIP_FACTORY;
534 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
535 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
536 Q_DECL_DEPRECATED void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
537 bool writeSldMarker( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
538
543 QString path() const { return mPath; }
544
550 void setPath( const QString &path );
551
556 double defaultAspectRatio() const { return mDefaultAspectRatio; }
557
563 double updateDefaultAspectRatio();
564
569 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
570
577 bool setPreservedAspectRatio( bool par );
578
585 double fixedAspectRatio() const { return mFixedAspectRatio; }
586
594 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
595
596 QColor fillColor() const override { return color(); }
597 void setFillColor( const QColor &color ) override { setColor( color ); }
598
599 QColor strokeColor() const override { return mStrokeColor; }
600 void setStrokeColor( const QColor &c ) override { mStrokeColor = c; }
601
602 double strokeWidth() const { return mStrokeWidth; }
603 void setStrokeWidth( double w ) { mStrokeWidth = w; }
604
609 QMap<QString, QgsProperty> parameters() const { return mParameters; }
610
615 void setParameters( const QMap<QString, QgsProperty> &parameters );
616
622 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
623
628 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
629
630 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
631 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
632
633 void setOutputUnit( Qgis::RenderUnit unit ) override;
634 Qgis::RenderUnit outputUnit() const override;
635
636 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
637 QgsMapUnitScale mapUnitScale() const override;
638
639 bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
640
641 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
642
643 void prepareExpressions( const QgsSymbolRenderContext &context ) override;
644
645 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
646
647 protected:
648
655 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
656
657 QString mPath;
658
660 double mDefaultAspectRatio = 0.0;
662 double mFixedAspectRatio = 0.0;
663 //param(fill), param(stroke), param(stroke-width) are going
664 //to be replaced in memory
665 bool mHasFillParam = false;
668 QMap<QString, QgsProperty> mParameters;
669
672
673 private:
674 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
675 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
676
677};
678
679
681
682#define DEFAULT_RASTERMARKER_SIZE ( 2 * Qgis::DEFAULT_POINT_SIZE )
683#define DEFAULT_RASTERMARKER_ANGLE 0
684
692{
693 public:
695 QgsRasterMarkerSymbolLayer( const QString &path = QString(),
696 double size = DEFAULT_SVGMARKER_SIZE,
697 double angle = DEFAULT_SVGMARKER_ANGLE,
699
701
702 // static stuff
703
708 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
709
717 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
718
723 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
724
725 // implemented from base classes
726
727 QString layerType() const override;
728 Qgis::SymbolLayerFlags flags() const override;
729 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
730 QVariantMap properties() const override;
731 QgsRasterMarkerSymbolLayer *clone() const override SIP_FACTORY;
732 bool usesMapUnits() const override;
733 QColor color() const override;
734 Q_DECL_DEPRECATED void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
735 bool writeSldMarker( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
736
743 double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
744
749 QString path() const { return mPath; }
750
756 void setPath( const QString &path );
757
763 double opacity() const { return mOpacity; }
764
770 void setOpacity( double opacity ) { mOpacity = opacity; }
771
776 double defaultAspectRatio() const { return mDefaultAspectRatio; }
777
783 double updateDefaultAspectRatio();
784
789 bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
790
797 bool setPreservedAspectRatio( bool par );
798
805 double fixedAspectRatio() const { return mFixedAspectRatio; }
806
814 void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
815
816 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
817 QgsMapUnitScale mapUnitScale() const override;
818
819 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
820
821 protected:
822
828 void setCommonProperties( const QVariantMap &properties );
829
835 void copyCommonProperties( QgsRasterMarkerSymbolLayer *other ) const;
836
842 virtual QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const SIP_SKIP;
843
844 QString mPath;
846 double mOpacity = 1.0;
848 double mDefaultAspectRatio = 0.0;
850 double mFixedAspectRatio = 0.0;
851
852 private:
853 double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
854 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
855
856};
857
858
860
861#define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch
862#define MM2POINT(x) ( (x) * 72 / 25.4 )
863
864#define DEFAULT_FONTMARKER_FONT "Dingbats"
865#define DEFAULT_FONTMARKER_CHR QChar('A')
866#define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
867#define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
868#define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
869#define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
870#define DEFAULT_FONTMARKER_ANGLE 0
871
878{
879 public:
880
882 QgsFontMarkerSymbolLayer( const QString &fontFamily = DEFAULT_FONTMARKER_FONT,
883 QString chr = DEFAULT_FONTMARKER_CHR,
884 double pointSize = DEFAULT_FONTMARKER_SIZE,
885 const QColor &color = DEFAULT_FONTMARKER_COLOR,
886 double angle = DEFAULT_FONTMARKER_ANGLE );
887
889
890 // static stuff
891
895 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
896
900 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
901
908 static void resolveFonts( const QVariantMap &properties, const QgsReadWriteContext &context );
909
910 // implemented from base classes
911
912 QString layerType() const override;
913 Qgis::SymbolLayerFlags flags() const override;
914
915 void startRender( QgsSymbolRenderContext &context ) override;
916
917 void stopRender( QgsSymbolRenderContext &context ) override;
918
919 void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
920
921 QVariantMap properties() const override;
922
923 QgsFontMarkerSymbolLayer *clone() const override SIP_FACTORY;
924 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
925 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
926 Q_DECL_DEPRECATED void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
927 bool writeSldMarker( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
928 bool usesMapUnits() const override;
929 void setOutputUnit( Qgis::RenderUnit unit ) override;
930
931 // new methods
932
938 QString fontFamily() const { return mFontFamily; }
939
945 void setFontFamily( const QString &family ) { mFontFamily = family; }
946
953 QString fontStyle() const { return mFontStyle; }
954
961 void setFontStyle( const QString &style ) { mFontStyle = style; }
962
968 QString character() const { return mString; }
969
975 void setCharacter( QString chr ) { mString = chr; }
976
977 QColor strokeColor() const override { return mStrokeColor; }
978 void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
979
988 double strokeWidth() const { return mStrokeWidth; }
989
998 void setStrokeWidth( double width ) { mStrokeWidth = width; }
999
1008 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
1009
1017 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
1018
1027 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
1028
1037 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
1038
1045 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1046
1053 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1054
1055 QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
1056
1057 private:
1058
1059 QString mFontFamily;
1060 QString mFontStyle;
1061 QFont mFont;
1062 std::unique_ptr< QFontMetrics >mFontMetrics;
1063
1064 QString mString;
1065
1066 double mChrWidth = 0;
1067 QPointF mChrOffset;
1069 double mFontSizeScale = 1.0;
1070 double mOrigSize;
1071
1072 QColor mStrokeColor;
1073 double mStrokeWidth;
1074 Qgis::RenderUnit mStrokeWidthUnit;
1075 QgsMapUnitScale mStrokeWidthMapUnitScale;
1076 Qt::PenJoinStyle mPenJoinStyle;
1077
1078 QPen mPen;
1079 QBrush mBrush;
1080
1081 bool mUseCachedPath = false;
1082 QPainterPath mCachedPath;
1083
1084 // If font has a zero (or nearly zero) size, we skip rendering altogether..
1085 bool mNonZeroFontSize = true;
1086
1087 QString characterToRender( QgsSymbolRenderContext &context, QPointF &charOffset, double &charWidth );
1088 void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
1089 double calculateSize( QgsSymbolRenderContext &context );
1090};
1091
1092
1104{
1105 public:
1106
1110 QgsAnimatedMarkerSymbolLayer( const QString &path = QString(),
1111 double size = DEFAULT_RASTERMARKER_SIZE,
1112 double angle = DEFAULT_RASTERMARKER_ANGLE );
1113
1115
1116 // static stuff
1117
1121 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY; // cppcheck-suppress duplInheritedMember
1122
1123 // implemented from base classes
1124
1125 QString layerType() const override;
1126 QVariantMap properties() const override;
1127 QgsAnimatedMarkerSymbolLayer *clone() const override SIP_FACTORY;
1128
1134 void setFrameRate( double rate ) { mFrameRateFps = rate; }
1135
1141 double frameRate() const { return mFrameRateFps; }
1142
1143 void startRender( QgsSymbolRenderContext &context ) override;
1144
1145 protected:
1146 QImage fetchImage( QgsRenderContext &context, const QString &path, QSize size, bool preserveAspectRatio, double opacity ) const override SIP_SKIP;
1147
1148 private:
1149 double mFrameRateFps = 10;
1150 bool mStaticPath = false;
1151 mutable QSet< QString > mPreparedPaths;
1152
1153};
1154
1155// clazy:excludeall=qstring-allocations
1156
1157#endif
1158
1159
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:54
ScaleMethod
Scale methods.
Definition qgis.h:588
MarkerShape
Marker shapes.
Definition qgis.h:3009
RenderUnit
Rendering size units.
Definition qgis.h:5064
@ 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
A marker symbol layer which displays characters rendered using a font.
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.
A container for the context for various read/write operations on 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 a 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.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
A marker symbol layer which renders an SVG graphic.
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.
Abstract base class for symbol layers.
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
Encapsulates the context in which a symbol is being rendered.
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_DEPRECATED
Definition qgis_sip.h:106
#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