QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
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, QList<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 
96  void setOffset( QPointF offset ) { mOffset = offset; }
97  QPointF offset() { return mOffset; }
98 
104  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
105 
110  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
111 
112  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
113  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
114 
120  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
121 
126  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
127 
128  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
129  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
130 
131  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
132  QgsUnitTypes::RenderUnit outputUnit() const override;
133 
134  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
135  QgsMapUnitScale mapUnitScale() const override;
136 
137  double estimateMaxBleed( const QgsRenderContext &context ) const override;
138 
139  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
140  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
141  double dxfAngle( QgsSymbolRenderContext &context ) const override;
142 
143  Qt::PenStyle dxfPenStyle() const override;
144  QColor dxfBrushColor( QgsSymbolRenderContext &context ) const override;
145  Qt::BrushStyle dxfBrushStyle() const override;
146 
147  protected:
148  QBrush mBrush;
149  QBrush mSelBrush;
150  Qt::BrushStyle mBrushStyle;
151  QColor mStrokeColor;
152  Qt::PenStyle mStrokeStyle;
153  double mStrokeWidth;
156  Qt::PenJoinStyle mPenJoinStyle;
157  QPen mPen;
158  QPen mSelPen;
159 
160  QPointF mOffset;
163 
164  private:
165  //helper functions for data defined symbology
166  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QBrush &brush, QPen &pen, QPen &selPen );
167 };
168 
169 class QgsColorRamp;
170 
176 {
177  public:
178 
180  {
182  ColorRamp
183  };
184 
186  {
189  Conical
190  };
191 
193  {
195  Viewport
196  };
197 
199  {
202  Repeat
203  };
204 
206  const QColor &color2 = Qt::white,
207  GradientColorType gradientColorType = SimpleTwoColor,
208  GradientType gradientType = Linear,
209  GradientCoordinateMode coordinateMode = Feature,
210  GradientSpread gradientSpread = Pad
211  );
212 
213  ~QgsGradientFillSymbolLayer() override;
214 
215  // static stuff
216 
222  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
223 
224  // implemented from base classes
225 
226  QString layerType() const override;
227 
228  void startRender( QgsSymbolRenderContext &context ) override;
229 
230  void stopRender( QgsSymbolRenderContext &context ) override;
231 
232  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
233 
234  QgsStringMap properties() const override;
235 
236  QgsGradientFillSymbolLayer *clone() const override SIP_FACTORY;
237 
238  double estimateMaxBleed( const QgsRenderContext &context ) const override;
239 
241  GradientType gradientType() const { return mGradientType; }
242  void setGradientType( GradientType gradientType ) { mGradientType = gradientType; }
243 
245  GradientColorType gradientColorType() const { return mGradientColorType; }
246  void setGradientColorType( GradientColorType gradientColorType ) { mGradientColorType = gradientColorType; }
247 
254  QgsColorRamp *colorRamp() { return mGradientRamp; }
255 
263  void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
264 
266  QColor color2() const { return mColor2; }
267  void setColor2( const QColor &color2 ) { mColor2 = color2; }
268 
270  GradientCoordinateMode coordinateMode() const { return mCoordinateMode; }
271  void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoordinateMode = coordinateMode; }
272 
274  GradientSpread gradientSpread() const { return mGradientSpread; }
275  void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
276 
278  void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = referencePoint; }
279  QPointF referencePoint1() const { return mReferencePoint1; }
280 
282  void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1IsCentroid = isCentroid; }
283  bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentroid; }
284 
286  void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = referencePoint; }
287  QPointF referencePoint2() const { return mReferencePoint2; }
288 
290  void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2IsCentroid = isCentroid; }
291  bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentroid; }
292 
294  void setOffset( QPointF offset ) { mOffset = offset; }
295  QPointF offset() const { return mOffset; }
296 
298  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
299  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
300 
301  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
302  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
303 
304  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
305  QgsUnitTypes::RenderUnit outputUnit() const override;
306 
307  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
308  QgsMapUnitScale mapUnitScale() const override;
309 
310  protected:
311  QBrush mBrush;
312  QBrush mSelBrush;
313 
315  QColor mColor2;
316  QgsColorRamp *mGradientRamp = nullptr;
320 
322  bool mReferencePoint1IsCentroid = false;
324  bool mReferencePoint2IsCentroid = false;
325 
326  QPointF mOffset;
329 
330  private:
331 
332  //helper functions for data defined symbology
333  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, const QPolygonF &points );
334 
336  void applyGradient( const QgsSymbolRenderContext &context, QBrush &brush, const QColor &color, const QColor &color2,
337  GradientColorType gradientColorType, QgsColorRamp *gradientRamp, GradientType gradientType,
338  GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
339  QPointF referencePoint1, QPointF referencePoint2, double angle );
340 
342  QPointF rotateReferencePoint( QPointF refPoint, double angle );
343 };
344 
350 {
351  public:
352 
354  {
356  ColorRamp
357  };
358 
359  QgsShapeburstFillSymbolLayer( const QColor &color = DEFAULT_SIMPLEFILL_COLOR, const QColor &color2 = Qt::white,
360  ShapeburstColorType colorType = SimpleTwoColor,
361  int blurRadius = 0, bool useWholeShape = true, double maxDistance = 5 );
362 
363  ~QgsShapeburstFillSymbolLayer() override;
364 
370 
376 
377  // static stuff
378 
384  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
385 
386  // implemented from base classes
387 
388  QString layerType() const override;
389 
390  void startRender( QgsSymbolRenderContext &context ) override;
391 
392  void stopRender( QgsSymbolRenderContext &context ) override;
393 
394  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
395 
396  QgsStringMap properties() const override;
397 
398  QgsShapeburstFillSymbolLayer *clone() const override SIP_FACTORY;
399 
400  double estimateMaxBleed( const QgsRenderContext &context ) const override;
401 
408  void setBlurRadius( int blurRadius ) { mBlurRadius = blurRadius; }
409 
416  int blurRadius() const { return mBlurRadius; }
417 
426  void setUseWholeShape( bool useWholeShape ) { mUseWholeShape = useWholeShape; }
427 
435  bool useWholeShape() const { return mUseWholeShape; }
436 
445  void setMaxDistance( double maxDistance ) { mMaxDistance = maxDistance; }
446 
455  double maxDistance() const { return mMaxDistance; }
456 
464  void setDistanceUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceUnit = unit; }
465 
473  QgsUnitTypes::RenderUnit distanceUnit() const { return mDistanceUnit; }
474 
475  void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
476  const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
477 
488  void setColorType( ShapeburstColorType colorType ) { mColorType = colorType; }
489 
500  ShapeburstColorType colorType() const { return mColorType; }
501 
511  void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
512 
520  QgsColorRamp *colorRamp() { return mGradientRamp.get(); }
521 
529  void setColor2( const QColor &color2 ) { mColor2 = color2; }
530 
538  QColor color2() const { return mColor2; }
539 
547  void setIgnoreRings( bool ignoreRings ) { mIgnoreRings = ignoreRings; }
548 
555  bool ignoreRings() const { return mIgnoreRings; }
556 
564  void setOffset( QPointF offset ) { mOffset = offset; }
565 
573  QPointF offset() const { return mOffset; }
574 
582  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
583 
591  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
592 
593  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
594  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
595 
596  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
597  QgsUnitTypes::RenderUnit outputUnit() const override;
598 
599  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
600  QgsMapUnitScale mapUnitScale() const override;
601 
602  private:
603  QBrush mBrush;
604  QBrush mSelBrush;
605 
606  int mBlurRadius = 0;
607 
608  bool mUseWholeShape = true;
609  double mMaxDistance = 5.0;
611  QgsMapUnitScale mDistanceMapUnitScale;
612 
613  ShapeburstColorType mColorType = SimpleTwoColor;
614  QColor mColor2;
615 
616  bool mIgnoreRings = false;
617 
618  QPointF mOffset;
620  QgsMapUnitScale mOffsetMapUnitScale;
621 
622  std::unique_ptr< QgsColorRamp > mGradientRamp;
623 
624  //helper functions for data defined symbology
625  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QColor &color, QColor &color2, int &blurRadius, bool &useWholeShape,
626  double &maxDistance, bool &ignoreRings );
627 
628  /* distance transform of a 1d function using squared distance */
629  void distanceTransform1d( double *f, int n, int *v, double *z, double *d );
630  /* distance transform of 2d function using squared distance */
631  void distanceTransform2d( double *im, int width, int height, QgsRenderContext &context );
632  /* distance transform of a binary QImage */
633  double *distanceTransform( QImage *im, QgsRenderContext &context );
634 
635  /* fills a QImage with values from an array of doubles containing squared distance transform values */
636  void dtArrayToQImage( double *array, QImage *im, QgsColorRamp *ramp, QgsRenderContext &context, bool useWholeShape = true, int maxPixelDistance = 0 );
637 
638 #ifdef SIP_RUN
640 #endif
641 };
642 
647 {
648  public:
649 
651  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
652 
653  QgsSymbol *subSymbol() override { return mStroke.get(); }
654  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
655 
661  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
662 
668  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
669 
676  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
677 
686  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
687 
688  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
689  QgsUnitTypes::RenderUnit outputUnit() const override;
690  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
691  QgsMapUnitScale mapUnitScale() const override;
692  double estimateMaxBleed( const QgsRenderContext &context ) const override;
693  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
694  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
695  Qt::PenStyle dxfPenStyle() const override;
696  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
697  bool hasDataDefinedProperties() const override;
698 
699  protected:
700  QBrush mBrush;
701  double mNextAngle = 0.0; // mAngle / data defined angle
702 
704  double mStrokeWidth = 0.0;
707 
709  std::unique_ptr< QgsLineSymbol > mStroke;
710 
711  virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context ) { Q_UNUSED( context ) }
712 
713  private:
714 #ifdef SIP_RUN
716 #endif
717 };
718 
726 {
727  public:
728 
731  {
734  };
735 
740  QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
741 
746  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
747 
753  static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
754 
755  // implemented from base classes
756  QString layerType() const override;
757  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
758  void startRender( QgsSymbolRenderContext &context ) override;
759  void stopRender( QgsSymbolRenderContext &context ) override;
760  QgsStringMap properties() const override;
761  QgsRasterFillSymbolLayer *clone() const override SIP_FACTORY;
762  double estimateMaxBleed( const QgsRenderContext &context ) const override;
763 
764  //override QgsImageFillSymbolLayer's support for sub symbols
765  QgsSymbol *subSymbol() override { return nullptr; }
766  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
767 
773  void setImageFilePath( const QString &imagePath );
774 
780  QString imageFilePath() const { return mImageFilePath; }
781 
788  void setCoordinateMode( FillCoordinateMode mode );
789 
796  FillCoordinateMode coordinateMode() const { return mCoordinateMode; }
797 
803  void setOpacity( double opacity );
804 
810  double opacity() const { return mOpacity; }
811 
819  void setOffset( QPointF offset ) { mOffset = offset; }
820 
828  QPointF offset() const { return mOffset; }
829 
837  void setOffsetUnit( const QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
838 
846  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
847 
855  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
856 
864  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
865 
874  void setWidth( const double width ) { mWidth = width; }
875 
884  double width() const { return mWidth; }
885 
893  void setWidthUnit( const QgsUnitTypes::RenderUnit unit ) { mWidthUnit = unit; }
894 
902  QgsUnitTypes::RenderUnit widthUnit() const { return mWidthUnit; }
903 
911  void setWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWidthMapUnitScale = scale; }
912 
920  const QgsMapUnitScale &widthMapUnitScale() const { return mWidthMapUnitScale; }
921 
922  protected:
923 
924  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
925 
926  private:
927 
929  QString mImageFilePath;
931  double mOpacity = 1.0;
932 
933  QPointF mOffset;
935  QgsMapUnitScale mOffsetMapUnitScale;
936 
937  double mWidth = 0.0;
939  QgsMapUnitScale mWidthMapUnitScale;
940 
942  void applyPattern( QBrush &brush, const QString &imageFilePath, double width, double opacity,
943  const QgsSymbolRenderContext &context );
944 };
945 
951 {
952  public:
953 
957  QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
958 
962  QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
963 
968  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
969 
974  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
975 
981  static void resolvePaths( QgsStringMap &properties, const QgsPathResolver &pathResolver, bool saving );
982 
983  // implemented from base classes
984 
985  QString layerType() const override;
986  void startRender( QgsSymbolRenderContext &context ) override;
987  void stopRender( QgsSymbolRenderContext &context ) override;
988  QgsStringMap properties() const override;
989  QgsSVGFillSymbolLayer *clone() const override SIP_FACTORY;
990  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
991 
1002  void setSvgFilePath( const QString &svgPath );
1003 
1009  QString svgFilePath() const { return mSvgFilePath; }
1010 
1020  void setPatternWidth( double width ) { mPatternWidth = width;}
1021 
1031  double patternWidth() const { return mPatternWidth; }
1032 
1042  void setSvgFillColor( const QColor &c ) { setColor( c ); }
1043 
1052  QColor svgFillColor() const { return color(); }
1053 
1063  void setSvgStrokeColor( const QColor &c ) { mSvgStrokeColor = c; }
1064 
1073  QColor svgStrokeColor() const { return mSvgStrokeColor; }
1074 
1085  void setSvgStrokeWidth( double w ) { mSvgStrokeWidth = w; }
1086 
1097  double svgStrokeWidth() const { return mSvgStrokeWidth; }
1098 
1106  void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit ) { mPatternWidthUnit = unit; }
1107 
1115  QgsUnitTypes::RenderUnit patternWidthUnit() const { return mPatternWidthUnit; }
1116 
1124  void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale ) { mPatternWidthMapUnitScale = scale; }
1125 
1133  const QgsMapUnitScale &patternWidthMapUnitScale() const { return mPatternWidthMapUnitScale; }
1134 
1142  void setSvgStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mSvgStrokeWidthUnit = unit; }
1143 
1151  QgsUnitTypes::RenderUnit svgStrokeWidthUnit() const { return mSvgStrokeWidthUnit; }
1152 
1160  void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mSvgStrokeWidthMapUnitScale = scale; }
1161 
1169  const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const { return mSvgStrokeWidthMapUnitScale; }
1170 
1171  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1172  QgsUnitTypes::RenderUnit outputUnit() const override;
1173 
1174  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1175  QgsMapUnitScale mapUnitScale() const override;
1176 
1177  protected:
1178 
1179  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1180 
1181  private:
1182 
1184  double mPatternWidth = 20;
1186  QgsMapUnitScale mPatternWidthMapUnitScale;
1187 
1189  QByteArray mSvgData;
1191  QString mSvgFilePath;
1193  QRectF mSvgViewBox;
1194 
1195  //param(fill), param(stroke), param(stroke-width) are going
1196  //to be replaced in memory
1197  QColor mSvgStrokeColor = QColor( 35, 35, 35 );
1198  double mSvgStrokeWidth = 0.2;
1200  QgsMapUnitScale mSvgStrokeWidthMapUnitScale;
1201 
1203  void storeViewBox();
1204  void setDefaultSvgParams(); //fills mSvgFillColor, mSvgStrokeColor, mSvgStrokeWidth with default values for mSvgFilePath
1205 
1207  void applyPattern( QBrush &brush, const QString &svgFilePath, double patternWidth, QgsUnitTypes::RenderUnit patternWidthUnit, const QColor &svgFillColor, const QColor &svgStrokeColor,
1208  double svgStrokeWidth, QgsUnitTypes::RenderUnit svgStrokeWidthUnit, const QgsSymbolRenderContext &context, const QgsMapUnitScale &patternWidthMapUnitScale, const QgsMapUnitScale &svgStrokeWidthMapUnitScale );
1209 };
1210 
1217 {
1218  public:
1220  ~QgsLinePatternFillSymbolLayer() override;
1221 
1226  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1227 
1232  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1233 
1234  QString layerType() const override;
1235  void startRender( QgsSymbolRenderContext &context ) override;
1236  void stopRender( QgsSymbolRenderContext &context ) override;
1237  QgsStringMap properties() const override;
1239  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1240  double estimateMaxBleed( const QgsRenderContext &context ) const override;
1241 
1242  QString ogrFeatureStyleWidth( double widthScaleFactor ) const;
1243 
1251  void setLineAngle( double a ) { mLineAngle = a; }
1252 
1260  double lineAngle() const { return mLineAngle; }
1261 
1268  void setDistance( double d ) { mDistance = d; }
1269 
1275  double distance() const { return mDistance; }
1276 
1283  void setLineWidth( double w );
1284 
1291  double lineWidth() const { return mLineWidth; }
1292 
1293  void setColor( const QColor &c ) override;
1294  QColor color() const override;
1295 
1307  void setOffset( double offset ) { mOffset = offset; }
1308 
1320  double offset() const { return mOffset; }
1321 
1328  void setDistanceUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceUnit = unit; }
1329 
1336  QgsUnitTypes::RenderUnit distanceUnit() const { return mDistanceUnit; }
1337 
1345  void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
1346 
1354  const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
1355 
1361  void setLineWidthUnit( QgsUnitTypes::RenderUnit unit ) { mLineWidthUnit = unit; }
1362 
1368  QgsUnitTypes::RenderUnit lineWidthUnit() const { return mLineWidthUnit; }
1369 
1377  void setLineWidthMapUnitScale( const QgsMapUnitScale &scale ) { mLineWidthMapUnitScale = scale; }
1378 
1386  const QgsMapUnitScale &lineWidthMapUnitScale() const { return mLineWidthMapUnitScale; }
1387 
1393  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
1394 
1400  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
1401 
1409  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
1410 
1418  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
1419 
1420  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1421  QgsUnitTypes::RenderUnit outputUnit() const override;
1422  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1423  QgsMapUnitScale mapUnitScale() const override;
1424  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1425  QgsSymbol *subSymbol() override;
1426  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1427  bool hasDataDefinedProperties() const override;
1428 
1429  protected:
1430 
1431  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1432 
1433  private:
1435  double mDistance = 5.0;
1437  QgsMapUnitScale mDistanceMapUnitScale;
1439  double mLineWidth = 0;
1441  QgsMapUnitScale mLineWidthMapUnitScale;
1443  double mLineAngle = 45.0;
1445  double mOffset = 0.0;
1447  QgsMapUnitScale mOffsetMapUnitScale;
1448 
1449 #ifdef SIP_RUN
1451 #endif
1452 
1454  void applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double lineAngle, double distance );
1455 
1457  QgsLineSymbol *mFillLineSymbol = nullptr;
1458 };
1459 
1465 {
1466  public:
1468  ~QgsPointPatternFillSymbolLayer() override;
1469 
1475  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1476  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1477 
1478  QString layerType() const override;
1479 
1480  void startRender( QgsSymbolRenderContext &context ) override;
1481 
1482  void stopRender( QgsSymbolRenderContext &context ) override;
1483 
1484  QgsStringMap properties() const override;
1485 
1487 
1488  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1489 
1490  double estimateMaxBleed( const QgsRenderContext &context ) const override;
1491 
1492  //getters and setters
1493  double distanceX() const { return mDistanceX; }
1494  void setDistanceX( double d ) { mDistanceX = d; }
1495 
1496  double distanceY() const { return mDistanceY; }
1497  void setDistanceY( double d ) { mDistanceY = d; }
1498 
1499  double displacementX() const { return mDisplacementX; }
1500  void setDisplacementX( double d ) { mDisplacementX = d; }
1501 
1502  double displacementY() const { return mDisplacementY; }
1503  void setDisplacementY( double d ) { mDisplacementY = d; }
1504 
1512  void setOffsetX( double offset ) { mOffsetX = offset; }
1513 
1520  double offsetX() const { return mOffsetX; }
1521 
1529  void setOffsetY( double offset ) { mOffsetY = offset; }
1530 
1537  double offsetY() const { return mOffsetY; }
1538 
1539  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1540  QgsSymbol *subSymbol() override { return mMarkerSymbol; }
1541 
1548  void setDistanceXUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceXUnit = unit; }
1549 
1555  QgsUnitTypes::RenderUnit distanceXUnit() const { return mDistanceXUnit; }
1556 
1557  void setDistanceXMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceXMapUnitScale = scale; }
1558  const QgsMapUnitScale &distanceXMapUnitScale() const { return mDistanceXMapUnitScale; }
1559 
1566  void setDistanceYUnit( QgsUnitTypes::RenderUnit unit ) { mDistanceYUnit = unit; }
1567 
1573  QgsUnitTypes::RenderUnit distanceYUnit() const { return mDistanceYUnit; }
1574 
1575  void setDistanceYMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceYMapUnitScale = scale; }
1576  const QgsMapUnitScale &distanceYMapUnitScale() const { return mDistanceYMapUnitScale; }
1577 
1584  void setDisplacementXUnit( QgsUnitTypes::RenderUnit unit ) { mDisplacementXUnit = unit; }
1585 
1591  QgsUnitTypes::RenderUnit displacementXUnit() const { return mDisplacementXUnit; }
1592 
1593  void setDisplacementXMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementXMapUnitScale = scale; }
1594  const QgsMapUnitScale &displacementXMapUnitScale() const { return mDisplacementXMapUnitScale; }
1595 
1602  void setDisplacementYUnit( QgsUnitTypes::RenderUnit unit ) { mDisplacementYUnit = unit; }
1603 
1609  QgsUnitTypes::RenderUnit displacementYUnit() const { return mDisplacementYUnit; }
1610 
1611  void setDisplacementYMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementYMapUnitScale = scale; }
1612  const QgsMapUnitScale &displacementYMapUnitScale() const { return mDisplacementYMapUnitScale; }
1613 
1621  void setOffsetXUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetXUnit = unit; }
1622 
1629  QgsUnitTypes::RenderUnit offsetXUnit() const { return mOffsetXUnit; }
1630 
1638  void setOffsetXMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetXMapUnitScale = scale; }
1639 
1646  const QgsMapUnitScale &offsetXMapUnitScale() const { return mOffsetXMapUnitScale; }
1647 
1655  void setOffsetYUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetYUnit = unit; }
1656 
1663  QgsUnitTypes::RenderUnit offsetYUnit() const { return mOffsetYUnit; }
1664 
1672  void setOffsetYMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetYMapUnitScale = scale; }
1673 
1680  const QgsMapUnitScale &offsetYMapUnitScale() const { return mOffsetYMapUnitScale; }
1681 
1682  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1683  QgsUnitTypes::RenderUnit outputUnit() const override;
1684 
1685  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1686  QgsMapUnitScale mapUnitScale() const override;
1687 
1688  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1689  bool hasDataDefinedProperties() const override;
1690  void setColor( const QColor &c ) override;
1691  QColor color() const override;
1692 
1693  protected:
1694  QgsMarkerSymbol *mMarkerSymbol = nullptr;
1695  double mDistanceX = 15;
1698  double mDistanceY = 15;
1701  double mDisplacementX = 0;
1704  double mDisplacementY = 0;
1707  double mOffsetX = 0;
1710  double mOffsetY = 0;
1713 
1714  void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1715 
1716  private:
1717 #ifdef SIP_RUN
1719 #endif
1720 
1721  void applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double distanceX, double distanceY,
1722  double displacementX, double displacementY, double offsetX, double offsetY );
1723 };
1724 
1734 {
1735  public:
1736 
1739  {
1742  };
1743 
1750  QgsRandomMarkerFillSymbolLayer( int pointCount = 10, CountMethod method = AbsoluteCount, double densityArea = 250.0, unsigned long seed = 0 );
1751 
1757  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1758 
1759  QString layerType() const override;
1760  void startRender( QgsSymbolRenderContext &context ) override;
1761  void stopRender( QgsSymbolRenderContext &context ) override;
1762  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1763  QgsStringMap properties() const override;
1764  QgsRandomMarkerFillSymbolLayer *clone() const override SIP_FACTORY;
1765 
1766  void setColor( const QColor &color ) override;
1767  QColor color() const override;
1768 
1769  QgsSymbol *subSymbol() override;
1770  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1771 
1772  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1773  QgsUnitTypes::RenderUnit outputUnit() const override;
1774 
1775  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1776  QgsMapUnitScale mapUnitScale() const override;
1777 
1778  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1779  bool hasDataDefinedProperties() const override;
1780 
1786  int pointCount() const;
1787 
1793  void setPointCount( int count );
1794 
1800  unsigned long seed() const;
1801 
1809  void setSeed( unsigned long seed );
1810 
1816  bool clipPoints() const;
1817 
1823  void setClipPoints( bool clipped );
1824 
1830  CountMethod countMethod() const;
1831 
1837  void setCountMethod( CountMethod method );
1838 
1848  double densityArea() const;
1849 
1855  void setDensityArea( double area );
1856 
1862  void setDensityAreaUnit( QgsUnitTypes::RenderUnit unit ) { mDensityAreaUnit = unit; }
1863 
1868  QgsUnitTypes::RenderUnit densityAreaUnit() const { return mDensityAreaUnit; }
1869 
1877  void setDensityAreaUnitScale( const QgsMapUnitScale &scale ) { mDensityAreaUnitScale = scale; }
1878 
1885  const QgsMapUnitScale &densityAreaUnitScale() const { return mDensityAreaUnitScale; }
1886 
1887  void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1888  void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1889 
1890  private:
1891 #ifdef SIP_RUN
1893 #endif
1894 
1895  struct Part
1896  {
1897  QPolygonF exterior;
1898  QList<QPolygonF> rings;
1899  };
1900 
1901  QVector< Part > mCurrentParts;
1902 
1903  void render( QgsRenderContext &context, const QVector< Part > &parts, const QgsFeature &feature, bool selected );
1904 
1905  std::unique_ptr< QgsMarkerSymbol > mMarker;
1906  CountMethod mCountMethod = AbsoluteCount;
1907  int mPointCount = 10;
1908  double mDensityArea = 250.0;
1910  QgsMapUnitScale mDensityAreaUnitScale;
1911  unsigned long mSeed = 0;
1912  bool mClipPoints = false;
1913 
1914  bool mRenderingFeature = false;
1915 };
1916 
1917 
1923 {
1924  public:
1926 
1927  // static stuff
1928 
1934  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
1935  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1936 
1937  // implemented from base classes
1938 
1939  QString layerType() const override;
1940 
1941  void startRender( QgsSymbolRenderContext &context ) override;
1942 
1943  void stopRender( QgsSymbolRenderContext &context ) override;
1944 
1945  void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1946 
1947  QgsStringMap properties() const override;
1948 
1949  QgsCentroidFillSymbolLayer *clone() const override SIP_FACTORY;
1950 
1951  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
1952 
1953  void setColor( const QColor &color ) override;
1954  QColor color() const override;
1955 
1956  QgsSymbol *subSymbol() override;
1957  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1958 
1959  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1960  QgsUnitTypes::RenderUnit outputUnit() const override;
1961 
1962  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1963  QgsMapUnitScale mapUnitScale() const override;
1964 
1965  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1966  bool hasDataDefinedProperties() const override;
1967 
1968  void setPointOnSurface( bool pointOnSurface ) { mPointOnSurface = pointOnSurface; }
1969  bool pointOnSurface() const { return mPointOnSurface; }
1970 
1974  void setPointOnAllParts( bool pointOnAllParts ) { mPointOnAllParts = pointOnAllParts; }
1975 
1979  bool pointOnAllParts() const { return mPointOnAllParts; }
1980 
1981  protected:
1982  std::unique_ptr< QgsMarkerSymbol > mMarker;
1983  bool mPointOnSurface = false;
1984  bool mPointOnAllParts = true;
1985 
1986  QgsFeatureId mCurrentFeatureId = -1;
1987  int mBiggestPartIndex = -1;
1988 
1989  private:
1990 #ifdef SIP_RUN
1992 #endif
1993 };
1994 
1995 #endif
1996 
1997 
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)
const QgsMapUnitScale & offsetXMapUnitScale() const
Returns the unit scale for the horizontal offset for rows in the pattern.
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 units 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:62
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.
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
Definition: qgsfeatureid.h:25
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:694
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:895
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units fo the symbol&#39;s stroke width.
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:1095
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)
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
virtual void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolRenderContext &context)=0
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 setLineAngle(double a)
Sets the angle for the parallel lines used to fill the symbol.
const QgsMapUnitScale & distanceMapUnitScale() const
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)
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.
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
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 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.
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
#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)
Offset for gradient fill.
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.
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)
Units for gradient fill 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
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:145
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...