QGIS API Documentation  3.17.0-Master (3b262f2a79)
qgsfillsymbollayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfillsymbollayer.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 QGSFILLSYMBOLLAYER_H
17 #define QGSFILLSYMBOLLAYER_H
18 
19 #include "qgis_core.h"
20 #include "qgis.h"
21 #include "qgssymbollayer.h"
22 
23 #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255)
24 #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern
25 #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor( 35, 35, 35 )
26 #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine
27 #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH
28 #define DEFAULT_SIMPLEFILL_JOINSTYLE Qt::BevelJoin
29 
30 #define INF 1E20
31 
32 #include <QPen>
33 #include <QBrush>
34 
39 class CORE_EXPORT QgsSimpleFillSymbolLayer : public QgsFillSymbolLayer
40 {
41  public:
43  Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
44  const QColor &strokeColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
45  Qt::PenStyle strokeStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
46  double strokeWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH,
47  Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEFILL_JOINSTYLE
48  );
49 
50  // static stuff
51 
57  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
58  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
59 
60  // implemented from base classes
61 
62  QString layerType() const override;
63 
64  void startRender( QgsSymbolRenderContext &context ) override;
65 
66  void stopRender( QgsSymbolRenderContext &context ) override;
67 
68  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
69 
70  QgsStringMap properties() const override;
71 
72  QgsSimpleFillSymbolLayer *clone() const override SIP_FACTORY;
73 
74  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
75 
76  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
77 
78  Qt::BrushStyle brushStyle() const { return mBrushStyle; }
79  void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; }
80 
81  QColor strokeColor() const override { return mStrokeColor; }
82  void setStrokeColor( const QColor &strokeColor ) override { mStrokeColor = strokeColor; }
83 
84  QColor fillColor() const override { return color(); }
85  void setFillColor( const QColor &color ) override { setColor( color ); }
86 
87  Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
88  void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
89 
90  double strokeWidth() const { return mStrokeWidth; }
91  void setStrokeWidth( double strokeWidth ) { mStrokeWidth = strokeWidth; }
92 
93  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
94  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
95 
104  void setOffset( QPointF offset ) { mOffset = offset; }
105 
114  QPointF offset() { return mOffset; }
115 
121  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
122 
127  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
128 
129  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
130  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
131 
137  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
138 
144  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
145 
151  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
152 
158  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
159 
160  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
161  QgsUnitTypes::RenderUnit outputUnit() const override;
162 
163  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
164  QgsMapUnitScale mapUnitScale() const override;
165 
166  double estimateMaxBleed( const QgsRenderContext &context ) const override;
167 
168  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
169  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
170  double dxfAngle( QgsSymbolRenderContext &context ) const override;
171 
172  Qt::PenStyle dxfPenStyle() const override;
173  QColor dxfBrushColor( QgsSymbolRenderContext &context ) const override;
174  Qt::BrushStyle dxfBrushStyle() const override;
175 
176  protected:
177  QBrush mBrush;
178  QBrush mSelBrush;
179  Qt::BrushStyle mBrushStyle;
180  QColor mStrokeColor;
181  Qt::PenStyle mStrokeStyle;
182  double mStrokeWidth;
185  Qt::PenJoinStyle mPenJoinStyle;
186  QPen mPen;
187  QPen mSelPen;
188 
189  QPointF mOffset;
192 
193  private:
194  //helper functions for data defined symbology
195  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QBrush &brush, QPen &pen, QPen &selPen );
196 };
197 
198 class QgsColorRamp;
199 
205 {
206  public:
207 
209  {
211  ColorRamp
212  };
213 
215  {
218  Conical
219  };
220 
222  {
224  Viewport
225  };
226 
228  {
231  Repeat
232  };
233 
235  const QColor &color2 = Qt::white,
236  GradientColorType gradientColorType = SimpleTwoColor,
237  GradientType gradientType = Linear,
238  GradientCoordinateMode coordinateMode = Feature,
239  GradientSpread gradientSpread = Pad
240  );
241 
242  ~QgsGradientFillSymbolLayer() override;
243 
244  // static stuff
245 
251  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
252 
253  // implemented from base classes
254 
255  QString layerType() const override;
256 
257  void startRender( QgsSymbolRenderContext &context ) override;
258 
259  void stopRender( QgsSymbolRenderContext &context ) override;
260 
261  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
262 
263  QgsStringMap properties() const override;
264 
265  QgsGradientFillSymbolLayer *clone() const override SIP_FACTORY;
266 
267  double estimateMaxBleed( const QgsRenderContext &context ) const override;
268 
270  GradientType gradientType() const { return mGradientType; }
271  void setGradientType( GradientType gradientType ) { mGradientType = gradientType; }
272 
274  GradientColorType gradientColorType() const { return mGradientColorType; }
275  void setGradientColorType( GradientColorType gradientColorType ) { mGradientColorType = gradientColorType; }
276 
283  QgsColorRamp *colorRamp() { return mGradientRamp; }
284 
292  void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
293 
295  QColor color2() const { return mColor2; }
296  void setColor2( const QColor &color2 ) { mColor2 = color2; }
297 
299  GradientCoordinateMode coordinateMode() const { return mCoordinateMode; }
300  void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoordinateMode = coordinateMode; }
301 
303  GradientSpread gradientSpread() const { return mGradientSpread; }
304  void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
305 
307  void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = referencePoint; }
308  QPointF referencePoint1() const { return mReferencePoint1; }
309 
311  void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1IsCentroid = isCentroid; }
312  bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentroid; }
313 
315  void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = referencePoint; }
316  QPointF referencePoint2() const { return mReferencePoint2; }
317 
319  void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2IsCentroid = isCentroid; }
320  bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentroid; }
321 
330  void setOffset( QPointF offset ) { mOffset = offset; }
331 
340  QPointF offset() const { return mOffset; }
341 
347  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
348 
354  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
355 
361  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
362 
368  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
369 
370  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
371  QgsUnitTypes::RenderUnit outputUnit() const override;
372 
373  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
374  QgsMapUnitScale mapUnitScale() const override;
375 
376  protected:
377  QBrush mBrush;
378  QBrush mSelBrush;
379 
381  QColor mColor2;
382  QgsColorRamp *mGradientRamp = nullptr;
386 
388  bool mReferencePoint1IsCentroid = false;
390  bool mReferencePoint2IsCentroid = false;
391 
392  QPointF mOffset;
395 
396  private:
397 
398  //helper functions for data defined symbology
399  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, const QPolygonF &points );
400 
402  void applyGradient( const QgsSymbolRenderContext &context, QBrush &brush, const QColor &color, const QColor &color2,
403  GradientColorType gradientColorType, QgsColorRamp *gradientRamp, GradientType gradientType,
404  GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
405  QPointF referencePoint1, QPointF referencePoint2, double angle );
406 
408  QPointF rotateReferencePoint( QPointF refPoint, double angle );
409 };
410 
416 {
417  public:
418 
420  {
422  ColorRamp
423  };
424 
425  QgsShapeburstFillSymbolLayer( const QColor &color = DEFAULT_SIMPLEFILL_COLOR, const QColor &color2 = Qt::white,
426  ShapeburstColorType colorType = SimpleTwoColor,
427  int blurRadius = 0, bool useWholeShape = true, double maxDistance = 5 );
428 
429  ~QgsShapeburstFillSymbolLayer() override;
430 
436 
442 
443  // static stuff
444 
450  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
451 
452  // implemented from base classes
453 
454  QString layerType() const override;
455 
456  void startRender( QgsSymbolRenderContext &context ) override;
457 
458  void stopRender( QgsSymbolRenderContext &context ) override;
459 
460  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
461 
462  QgsStringMap properties() const override;
463 
464  QgsShapeburstFillSymbolLayer *clone() const override SIP_FACTORY;
465 
466  double estimateMaxBleed( const QgsRenderContext &context ) const override;
467 
474  void setBlurRadius( int blurRadius ) { mBlurRadius = blurRadius; }
475 
482  int blurRadius() const { return mBlurRadius; }
483 
492  void setUseWholeShape( bool useWholeShape ) { mUseWholeShape = useWholeShape; }
493 
501  bool useWholeShape() const { return mUseWholeShape; }
502 
511  void setMaxDistance( double maxDistance ) { mMaxDistance = maxDistance; }
512 
521  double maxDistance() const { return mMaxDistance; }
522 
530  void setDistanceUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceUnit = unit; }
531 
539  QgsUnitTypes::RenderUnit distanceUnit() const { return mDistanceUnit; }
540 
541  void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
542  const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
543 
554  void setColorType( ShapeburstColorType colorType ) { mColorType = colorType; }
555 
566  ShapeburstColorType colorType() const { return mColorType; }
567 
577  void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
578 
586  QgsColorRamp *colorRamp() { return mGradientRamp.get(); }
587 
595  void setColor2( const QColor &color2 ) { mColor2 = color2; }
596 
604  QColor color2() const { return mColor2; }
605 
613  void setIgnoreRings( bool ignoreRings ) { mIgnoreRings = ignoreRings; }
614 
621  bool ignoreRings() const { return mIgnoreRings; }
622 
630  void setOffset( QPointF offset ) { mOffset = offset; }
631 
639  QPointF offset() const { return mOffset; }
640 
648  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
649 
657  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
658 
659  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
660  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
661 
662  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
663  QgsUnitTypes::RenderUnit outputUnit() const override;
664 
665  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
666  QgsMapUnitScale mapUnitScale() const override;
667 
668  private:
669  QBrush mBrush;
670  QBrush mSelBrush;
671 
672  int mBlurRadius = 0;
673 
674  bool mUseWholeShape = true;
675  double mMaxDistance = 5.0;
677  QgsMapUnitScale mDistanceMapUnitScale;
678 
679  ShapeburstColorType mColorType = SimpleTwoColor;
680  QColor mColor2;
681 
682  bool mIgnoreRings = false;
683 
684  QPointF mOffset;
686  QgsMapUnitScale mOffsetMapUnitScale;
687 
688  std::unique_ptr< QgsColorRamp > mGradientRamp;
689 
690  //helper functions for data defined symbology
691  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QColor &color, QColor &color2, int &blurRadius, bool &useWholeShape,
692  double &maxDistance, bool &ignoreRings );
693 
694  /* distance transform of a 1d function using squared distance */
695  void distanceTransform1d( double *f, int n, int *v, double *z, double *d );
696  /* distance transform of 2d function using squared distance */
697  void distanceTransform2d( double *im, int width, int height, QgsRenderContext &context );
698  /* distance transform of a binary QImage */
699  double *distanceTransform( QImage *im, QgsRenderContext &context );
700 
701  /* fills a QImage with values from an array of doubles containing squared distance transform values */
702  void dtArrayToQImage( double *array, QImage *im, QgsColorRamp *ramp, QgsRenderContext &context, bool useWholeShape = true, int maxPixelDistance = 0 );
703 
704 #ifdef SIP_RUN
706 #endif
707 };
708 
714 {
715  public:
716 
718  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
719 
720  QgsSymbol *subSymbol() override { return mStroke.get(); }
721  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
722 
728  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
729 
735  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
736 
743  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
744 
753  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
754 
755  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
756  QgsUnitTypes::RenderUnit outputUnit() const override;
757  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
758  QgsMapUnitScale mapUnitScale() const override;
759  double estimateMaxBleed( const QgsRenderContext &context ) const override;
760  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
761  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
762  Qt::PenStyle dxfPenStyle() const override;
763  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
764  bool hasDataDefinedProperties() const override;
765 
766  protected:
767  QBrush mBrush;
768  double mNextAngle = 0.0; // mAngle / data defined angle
769 
771  double mStrokeWidth = 0.0;
774 
776  std::unique_ptr< QgsLineSymbol > mStroke;
777 
778  virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context ) { Q_UNUSED( context ) }
779 
785  virtual bool applyBrushTransformFromContext() const;
786 
787  private:
788 #ifdef SIP_RUN
790 #endif
791 };
792 
800 {
801  public:
802 
805  {
808  };
809 
814  QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
815 
820  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
821 
827  static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
828 
829  // implemented from base classes
830  QString layerType() const override;
831  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
832  void startRender( QgsSymbolRenderContext &context ) override;
833  void stopRender( QgsSymbolRenderContext &context ) override;
834  QgsStringMap properties() const override;
835  QgsRasterFillSymbolLayer *clone() const override SIP_FACTORY;
836  double estimateMaxBleed( const QgsRenderContext &context ) const override;
837 
838  //override QgsImageFillSymbolLayer's support for sub symbols
839  QgsSymbol *subSymbol() override { return nullptr; }
840  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
841 
847  void setImageFilePath( const QString &imagePath );
848 
854  QString imageFilePath() const { return mImageFilePath; }
855 
862  void setCoordinateMode( FillCoordinateMode mode );
863 
870  FillCoordinateMode coordinateMode() const { return mCoordinateMode; }
871 
877  void setOpacity( double opacity );
878 
884  double opacity() const { return mOpacity; }
885 
893  void setOffset( QPointF offset ) { mOffset = offset; }
894 
902  QPointF offset() const { return mOffset; }
903 
911  void setOffsetUnit( const QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
912 
920  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
921 
929  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
930 
938  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
939 
948  void setWidth( const double width ) { mWidth = width; }
949 
958  double width() const { return mWidth; }
959 
967  void setWidthUnit( const QgsUnitTypes::RenderUnit unit ) { mWidthUnit = unit; }
968 
976  QgsUnitTypes::RenderUnit widthUnit() const { return mWidthUnit; }
977 
985  void setWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWidthMapUnitScale = scale; }
986 
994  const QgsMapUnitScale &widthMapUnitScale() const { return mWidthMapUnitScale; }
995 
996  protected:
997 
998  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
999  bool applyBrushTransformFromContext() const override;
1000  private:
1001 
1003  QString mImageFilePath;
1005  double mOpacity = 1.0;
1006 
1007  QPointF mOffset;
1009  QgsMapUnitScale mOffsetMapUnitScale;
1010 
1011  double mWidth = 0.0;
1013  QgsMapUnitScale mWidthMapUnitScale;
1014 
1016  void applyPattern( QBrush &brush, const QString &imageFilePath, double width, double opacity,
1017  const QgsSymbolRenderContext &context );
1018 };
1019 
1025 {
1026  public:
1027 
1031  QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
1032 
1036  QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
1037 
1042  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1043 
1048  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1049 
1055  static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
1056 
1057  // implemented from base classes
1058 
1059  QString layerType() const override;
1060  void startRender( QgsSymbolRenderContext &context ) override;
1061  void stopRender( QgsSymbolRenderContext &context ) override;
1062  QgsStringMap properties() const override;
1063  QgsSVGFillSymbolLayer *clone() const override SIP_FACTORY;
1064  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1065 
1077  void setSvgFilePath( const QString &svgPath );
1078 
1084  QString svgFilePath() const { return mSvgFilePath; }
1085 
1095  void setPatternWidth( double width ) { mPatternWidth = width;}
1096 
1106  double patternWidth() const { return mPatternWidth; }
1107 
1117  void setSvgFillColor( const QColor &c ) { setColor( c ); }
1118 
1127  QColor svgFillColor() const { return color(); }
1128 
1138  void setSvgStrokeColor( const QColor &c ) { mSvgStrokeColor = c; }
1139 
1148  QColor svgStrokeColor() const { return mSvgStrokeColor; }
1149 
1160  void setSvgStrokeWidth( double w ) { mSvgStrokeWidth = w; }
1161 
1172  double svgStrokeWidth() const { return mSvgStrokeWidth; }
1173 
1181  void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit ) { mPatternWidthUnit = unit; }
1182 
1190  QgsUnitTypes::RenderUnit patternWidthUnit() const { return mPatternWidthUnit; }
1191 
1199  void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale ) { mPatternWidthMapUnitScale = scale; }
1200 
1208  const QgsMapUnitScale &patternWidthMapUnitScale() const { return mPatternWidthMapUnitScale; }
1209 
1217  void setSvgStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mSvgStrokeWidthUnit = unit; }
1218 
1226  QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const { return mSvgStrokeWidthUnit; }
1227 
1235  void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mSvgStrokeWidthMapUnitScale = scale; }
1236 
1244  const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const { return mSvgStrokeWidthMapUnitScale; }
1245 
1246  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1247  QgsUnitTypes::RenderUnit outputUnit() const override;
1248 
1249  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1250  QgsMapUnitScale mapUnitScale() const override;
1251 
1252  protected:
1253 
1254  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1255 
1256  private:
1257 
1259  double mPatternWidth = 20;
1261  QgsMapUnitScale mPatternWidthMapUnitScale;
1262 
1264  QByteArray mSvgData;
1266  QString mSvgFilePath;
1268  QRectF mSvgViewBox;
1269 
1270  //param(fill), param(stroke), param(stroke-width) are going
1271  //to be replaced in memory
1272  QColor mSvgStrokeColor = QColor( 35, 35, 35 );
1273  double mSvgStrokeWidth = 0.2;
1275  QgsMapUnitScale mSvgStrokeWidthMapUnitScale;
1276 
1278  void storeViewBox();
1279  void setDefaultSvgParams(); //fills mSvgFillColor, mSvgStrokeColor, mSvgStrokeWidth with default values for mSvgFilePath
1280 
1282  void applyPattern( QBrush &brush, const QString &svgFilePath, double patternWidth, QgsUnitTypes::RenderUnit patternWidthUnit, const QColor &svgFillColor, const QColor &svgStrokeColor,
1283  double svgStrokeWidth, QgsUnitTypes::RenderUnit svgStrokeWidthUnit, const QgsSymbolRenderContext &context, const QgsMapUnitScale &patternWidthMapUnitScale, const QgsMapUnitScale &svgStrokeWidthMapUnitScale );
1284 };
1285 
1292 {
1293  public:
1295  ~QgsLinePatternFillSymbolLayer() override;
1296 
1301  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1302 
1307  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1308 
1309  QString layerType() const override;
1310  void startRender( QgsSymbolRenderContext &context ) override;
1311  void stopRender( QgsSymbolRenderContext &context ) override;
1312  QgsStringMap properties() const override;
1314  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1315  double estimateMaxBleed( const QgsRenderContext &context ) const override;
1316 
1317  QString ogrFeatureStyleWidth( double widthScaleFactor ) const;
1318 
1326  void setLineAngle( double a ) { mLineAngle = a; }
1327 
1335  double lineAngle() const { return mLineAngle; }
1336 
1343  void setDistance( double d ) { mDistance = d; }
1344 
1350  double distance() const { return mDistance; }
1351 
1358  void setLineWidth( double w );
1359 
1366  double lineWidth() const { return mLineWidth; }
1367 
1368  void setColor( const QColor &c ) override;
1369  QColor color() const override;
1370 
1382  void setOffset( double offset ) { mOffset = offset; }
1383 
1395  double offset() const { return mOffset; }
1396 
1403  void setDistanceUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceUnit = unit; }
1404 
1411  QgsUnitTypes::RenderUnit distanceUnit() const { return mDistanceUnit; }
1412 
1420  void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
1421 
1429  const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
1430 
1436  void setLineWidthUnit( QgsUnitTypes::RenderUnit unit ) { mLineWidthUnit = unit; }
1437 
1443  QgsUnitTypes::RenderUnit lineWidthUnit() const { return mLineWidthUnit; }
1444 
1452  void setLineWidthMapUnitScale( const QgsMapUnitScale &scale ) { mLineWidthMapUnitScale = scale; }
1453 
1461  const QgsMapUnitScale &lineWidthMapUnitScale() const { return mLineWidthMapUnitScale; }
1462 
1468  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
1469 
1475  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
1476 
1484  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
1485 
1493  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
1494 
1495  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1496  QgsUnitTypes::RenderUnit outputUnit() const override;
1497  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1498  QgsMapUnitScale mapUnitScale() const override;
1499  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1500  QgsSymbol *subSymbol() override;
1501  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1502  bool hasDataDefinedProperties() const override;
1503 
1504  protected:
1505 
1506  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1507 
1508  private:
1510  double mDistance = 5.0;
1512  QgsMapUnitScale mDistanceMapUnitScale;
1514  double mLineWidth = 0;
1516  QgsMapUnitScale mLineWidthMapUnitScale;
1518  double mLineAngle = 45.0;
1520  double mOffset = 0.0;
1522  QgsMapUnitScale mOffsetMapUnitScale;
1523 
1524 #ifdef SIP_RUN
1526 #endif
1527 
1529  void applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double lineAngle, double distance );
1530 
1532  QgsLineSymbol *mFillLineSymbol = nullptr;
1533 };
1534 
1540 {
1541  public:
1543  ~QgsPointPatternFillSymbolLayer() override;
1544 
1550  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1551  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1552 
1553  QString layerType() const override;
1554 
1555  void startRender( QgsSymbolRenderContext &context ) override;
1556  void stopRender( QgsSymbolRenderContext &context ) override;
1557  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1558 
1559  QgsStringMap properties() const override;
1560 
1562 
1563  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1564 
1565  double estimateMaxBleed( const QgsRenderContext &context ) const override;
1566 
1567  //getters and setters
1568  double distanceX() const { return mDistanceX; }
1569  void setDistanceX( double d ) { mDistanceX = d; }
1570 
1571  double distanceY() const { return mDistanceY; }
1572  void setDistanceY( double d ) { mDistanceY = d; }
1573 
1574  double displacementX() const { return mDisplacementX; }
1575  void setDisplacementX( double d ) { mDisplacementX = d; }
1576 
1577  double displacementY() const { return mDisplacementY; }
1578  void setDisplacementY( double d ) { mDisplacementY = d; }
1579 
1587  void setOffsetX( double offset ) { mOffsetX = offset; }
1588 
1595  double offsetX() const { return mOffsetX; }
1596 
1604  void setOffsetY( double offset ) { mOffsetY = offset; }
1605 
1612  double offsetY() const { return mOffsetY; }
1613 
1614  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1615  QgsSymbol *subSymbol() override { return mMarkerSymbol; }
1616 
1623  void setDistanceXUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceXUnit = unit; }
1624 
1630  QgsUnitTypes::RenderUnit distanceXUnit() const { return mDistanceXUnit; }
1631 
1632  void setDistanceXMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceXMapUnitScale = scale; }
1633  const QgsMapUnitScale &distanceXMapUnitScale() const { return mDistanceXMapUnitScale; }
1634 
1641  void setDistanceYUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceYUnit = unit; }
1642 
1648  QgsUnitTypes::RenderUnit distanceYUnit() const { return mDistanceYUnit; }
1649 
1650  void setDistanceYMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceYMapUnitScale = scale; }
1651  const QgsMapUnitScale &distanceYMapUnitScale() const { return mDistanceYMapUnitScale; }
1652 
1659  void setDisplacementXUnit( QgsUnitTypes::RenderUnit unit ) { mDisplacementXUnit = unit; }
1660 
1666  QgsUnitTypes::RenderUnit displacementXUnit() const { return mDisplacementXUnit; }
1667 
1668  void setDisplacementXMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementXMapUnitScale = scale; }
1669  const QgsMapUnitScale &displacementXMapUnitScale() const { return mDisplacementXMapUnitScale; }
1670 
1677  void setDisplacementYUnit( QgsUnitTypes::RenderUnit unit ) { mDisplacementYUnit = unit; }
1678 
1684  QgsUnitTypes::RenderUnit displacementYUnit() const { return mDisplacementYUnit; }
1685 
1686  void setDisplacementYMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementYMapUnitScale = scale; }
1687  const QgsMapUnitScale &displacementYMapUnitScale() const { return mDisplacementYMapUnitScale; }
1688 
1696  void setOffsetXUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetXUnit = unit; }
1697 
1704  QgsUnitTypes::RenderUnit offsetXUnit() const { return mOffsetXUnit; }
1705 
1713  void setOffsetXMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetXMapUnitScale = scale; }
1714 
1721  const QgsMapUnitScale &offsetXMapUnitScale() const { return mOffsetXMapUnitScale; }
1722 
1730  void setOffsetYUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetYUnit = unit; }
1731 
1738  QgsUnitTypes::RenderUnit offsetYUnit() const { return mOffsetYUnit; }
1739 
1747  void setOffsetYMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetYMapUnitScale = scale; }
1748 
1755  const QgsMapUnitScale &offsetYMapUnitScale() const { return mOffsetYMapUnitScale; }
1756 
1757  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1758  QgsUnitTypes::RenderUnit outputUnit() const override;
1759 
1760  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1761  QgsMapUnitScale mapUnitScale() const override;
1762 
1763  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1764  bool hasDataDefinedProperties() const override;
1765  void setColor( const QColor &c ) override;
1766  QColor color() const override;
1767 
1768  protected:
1769  QgsMarkerSymbol *mMarkerSymbol = nullptr;
1770  double mDistanceX = 15;
1773  double mDistanceY = 15;
1776  double mDisplacementX = 0;
1779  double mDisplacementY = 0;
1782  double mOffsetX = 0;
1785  double mOffsetY = 0;
1788 
1789  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1790 
1791  private:
1792 #ifdef SIP_RUN
1794 #endif
1795 
1796  void applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double distanceX, double distanceY,
1797  double displacementX, double displacementY, double offsetX, double offsetY );
1798 
1799  bool mRenderUsingMarkers = false;
1800 };
1801 
1811 {
1812  public:
1813 
1816  {
1819  };
1820 
1827  QgsRandomMarkerFillSymbolLayer( int pointCount = 10, CountMethod method = AbsoluteCount, double densityArea = 250.0, unsigned long seed = 0 );
1828 
1834  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1835 
1836  QString layerType() const override;
1837  void startRender( QgsSymbolRenderContext &context ) override;
1838  void stopRender( QgsSymbolRenderContext &context ) override;
1839  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1840  QgsStringMap properties() const override;
1841  QgsRandomMarkerFillSymbolLayer *clone() const override SIP_FACTORY;
1842 
1843  void setColor( const QColor &color ) override;
1844  QColor color() const override;
1845 
1846  QgsSymbol *subSymbol() override;
1847  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1848 
1849  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1850  QgsUnitTypes::RenderUnit outputUnit() const override;
1851 
1852  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1853  QgsMapUnitScale mapUnitScale() const override;
1854 
1855  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1856  bool hasDataDefinedProperties() const override;
1857 
1863  int pointCount() const;
1864 
1870  void setPointCount( int count );
1871 
1877  unsigned long seed() const;
1878 
1886  void setSeed( unsigned long seed );
1887 
1893  bool clipPoints() const;
1894 
1900  void setClipPoints( bool clipped );
1901 
1907  CountMethod countMethod() const;
1908 
1914  void setCountMethod( CountMethod method );
1915 
1925  double densityArea() const;
1926 
1932  void setDensityArea( double area );
1933 
1939  void setDensityAreaUnit( QgsUnitTypes::RenderUnit unit ) { mDensityAreaUnit = unit; }
1940 
1945  QgsUnitTypes::RenderUnit densityAreaUnit() const { return mDensityAreaUnit; }
1946 
1954  void setDensityAreaUnitScale( const QgsMapUnitScale &scale ) { mDensityAreaUnitScale = scale; }
1955 
1962  const QgsMapUnitScale &densityAreaUnitScale() const { return mDensityAreaUnitScale; }
1963 
1964  void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1965  void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1966 
1967  private:
1968 #ifdef SIP_RUN
1970 #endif
1971 
1972  struct Part
1973  {
1974  QPolygonF exterior;
1975  QVector<QPolygonF> rings;
1976  };
1977 
1978  QVector< Part > mCurrentParts;
1979 
1980  void render( QgsRenderContext &context, const QVector< Part > &parts, const QgsFeature &feature, bool selected );
1981 
1982  std::unique_ptr< QgsMarkerSymbol > mMarker;
1983  CountMethod mCountMethod = AbsoluteCount;
1984  int mPointCount = 10;
1985  double mDensityArea = 250.0;
1987  QgsMapUnitScale mDensityAreaUnitScale;
1988  unsigned long mSeed = 0;
1989  bool mClipPoints = false;
1990 
1991  bool mRenderingFeature = false;
1992  double mFeatureSymbolOpacity = 1;
1993 };
1994 
1995 
2001 {
2002  public:
2004 
2005  // static stuff
2006 
2012  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
2013  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
2014 
2015  // implemented from base classes
2016 
2017  QString layerType() const override;
2018 
2019  void startRender( QgsSymbolRenderContext &context ) override;
2020 
2021  void stopRender( QgsSymbolRenderContext &context ) override;
2022 
2023  void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
2024 
2025  QgsStringMap properties() const override;
2026 
2027  QgsCentroidFillSymbolLayer *clone() const override SIP_FACTORY;
2028 
2029  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
2030 
2031  void setColor( const QColor &color ) override;
2032  QColor color() const override;
2033 
2034  QgsSymbol *subSymbol() override;
2035  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
2036 
2037  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
2038  QgsUnitTypes::RenderUnit outputUnit() const override;
2039 
2040  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
2041  QgsMapUnitScale mapUnitScale() const override;
2042 
2043  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
2044  bool hasDataDefinedProperties() const override;
2045 
2046  void setPointOnSurface( bool pointOnSurface ) { mPointOnSurface = pointOnSurface; }
2047  bool pointOnSurface() const { return mPointOnSurface; }
2048 
2054  void setPointOnAllParts( bool pointOnAllParts ) { mPointOnAllParts = pointOnAllParts; }
2055 
2061  bool pointOnAllParts() const { return mPointOnAllParts; }
2062 
2069  bool clipPoints() const { return mClipPoints; }
2070 
2077  void setClipPoints( bool clipPoints ) { mClipPoints = clipPoints; }
2078 
2085  bool clipOnCurrentPartOnly() const { return mClipOnCurrentPartOnly; }
2086 
2093  void setClipOnCurrentPartOnly( bool clipOnCurrentPartOnly ) { mClipOnCurrentPartOnly = clipOnCurrentPartOnly; }
2094 
2095  void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2096  void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2097 
2098  protected:
2099 
2100  std::unique_ptr< QgsMarkerSymbol > mMarker;
2101  bool mPointOnSurface = false;
2102  bool mPointOnAllParts = true;
2103  bool mClipPoints = false;
2104  bool mClipOnCurrentPartOnly = false;
2105 
2106  bool mRenderingFeature = false;
2107  double mFeatureSymbolOpacity = 1;
2108 
2109  QgsFeatureId mCurrentFeatureId = -1;
2110  int mBiggestPartIndex = -1;
2111 
2112  private:
2113 #ifdef SIP_RUN
2115 #endif
2116  struct Part
2117  {
2118  QPolygonF exterior;
2119  QVector<QPolygonF> rings;
2120  };
2121 
2122  void render( QgsRenderContext &context, const QVector<Part> &parts, const QgsFeature &feature, bool selected );
2123  QVector<Part> mCurrentParts;
2124 };
2125 
2126 #endif
2127 
2128 
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern&#39;s stroke.
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
void setDistance(double d)
Sets the distance between lines in the fill pattern.
const QgsMapUnitScale & displacementYMapUnitScale() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill&#39;s offset.
const QgsMapUnitScale & offsetXMapUnitScale() const
Returns the unit scale for the horizontal offset for rows in the pattern.
bool clipPoints() const
Returns true if point markers should be clipped to the polygon boundary.
QString svgFilePath() const
Returns the path to the SVG file used to render the fill.
void setPatternWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the width of the SVG images in the pattern.
QColor strokeColor() const override
Gets stroke color.
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
#define DEFAULT_SIMPLEFILL_JOINSTYLE
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the fill&#39;s offset.
QgsMapUnitScale mStrokeWidthMapUnitScale
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the units for the distance between lines in the fill pattern.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
const QgsMapUnitScale & lineWidthMapUnitScale() const
Returns the map unit scale for the pattern&#39;s line width.
void setSvgFillColor(const QColor &c)
Sets the fill color used for rendering the SVG content.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern&#39;s width.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:64
virtual void applyDataDefinedSettings(QgsSymbolRenderContext &context)
const QgsMapUnitScale & displacementXMapUnitScale() const
QString imageFilePath() const
The path to the raster image used for the fill.
QPointF offset() const
Returns the offset for the shapeburst fill.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
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, using the given render context.
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient. Controls how the gradient stops are positioned.
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
Qt::PenJoinStyle penJoinStyle() const
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line pattern&#39;s offset.
GradientSpread gradientSpread() const
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops...
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill&#39;s offset.
A symbol fill consisting of repeated parallel lines.
void setOffsetYMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the vertical offset for rows in the pattern.
Base class for polygon renderers generating texture images.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the image&#39;s width.
void setDisplacementYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical displacement between rows in the pattern.
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer&#39;s subsymbol. takes ownership of the passed symbol.
QgsUnitTypes::RenderUnit patternWidthUnit() const
Returns the units for the width of the SVG images in the pattern.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties...
Abstract base class for color ramps.
Definition: qgscolorramp.h:31
Helper functions for various unit types.
Definition: qgsunittypes.h:38
virtual QColor strokeColor() const
Gets stroke color.
void setOffsetY(double offset)
Sets the vertical offset values for points in the pattern.
std::unique_ptr< QgsMarkerSymbol > mMarker
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features ...
Definition: qgsfeatureid.h:28
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon&#39;s boundary...
const QgsMapUnitScale & strokeWidthMapUnitScale() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
QgsUnitTypes::RenderUnit offsetYUnit() const
Returns the units for the vertical offset for rows in the pattern.
void setDistanceUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the distance between lines in the fill pattern.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
void setOffsetUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the fill&#39;s offset.
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
#define DEFAULT_SIMPLEFILL_COLOR
void setDensityAreaUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the density area.
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets line width.
A fill symbol layer which places markers at random locations within polygons.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
GradientColorType mGradientColorType
const QgsMapUnitScale & svgStrokeWidthMapUnitScale() const
Returns the map unit scale for the pattern&#39;s stroke.
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features...
QMap< QString, QString > QgsStringMap
Definition: qgis.h:759
Tiling is based on complete map viewport.
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
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgssymbol.h:985
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units fo the symbol&#39;s stroke width.
bool clipOnCurrentPartOnly() const
Returns true if point markers should be clipped to the current part boundary only.
void setStrokeWidth(double strokeWidth)
void setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgssymbol.h:1185
QgsSymbol * subSymbol() override
Returns the symbol&#39;s sub symbol, if present.
double lineAngle() const
Returns the angle for the parallel lines used to fill the symbol.
QgsUnitTypes::RenderUnit densityAreaUnit() const
Returns the units for the density area.
QgsMapUnitScale mapUnitScale() const override
void setGradientType(GradientType gradientType)
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the pattern&#39;s line offset.
void setMapUnitScale(const QgsMapUnitScale &scale) override
#define DEFAULT_SIMPLEFILL_STYLE
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line pattern&#39;s offset.
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties...
virtual void setColor(const QColor &color)
The fill color.
double offsetY() const
Returns the vertical offset values for points in the pattern.
const QgsMapUnitScale & offsetYMapUnitScale() const
Returns the unit scale for the vertical offset between rows in the pattern.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
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
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
double offset() const
Returns the offset distance for lines within the fill, which is the distance to offset the parallel l...
virtual QgsUnitTypes::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol layer.
void setClipPoints(bool clipPoints)
Sets whether point markers should be clipped to the polygon boundary.
void setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
const QgsMapUnitScale & distanceMapUnitScale() const
virtual bool applyBrushTransformFromContext() const
Returns true if the image brush should be transformed using the render context&#39;s texture origin...
std::unique_ptr< QgsLineSymbol > mStroke
Custom stroke.
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer&#39;s subsymbol. takes ownership of the passed symbol.
A class for filling symbols with a repeated raster image.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
#define DEFAULT_SIMPLEFILL_BORDERWIDTH
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill&#39;s offset.
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
virtual void setOutputUnit(QgsUnitTypes::RenderUnit unit)
Sets the units to use for sizes and widths within the symbol layer.
QPointF offset()
Returns the offset by which polygons will be translated during rendering.
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
double offsetX() const
Returns the horizontal offset values for points in the pattern.
QgsUnitTypes::RenderUnit displacementYUnit() const
Returns the units for the vertical displacement between rows in the pattern.
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
void setFillColor(const QColor &color) override
Set fill color.
void setSvgStrokeWidth(double w)
Sets the stroke width used for rendering the SVG content.
void setOffsetXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal offset between rows in the pattern.
virtual void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called before the layer will be rendered for a particular feature.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image&#39;s width.
virtual Qt::BrushStyle dxfBrushStyle() const
Gets brush/fill style.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill&#39;s offset.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill&#39;s offset.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
void renderPolygon(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context) override
Renders the fill symbol layer for the polygon whose outer ring is defined by points, using the given render context.
void setStrokeStyle(Qt::PenStyle strokeStyle)
#define SIP_TRANSFER
Definition: qgis_sip.h:36
virtual QColor color() const
The fill color.
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit offsetXUnit() const
Returns the units for the horizontal offset for rows in the pattern.
QPointF offset() const
Returns the offset by which polygons will be translated during rendering.
CountMethod
Methods to define the number of points randomly filling the polygon.
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill&#39;s offset.
#define SIP_FACTORY
Definition: qgis_sip.h:76
void setPenJoinStyle(Qt::PenJoinStyle style)
QColor fillColor() const override
Gets fill color.
QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const
Returns the units for the stroke width.
QColor svgStrokeColor() const
Returns the stroke color used for rendering the SVG content.
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern&#39;s line width.
QgsFillSymbolLayer & operator=(const QgsFillSymbolLayer &other)=delete
QgsFillSymbolLayer cannot be copied.
Tiling is based on feature bounding box.
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
void setOffset(QPointF offset)
Sets the offset for the fill.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
double lineWidth() const
Returns the width of the line subsymbol used to render the parallel lines in the fill.
void setSvgStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the stroke width.
virtual QColor dxfBrushColor(QgsSymbolRenderContext &context) const
Gets brush/fill color.
void setStrokeColor(const QColor &strokeColor) override
Set stroke color.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
void setDistanceXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal distance between points in the pattern.
virtual Qt::PenStyle dxfPenStyle() const
Gets pen style.
Qt::BrushStyle brushStyle() const
GradientCoordinateMode mCoordinateMode
const QgsMapUnitScale & distanceMapUnitScale() const
Returns the map unit scale for the pattern&#39;s line distance.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
A class for filling symbols with a repeated SVG file.
virtual QgsMapUnitScale mapUnitScale() const
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
Contains information about the context of a rendering operation.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill&#39;s offset.
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
void setGradientColorType(GradientColorType gradientColorType)
QColor svgFillColor() const
Returns the fill color used for rendering the SVG content.
void setWidthUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units for the image&#39;s width.
Struct for storing maximum and minimum scales for measurements in map units.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual double dxfAngle(QgsSymbolRenderContext &context) const
Gets angle.
QgsUnitTypes::RenderUnit distanceXUnit() const
Returns the units for the horizontal distance between points in the pattern.
QgsUnitTypes::RenderUnit displacementXUnit() const
Returns the units for the horizontal displacement between rows in the pattern.
The point count is part of a marker density count.
const QgsMapUnitScale & densityAreaUnitScale() const
Returns the map scale for the density area.
const QgsMapUnitScale & distanceXMapUnitScale() const
const QgsMapUnitScale & patternWidthMapUnitScale() const
Returns the map unit scale for the pattern&#39;s width.
virtual QColor dxfColor(QgsSymbolRenderContext &context) const
Gets color.
Qt::PenStyle strokeStyle() const
const QgsMapUnitScale & offsetMapUnitScale() const
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the width of the fill&#39;s stroke.
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setClipOnCurrentPartOnly(bool clipOnCurrentPartOnly)
Sets whether point markers should be clipped to the current part boundary only.
Qt::PenJoinStyle mPenJoinStyle
const QgsMapUnitScale & distanceYMapUnitScale() const
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
double patternWidth() const
Returns the width of the rendered SVG content within the fill (i.e.
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image&#39;s width.
void setOffsetX(double offset)
Sets the horizontal offset values for points in the pattern.
void setDisplacementXUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the horizontal displacement between rows in the pattern.
double maxDistance() const
Returns the maximum distance from the shape&#39;s boundary which is shaded.
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features...
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon&#39;s boundary.
void setOffsetYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical offset for rows in the pattern.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
double opacity() const
Returns the opacity for the raster image used in the fill.
QgsUnitTypes::RenderUnit lineWidthUnit() const
Returns the units for the line&#39;s width.
void setColor2(const QColor &color2)
The point count is used as an absolute count of markers.
void setOffsetXMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the horizontal offset for rows in the pattern.
void setBrushStyle(Qt::BrushStyle style)
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
double svgStrokeWidth() const
Returns the stroke width used for rendering the SVG content.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the fill&#39;s offset.
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the offset for the shapeburst fill.
void setOffset(double offset)
Sets the offset distance for lines within the fill, which is the distance to offset the parallel line...
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the width of the fill&#39;s stroke.
Resolves relative paths into absolute paths and vice versa.
void setLineWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line&#39;s width.
void setSvgStrokeColor(const QColor &c)
Sets the stroke color used for rendering the SVG content.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the fill&#39;s offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern&#39;s line offset.
virtual void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called after the layer has been rendered for a particular feature.
double distance() const
Returns the distance between lines in the fill pattern.
QgsSymbol * subSymbol() override
Returns the symbol&#39;s sub symbol, if present.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the symbol&#39;s stroke width.
void setColorType(ShapeburstColorType colorType)
Sets the color mode to use for the shapeburst fill.
void setDistanceYUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the vertical distance between points in the pattern.
double width() const
Returns the width used for scaling the image used in the fill.
QgsColorRamp * colorRamp()
Returns the color ramp used for the shapeburst fill.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill&#39;s offset.
void setGradientSpread(GradientSpread gradientSpread)
FillCoordinateMode
Fill coordinate modes, dictates fill tiling behavior.
QgsMapUnitScale mOffsetMapUnitScale
void setCoordinateMode(GradientCoordinateMode coordinateMode)
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern&#39;s line distance.
QgsUnitTypes::RenderUnit distanceYUnit() const
Returns the units for the vertical distance between points in the pattern.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:166
QgsMapUnitScale mStrokeWidthMapUnitScale
void setPointOnSurface(bool pointOnSurface)
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
QPointF offset() const
Returns the offset for the fill.
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsUnitTypes::RenderUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon&#39;s boundary...