QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
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
35class QgsMarkerSymbol;
36class QgsLineSymbol;
37class QgsPathResolver;
38
44{
45 public:
47 Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
48 const QColor &strokeColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
49 Qt::PenStyle strokeStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
50 double strokeWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH,
51 Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEFILL_JOINSTYLE
52 );
53
55
56 // static stuff
57
63 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
64 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
65
66 // implemented from base classes
67
68 QString layerType() const override;
69
70 void startRender( QgsSymbolRenderContext &context ) override;
71
72 void stopRender( QgsSymbolRenderContext &context ) override;
73
74 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
75
76 QVariantMap properties() const override;
77
78 QgsSimpleFillSymbolLayer *clone() const override SIP_FACTORY;
79
80 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
81
82 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
83
84 Qt::BrushStyle brushStyle() const { return mBrushStyle; }
85 void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; }
86
87 QColor strokeColor() const override { return mStrokeColor; }
88 void setStrokeColor( const QColor &strokeColor ) override { mStrokeColor = strokeColor; }
89
90 QColor fillColor() const override { return color(); }
91 void setFillColor( const QColor &color ) override { setColor( color ); }
92
93 Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
94 void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
95
96 double strokeWidth() const { return mStrokeWidth; }
97 void setStrokeWidth( double strokeWidth ) { mStrokeWidth = strokeWidth; }
98
99 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
100 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
101
110 void setOffset( QPointF offset ) { mOffset = offset; }
111
120 QPointF offset() const { return mOffset; }
121
127 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
128
133 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
134
135 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
136 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
137
143 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
144
150 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
151
157 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
158
164 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
165
166 void setOutputUnit( Qgis::RenderUnit unit ) override;
167 Qgis::RenderUnit outputUnit() const override;
168 bool usesMapUnits() const override;
169
170 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
171 QgsMapUnitScale mapUnitScale() const override;
172
173 double estimateMaxBleed( const QgsRenderContext &context ) const override;
174
175 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
176 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
177 double dxfAngle( QgsSymbolRenderContext &context ) const override;
178
179 Qt::PenStyle dxfPenStyle() const override;
180 QColor dxfBrushColor( QgsSymbolRenderContext &context ) const override;
181 Qt::BrushStyle dxfBrushStyle() const override;
182 QImage toTiledPatternImage( ) const override;
183
184 protected:
185 QBrush mBrush;
186 QBrush mSelBrush;
187 Qt::BrushStyle mBrushStyle;
189 Qt::PenStyle mStrokeStyle;
193 Qt::PenJoinStyle mPenJoinStyle;
194 QPen mPen;
196
197 QPointF mOffset;
200
201 private:
202 //helper functions for data defined symbology
203 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QBrush &brush, QPen &pen, QPen &selPen );
204
205};
206
207class QgsColorRamp;
208
214{
215 public:
216
221 const QColor &color2 = Qt::white,
226 );
227
229
230 // static stuff
231
237 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
238
239 // implemented from base classes
240
241 QString layerType() const override;
242 void startRender( QgsSymbolRenderContext &context ) override;
243 void stopRender( QgsSymbolRenderContext &context ) override;
244 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
245 QVariantMap properties() const override;
247 double estimateMaxBleed( const QgsRenderContext &context ) const override;
248 bool canCauseArtifactsBetweenAdjacentTiles() const override;
249
255 Qgis::GradientType gradientType() const { return mGradientType; }
256
262 void setGradientType( Qgis::GradientType gradientType ) { mGradientType = gradientType; }
263
269 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
270
276 void setGradientColorType( Qgis::GradientColorSource gradientColorType ) { mGradientColorType = gradientColorType; }
277
284 QgsColorRamp *colorRamp() { return mGradientRamp; }
285
293 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
294
300 QColor color2() const { return mColor2; }
301
307 void setColor2( const QColor &color2 ) { mColor2 = color2; }
308
314 Qgis::SymbolCoordinateReference coordinateMode() const { return mCoordinateMode; }
315
321 void setCoordinateMode( Qgis::SymbolCoordinateReference coordinateMode ) { mCoordinateMode = coordinateMode; }
322
328 Qgis::GradientSpread gradientSpread() const { return mGradientSpread; }
329
335 void setGradientSpread( Qgis::GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
336
342 void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = referencePoint; }
343
349 QPointF referencePoint1() const { return mReferencePoint1; }
350
356 void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1IsCentroid = isCentroid; }
357
363 bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentroid; }
364
370 void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = referencePoint; }
371
377 QPointF referencePoint2() const { return mReferencePoint2; }
378
384 void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2IsCentroid = isCentroid; }
385
386
392 bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentroid; }
393
402 void setOffset( QPointF offset ) { mOffset = offset; }
403
412 QPointF offset() const { return mOffset; }
413
419 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
420
426 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
427
433 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
434
440 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
441
442 void setOutputUnit( Qgis::RenderUnit unit ) override;
443 Qgis::RenderUnit outputUnit() const override;
444 bool usesMapUnits() const override;
445
446 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
447 QgsMapUnitScale mapUnitScale() const override;
448
449 protected:
450 QBrush mBrush;
451 QBrush mSelBrush;
452
454 QColor mColor2;
455 QgsColorRamp *mGradientRamp = nullptr;
459
461 bool mReferencePoint1IsCentroid = false;
463 bool mReferencePoint2IsCentroid = false;
464
465 QPointF mOffset;
468
469 private:
470
471 //helper functions for data defined symbology
472 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, const QPolygonF &points );
473
475 void applyGradient( const QgsSymbolRenderContext &context, QBrush &brush, const QColor &color, const QColor &color2,
476 Qgis::GradientColorSource gradientColorType, QgsColorRamp *gradientRamp, Qgis::GradientType gradientType,
477 Qgis::SymbolCoordinateReference coordinateMode, Qgis::GradientSpread gradientSpread,
478 QPointF referencePoint1, QPointF referencePoint2, double angle );
479
481 QPointF rotateReferencePoint( QPointF refPoint, double angle );
482};
483
489{
490 public:
491
495 QgsShapeburstFillSymbolLayer( const QColor &color = DEFAULT_SIMPLEFILL_COLOR, const QColor &color2 = Qt::white,
497 int blurRadius = 0, bool useWholeShape = true, double maxDistance = 5 );
498
500
506
512
513 // static stuff
514
520 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
521
522 // implemented from base classes
523
524 QString layerType() const override;
525 void startRender( QgsSymbolRenderContext &context ) override;
526 void stopRender( QgsSymbolRenderContext &context ) override;
527 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
528 QVariantMap properties() const override;
529 QgsShapeburstFillSymbolLayer *clone() const override SIP_FACTORY;
530 double estimateMaxBleed( const QgsRenderContext &context ) const override;
531 bool canCauseArtifactsBetweenAdjacentTiles() const override;
532
538 void setBlurRadius( int blurRadius ) { mBlurRadius = blurRadius; }
539
545 int blurRadius() const { return mBlurRadius; }
546
554 void setUseWholeShape( bool useWholeShape ) { mUseWholeShape = useWholeShape; }
555
562 bool useWholeShape() const { return mUseWholeShape; }
563
571 void setMaxDistance( double maxDistance ) { mMaxDistance = maxDistance; }
572
580 double maxDistance() const { return mMaxDistance; }
581
588 void setDistanceUnit( Qgis::RenderUnit unit ) { mDistanceUnit = unit; }
589
596 Qgis::RenderUnit distanceUnit() const { return mDistanceUnit; }
597
598 void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
599 const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
600
610 void setColorType( Qgis::GradientColorSource colorType ) { mColorType = colorType; }
611
621 Qgis::GradientColorSource colorType() const { return mColorType; }
622
631 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
632
639 QgsColorRamp *colorRamp() { return mGradientRamp.get(); }
640
647 void setColor2( const QColor &color2 ) { mColor2 = color2; }
648
655 QColor color2() const { return mColor2; }
656
663 void setIgnoreRings( bool ignoreRings ) { mIgnoreRings = ignoreRings; }
664
670 bool ignoreRings() const { return mIgnoreRings; }
671
678 void setOffset( QPointF offset ) { mOffset = offset; }
679
686 QPointF offset() const { return mOffset; }
687
694 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
695
702 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
703
704 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
705 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
706
707 void setOutputUnit( Qgis::RenderUnit unit ) override;
708 Qgis::RenderUnit outputUnit() const override;
709 bool usesMapUnits() const override;
710
711 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
712 QgsMapUnitScale mapUnitScale() const override;
713
714 private:
715 QBrush mBrush;
716 QBrush mSelBrush;
717
718 int mBlurRadius = 0;
719
720 bool mUseWholeShape = true;
721 double mMaxDistance = 5.0;
723 QgsMapUnitScale mDistanceMapUnitScale;
724
726 QColor mColor2;
727
728 bool mIgnoreRings = false;
729
730 QPointF mOffset;
732 QgsMapUnitScale mOffsetMapUnitScale;
733
734 std::unique_ptr< QgsColorRamp > mGradientRamp;
735
736 //helper functions for data defined symbology
737 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QColor &color, QColor &color2, int &blurRadius, bool &useWholeShape,
738 double &maxDistance, bool &ignoreRings );
739
740 /* distance transform of a 1d function using squared distance */
741 void distanceTransform1d( double *f, int n, int *v, double *z, double *d );
742 /* distance transform of 2d function using squared distance */
743 void distanceTransform2d( double *im, int width, int height, QgsRenderContext &context );
744 /* distance transform of a binary QImage */
745 double *distanceTransform( QImage *im, QgsRenderContext &context );
746
747 /* fills a QImage with values from an array of doubles containing squared distance transform values */
748 void dtArrayToQImage( double *array, QImage *im, QgsColorRamp *ramp, QgsRenderContext &context, bool useWholeShape = true, int maxPixelDistance = 0 );
749
750#ifdef SIP_RUN
752#endif
753};
754
760{
761 public:
762
765
766 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
767
773 void setStrokeWidthUnit( Qgis::RenderUnit unit ) { mStrokeWidthUnit = unit; }
774
780 Qgis::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
781
788 void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
789
797 const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
798
806 void setCoordinateReference( Qgis::SymbolCoordinateReference coordinateReference ) { mCoordinateReference = coordinateReference; }
807
815 Qgis::SymbolCoordinateReference coordinateReference() const { return mCoordinateReference; }
816
817 void setOutputUnit( Qgis::RenderUnit unit ) override;
818 Qgis::RenderUnit outputUnit() const override;
819 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
820 QgsMapUnitScale mapUnitScale() const override;
821 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
822 Qt::PenStyle dxfPenStyle() const override;
823 QVariantMap properties() const override;
824
825 protected:
826 QBrush mBrush;
828 double mNextAngle = 0.0; // mAngle / data defined angle
829
831 double mStrokeWidth = 0.0;
834
838 virtual void applyDataDefinedSettings( QgsSymbolRenderContext &context ) { Q_UNUSED( context ) }
839
845 virtual bool applyBrushTransformFromContext( QgsSymbolRenderContext *context = nullptr ) const;
846
847 private:
848#ifdef SIP_RUN
850#endif
851};
852
859{
860 public:
861
866 QgsRasterFillSymbolLayer( const QString &imageFilePath = QString() );
867
869
874 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
875
881 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
882
887 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
888
889 // implemented from base classes
890 QString layerType() const override;
891 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
892 void startRender( QgsSymbolRenderContext &context ) override;
893 void stopRender( QgsSymbolRenderContext &context ) override;
894 QVariantMap properties() const override;
895 QgsRasterFillSymbolLayer *clone() const override SIP_FACTORY;
896 double estimateMaxBleed( const QgsRenderContext &context ) const override;
897 bool usesMapUnits() const override;
898 QColor color() const override;
899 void setOutputUnit( Qgis::RenderUnit unit ) override;
900
901 //override QgsImageFillSymbolLayer's support for sub symbols
902 QgsSymbol *subSymbol() override { return nullptr; }
903 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
904
910 void setImageFilePath( const QString &imagePath );
911
917 QString imageFilePath() const { return mImageFilePath; }
918
925 void setCoordinateMode( Qgis::SymbolCoordinateReference mode );
926
933 Qgis::SymbolCoordinateReference coordinateMode() const { return mCoordinateMode; }
934
940 void setOpacity( double opacity );
941
947 double opacity() const { return mOpacity; }
948
956 void setOffset( QPointF offset ) { mOffset = offset; }
957
965 QPointF offset() const { return mOffset; }
966
974 void setOffsetUnit( const Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
975
983 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
984
992 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
993
1001 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
1002
1014 void setWidth( double width ) { mWidth = width; }
1015
1026 double width() const { return mWidth; }
1027
1039 void setHeight( double height ) { mHeight = height; }
1040
1051 double height() const { return mHeight; }
1052
1062 Q_DECL_DEPRECATED void setWidthUnit( Qgis::RenderUnit unit ) SIP_DEPRECATED { mSizeUnit = unit; }
1063
1073 void setSizeUnit( Qgis::RenderUnit unit ) { mSizeUnit = unit; }
1074
1084 Q_DECL_DEPRECATED Qgis::RenderUnit widthUnit() const SIP_DEPRECATED { return mSizeUnit; }
1085
1096 Qgis::RenderUnit sizeUnit() const { return mSizeUnit; }
1097
1107 Q_DECL_DEPRECATED void setWidthMapUnitScale( const QgsMapUnitScale &scale ) SIP_DEPRECATED { mSizeMapUnitScale = scale; }
1108
1119 void setSizeMapUnitScale( const QgsMapUnitScale &scale ) { mSizeMapUnitScale = scale; }
1120
1130 Q_DECL_DEPRECATED const QgsMapUnitScale &widthMapUnitScale() const SIP_DEPRECATED { return mSizeMapUnitScale; }
1131
1142 const QgsMapUnitScale &sizeMapUnitScale() const { return mSizeMapUnitScale; }
1143
1144 protected:
1145
1146 void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1147 bool applyBrushTransformFromContext( QgsSymbolRenderContext *context = nullptr ) const override;
1148 private:
1149
1151 QString mImageFilePath;
1153 double mOpacity = 1.0;
1154
1155 QPointF mOffset;
1157 QgsMapUnitScale mOffsetMapUnitScale;
1158
1159 double mWidth = 0.0;
1161 QgsMapUnitScale mSizeMapUnitScale;
1162
1163 double mHeight = 0.0;
1164
1166 void applyPattern( QBrush &brush, const QString &imageFilePath, double width, double height, double opacity,
1167 const QgsSymbolRenderContext &context );
1168};
1169
1175{
1176 public:
1177
1181 QgsSVGFillSymbolLayer( const QString &svgFilePath, double width = 20, double rotation = 0.0 );
1182
1186 QgsSVGFillSymbolLayer( const QByteArray &svgData, double width = 20, double rotation = 0.0 );
1187
1189
1194 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1195
1200 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1201
1206 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1207
1208 // implemented from base classes
1209
1210 QString layerType() const override;
1211 void startRender( QgsSymbolRenderContext &context ) override;
1212 void stopRender( QgsSymbolRenderContext &context ) override;
1213 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1214 QVariantMap properties() const override;
1215 QgsSVGFillSymbolLayer *clone() const override SIP_FACTORY;
1216 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
1217 bool usesMapUnits() const override;
1218 QgsSymbol *subSymbol() override;
1219 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1220 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1221 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
1222 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1223 bool hasDataDefinedProperties() const override;
1224
1236 void setSvgFilePath( const QString &svgPath );
1237
1243 QString svgFilePath() const { return mSvgFilePath; }
1244
1254 void setPatternWidth( double width ) { mPatternWidth = width;}
1255
1265 double patternWidth() const { return mPatternWidth; }
1266
1276 void setSvgFillColor( const QColor &c ) { setColor( c ); }
1277
1286 QColor svgFillColor() const { return color(); }
1287
1297 void setSvgStrokeColor( const QColor &c ) { mSvgStrokeColor = c; }
1298
1307 QColor svgStrokeColor() const { return mSvgStrokeColor; }
1308
1319 void setSvgStrokeWidth( double w ) { mSvgStrokeWidth = w; }
1320
1331 double svgStrokeWidth() const { return mSvgStrokeWidth; }
1332
1340 void setPatternWidthUnit( Qgis::RenderUnit unit ) { mPatternWidthUnit = unit; }
1341
1349 Qgis::RenderUnit patternWidthUnit() const { return mPatternWidthUnit; }
1350
1358 void setPatternWidthMapUnitScale( const QgsMapUnitScale &scale ) { mPatternWidthMapUnitScale = scale; }
1359
1367 const QgsMapUnitScale &patternWidthMapUnitScale() const { return mPatternWidthMapUnitScale; }
1368
1376 void setSvgStrokeWidthUnit( Qgis::RenderUnit unit ) { mSvgStrokeWidthUnit = unit; }
1377
1385 Qgis::RenderUnit svgStrokeWidthUnit() const { return mSvgStrokeWidthUnit; }
1386
1394 void setSvgStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mSvgStrokeWidthMapUnitScale = scale; }
1395
1403 const QgsMapUnitScale &svgStrokeWidthMapUnitScale() const { return mSvgStrokeWidthMapUnitScale; }
1404
1405 void setOutputUnit( Qgis::RenderUnit unit ) override;
1406 Qgis::RenderUnit outputUnit() const override;
1407
1408 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1409 QgsMapUnitScale mapUnitScale() const override;
1410
1415 QMap<QString, QgsProperty> parameters() const { return mParameters; }
1416
1421 void setParameters( const QMap<QString, QgsProperty> &parameters );
1422
1423 protected:
1424
1425 void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1426
1427 private:
1428
1430 double mPatternWidth = 20;
1432 QgsMapUnitScale mPatternWidthMapUnitScale;
1433 QMap<QString, QgsProperty> mParameters;
1434
1436 QByteArray mSvgData;
1438 QString mSvgFilePath;
1440 QRectF mSvgViewBox;
1441
1442 //param(fill), param(stroke), param(stroke-width) are going
1443 //to be replaced in memory
1444 QColor mSvgStrokeColor = QColor( 35, 35, 35 );
1445 double mSvgStrokeWidth = 0.2;
1446 Qgis::RenderUnit mSvgStrokeWidthUnit = Qgis::RenderUnit::Millimeters;
1447 QgsMapUnitScale mSvgStrokeWidthMapUnitScale;
1448
1450 std::unique_ptr< QgsLineSymbol > mStroke;
1451
1453 void storeViewBox();
1454 void setDefaultSvgParams(); //fills mSvgFillColor, mSvgStrokeColor, mSvgStrokeWidth with default values for mSvgFilePath
1455
1457 void applyPattern( QBrush &brush, const QString &svgFilePath, double patternWidth, Qgis::RenderUnit patternWidthUnit, const QColor &svgFillColor, const QColor &svgStrokeColor,
1458 double svgStrokeWidth, Qgis::RenderUnit svgStrokeWidthUnit, const QgsSymbolRenderContext &context, const QgsMapUnitScale &patternWidthMapUnitScale, const QgsMapUnitScale &svgStrokeWidthMapUnitScale,
1459 const QgsStringMap svgParameters );
1460};
1461
1468{
1469 public:
1472
1477 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1478
1483 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1484
1485 QString layerType() const override;
1486 void startRender( QgsSymbolRenderContext &context ) override;
1487 void stopRender( QgsSymbolRenderContext &context ) override;
1488 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1489 QVariantMap properties() const override;
1490 QgsLinePatternFillSymbolLayer *clone() const override SIP_FACTORY;
1491 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
1492 QImage toTiledPatternImage( ) const override;
1493 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1494
1495 QString ogrFeatureStyleWidth( double widthScaleFactor ) const;
1496
1504 void setLineAngle( double a ) { mLineAngle = a; }
1505
1513 double lineAngle() const { return mLineAngle; }
1514
1521 void setDistance( double d ) { mDistance = d; }
1522
1528 double distance() const { return mDistance; }
1529
1536 void setLineWidth( double w );
1537
1544 double lineWidth() const { return mLineWidth; }
1545
1546 void setColor( const QColor &c ) override;
1547 QColor color() const override;
1548
1560 void setOffset( double offset ) { mOffset = offset; }
1561
1573 double offset() const { return mOffset; }
1574
1581 void setDistanceUnit( Qgis::RenderUnit unit ) { mDistanceUnit = unit; }
1582
1589 Qgis::RenderUnit distanceUnit() const { return mDistanceUnit; }
1590
1598 void setDistanceMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceMapUnitScale = scale; }
1599
1607 const QgsMapUnitScale &distanceMapUnitScale() const { return mDistanceMapUnitScale; }
1608
1614 void setLineWidthUnit( Qgis::RenderUnit unit ) { mLineWidthUnit = unit; }
1615
1621 Qgis::RenderUnit lineWidthUnit() const { return mLineWidthUnit; }
1622
1630 void setLineWidthMapUnitScale( const QgsMapUnitScale &scale ) { mLineWidthMapUnitScale = scale; }
1631
1639 const QgsMapUnitScale &lineWidthMapUnitScale() const { return mLineWidthMapUnitScale; }
1640
1646 void setOffsetUnit( Qgis::RenderUnit unit ) { mOffsetUnit = unit; }
1647
1653 Qgis::RenderUnit offsetUnit() const { return mOffsetUnit; }
1654
1662 void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
1663
1671 const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
1672
1679 Qgis::LineClipMode clipMode() const { return mClipMode; }
1680
1687 void setClipMode( Qgis::LineClipMode mode ) { mClipMode = mode; }
1688
1689 void setOutputUnit( Qgis::RenderUnit unit ) override;
1690 Qgis::RenderUnit outputUnit() const override;
1691 bool usesMapUnits() const override;
1692 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1693 QgsMapUnitScale mapUnitScale() const override;
1694 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1695 QgsSymbol *subSymbol() override;
1696 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1697 bool hasDataDefinedProperties() const override;
1698 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1699 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1700
1701 protected:
1702
1703 void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
1704
1705 private:
1707 double mDistance = 5.0;
1709 QgsMapUnitScale mDistanceMapUnitScale;
1711 double mLineWidth = 0;
1713 QgsMapUnitScale mLineWidthMapUnitScale;
1715 double mLineAngle = 45.0;
1717 double mOffset = 0.0;
1719 QgsMapUnitScale mOffsetMapUnitScale;
1720
1721 bool mRenderUsingLines = false;
1722
1723#ifdef SIP_RUN
1725#endif
1726
1728 bool applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double lineAngle, double distance );
1729
1731 std::unique_ptr< QgsLineSymbol > mFillLineSymbol;
1732 bool mFillLineSymbolRenderStarted = false;
1733
1735};
1736
1743{
1744 public:
1747
1753 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1754 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1755
1756 QString layerType() const override;
1757 void startRender( QgsSymbolRenderContext &context ) override;
1758 void stopRender( QgsSymbolRenderContext &context ) override;
1759 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1760 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1761 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
1762 QVariantMap properties() const override;
1763 QgsPointPatternFillSymbolLayer *clone() const override SIP_FACTORY;
1764 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
1765 QImage toTiledPatternImage( ) const override;
1766 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1767 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1768 QgsSymbol *subSymbol() override;
1769 void setOutputUnit( Qgis::RenderUnit unit ) override;
1770 Qgis::RenderUnit outputUnit() const override;
1771 bool usesMapUnits() const override;
1772 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1773 QgsMapUnitScale mapUnitScale() const override;
1774 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1775 bool hasDataDefinedProperties() const override;
1776 void setColor( const QColor &c ) override;
1777 QColor color() const override;
1778
1788 double distanceX() const { return mDistanceX; }
1789
1799 void setDistanceX( double d ) { mDistanceX = d; }
1800
1807 void setDistanceXUnit( Qgis::RenderUnit unit ) { mDistanceXUnit = unit; }
1808
1814 Qgis::RenderUnit distanceXUnit() const { return mDistanceXUnit; }
1815
1822 void setDistanceXMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceXMapUnitScale = scale; }
1823
1830 const QgsMapUnitScale &distanceXMapUnitScale() const { return mDistanceXMapUnitScale; }
1831
1841 double distanceY() const { return mDistanceY; }
1842
1852 void setDistanceY( double d ) { mDistanceY = d; }
1853
1860 void setDistanceYUnit( Qgis::RenderUnit unit ) { mDistanceYUnit = unit; }
1861
1867 Qgis::RenderUnit distanceYUnit() const { return mDistanceYUnit; }
1868
1875 void setDistanceYMapUnitScale( const QgsMapUnitScale &scale ) { mDistanceYMapUnitScale = scale; }
1876
1883 const QgsMapUnitScale &distanceYMapUnitScale() const { return mDistanceYMapUnitScale; }
1884
1894 double displacementX() const { return mDisplacementX; }
1895
1905 void setDisplacementX( double d ) { mDisplacementX = d; }
1906
1913 void setDisplacementXUnit( Qgis::RenderUnit unit ) { mDisplacementXUnit = unit; }
1914
1920 Qgis::RenderUnit displacementXUnit() const { return mDisplacementXUnit; }
1921
1928 void setDisplacementXMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementXMapUnitScale = scale; }
1929
1936 const QgsMapUnitScale &displacementXMapUnitScale() const { return mDisplacementXMapUnitScale; }
1937
1947 double displacementY() const { return mDisplacementY; }
1948
1958 void setDisplacementY( double d ) { mDisplacementY = d; }
1959
1966 void setDisplacementYUnit( Qgis::RenderUnit unit ) { mDisplacementYUnit = unit; }
1967
1973 Qgis::RenderUnit displacementYUnit() const { return mDisplacementYUnit; }
1974
1981 void setDisplacementYMapUnitScale( const QgsMapUnitScale &scale ) { mDisplacementYMapUnitScale = scale; }
1982
1989 const QgsMapUnitScale &displacementYMapUnitScale() const { return mDisplacementYMapUnitScale; }
1990
1998 void setOffsetX( double offset ) { mOffsetX = offset; }
1999
2006 double offsetX() const { return mOffsetX; }
2007
2015 void setOffsetY( double offset ) { mOffsetY = offset; }
2016
2023 double offsetY() const { return mOffsetY; }
2024
2032 void setOffsetXUnit( Qgis::RenderUnit unit ) { mOffsetXUnit = unit; }
2033
2040 Qgis::RenderUnit offsetXUnit() const { return mOffsetXUnit; }
2041
2049 void setOffsetXMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetXMapUnitScale = scale; }
2050
2057 const QgsMapUnitScale &offsetXMapUnitScale() const { return mOffsetXMapUnitScale; }
2058
2066 void setOffsetYUnit( Qgis::RenderUnit unit ) { mOffsetYUnit = unit; }
2067
2074 Qgis::RenderUnit offsetYUnit() const { return mOffsetYUnit; }
2075
2083 void setOffsetYMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetYMapUnitScale = scale; }
2084
2091 const QgsMapUnitScale &offsetYMapUnitScale() const { return mOffsetYMapUnitScale; }
2092
2099 Qgis::MarkerClipMode clipMode() const { return mClipMode; }
2100
2107 void setClipMode( Qgis::MarkerClipMode mode ) { mClipMode = mode; }
2108
2118 void setMaximumRandomDeviationX( double deviation ) { mRandomDeviationX = deviation; }
2119
2129 double maximumRandomDeviationX() const { return mRandomDeviationX; }
2130
2140 void setMaximumRandomDeviationY( double deviation ) { mRandomDeviationY = deviation; }
2141
2151 double maximumRandomDeviationY() const { return mRandomDeviationY; }
2152
2160 void setRandomDeviationXUnit( Qgis::RenderUnit unit ) { mRandomDeviationXUnit = unit; }
2161
2169 Qgis::RenderUnit randomDeviationXUnit() const { return mRandomDeviationXUnit; }
2170
2178 void setRandomDeviationYUnit( Qgis::RenderUnit unit ) { mRandomDeviationYUnit = unit; }
2179
2188 Qgis::RenderUnit randomDeviationYUnit() const { return mRandomDeviationYUnit; }
2189
2197 const QgsMapUnitScale &randomDeviationXMapUnitScale() const { return mRandomDeviationXMapUnitScale; }
2198
2206 const QgsMapUnitScale &randomDeviationYMapUnitScale() const { return mRandomDeviationYMapUnitScale; }
2207
2215 void setRandomDeviationXMapUnitScale( const QgsMapUnitScale &scale ) { mRandomDeviationXMapUnitScale = scale; }
2216
2224 void setRandomDeviationYMapUnitScale( const QgsMapUnitScale &scale ) { mRandomDeviationYMapUnitScale = scale; }
2225
2232 unsigned long seed() const { return mSeed; }
2233
2242 void setSeed( unsigned long seed ) { mSeed = seed; }
2243
2244 protected:
2245 std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol;
2246 bool mMarkerSymbolRenderStarted = false;
2247 double mDistanceX = 15;
2250 double mDistanceY = 15;
2253 double mDisplacementX = 0;
2256 double mDisplacementY = 0;
2259 double mOffsetX = 0;
2262 double mOffsetY = 0;
2265
2266 double mRandomDeviationX = 0;
2269 double mRandomDeviationY = 0;
2272 unsigned long mSeed = 0;
2273
2274 void applyDataDefinedSettings( QgsSymbolRenderContext &context ) override;
2275
2276 private:
2277#ifdef SIP_RUN
2279#endif
2280
2281 bool applyPattern( const QgsSymbolRenderContext &context, QBrush &brush, double distanceX, double distanceY,
2282 double displacementX, double displacementY, double offsetX, double offsetY );
2283
2285
2286 bool mRenderUsingMarkers = false;
2287};
2288
2298{
2299 public:
2300
2307 QgsRandomMarkerFillSymbolLayer( int pointCount = 10, Qgis::PointCountMethod method = Qgis::PointCountMethod::Absolute, double densityArea = 250.0, unsigned long seed = 0 );
2308
2310
2316 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
2317
2318 QString layerType() const override;
2319 void startRender( QgsSymbolRenderContext &context ) override;
2320 void stopRender( QgsSymbolRenderContext &context ) override;
2321 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
2322 QVariantMap properties() const override;
2323 QgsRandomMarkerFillSymbolLayer *clone() const override SIP_FACTORY;
2324 bool canCauseArtifactsBetweenAdjacentTiles() const override;
2325
2326 void setColor( const QColor &color ) override;
2327 QColor color() const override;
2328
2329 QgsSymbol *subSymbol() override;
2330 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) FINAL;
2331
2332 void setOutputUnit( Qgis::RenderUnit unit ) override;
2333 Qgis::RenderUnit outputUnit() const override;
2334 bool usesMapUnits() const override;
2335
2336 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
2337 QgsMapUnitScale mapUnitScale() const override;
2338
2339 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
2340 bool hasDataDefinedProperties() const override;
2341
2347 int pointCount() const;
2348
2354 void setPointCount( int count );
2355
2361 unsigned long seed() const;
2362
2370 void setSeed( unsigned long seed );
2371
2377 bool clipPoints() const;
2378
2384 void setClipPoints( bool clipped );
2385
2391 Qgis::PointCountMethod countMethod() const;
2392
2398 void setCountMethod( Qgis::PointCountMethod method );
2399
2409 double densityArea() const;
2410
2416 void setDensityArea( double area );
2417
2423 void setDensityAreaUnit( Qgis::RenderUnit unit ) { mDensityAreaUnit = unit; }
2424
2429 Qgis::RenderUnit densityAreaUnit() const { return mDensityAreaUnit; }
2430
2438 void setDensityAreaUnitScale( const QgsMapUnitScale &scale ) { mDensityAreaUnitScale = scale; }
2439
2446 const QgsMapUnitScale &densityAreaUnitScale() const { return mDensityAreaUnitScale; }
2447
2448 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2449 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2450
2451 private:
2452#ifdef SIP_RUN
2454#endif
2455
2456 struct Part
2457 {
2458 QPolygonF exterior;
2459 QVector<QPolygonF> rings;
2460 };
2461
2462 QVector< Part > mCurrentParts;
2463
2464 void render( QgsRenderContext &context, const QVector< Part > &parts, const QgsFeature &feature, bool selected );
2465
2466 std::unique_ptr< QgsMarkerSymbol > mMarker;
2468 int mPointCount = 10;
2469 double mDensityArea = 250.0;
2471 QgsMapUnitScale mDensityAreaUnitScale;
2472 unsigned long mSeed = 0;
2473 bool mClipPoints = false;
2474
2475 bool mRenderingFeature = false;
2476 double mFeatureSymbolOpacity = 1;
2477};
2478
2479
2485{
2486 public:
2489
2490 // static stuff
2491
2497 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
2498 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
2499
2500 // implemented from base classes
2501
2502 QString layerType() const override;
2503 void startRender( QgsSymbolRenderContext &context ) override;
2504 void stopRender( QgsSymbolRenderContext &context ) override;
2505 void renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
2506 QVariantMap properties() const override;
2507 QgsCentroidFillSymbolLayer *clone() const override SIP_FACTORY;
2508 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
2509 void setColor( const QColor &color ) override;
2510 QColor color() const override;
2511 QgsSymbol *subSymbol() override;
2512 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) FINAL;
2513 void setOutputUnit( Qgis::RenderUnit unit ) override;
2514 Qgis::RenderUnit outputUnit() const override;
2515 bool usesMapUnits() const override;
2516 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
2517 QgsMapUnitScale mapUnitScale() const override;
2518 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
2519 bool hasDataDefinedProperties() const override;
2520 bool canCauseArtifactsBetweenAdjacentTiles() const override;
2521
2522 void setPointOnSurface( bool pointOnSurface ) { mPointOnSurface = pointOnSurface; }
2523 bool pointOnSurface() const { return mPointOnSurface; }
2524
2529 void setPointOnAllParts( bool pointOnAllParts ) { mPointOnAllParts = pointOnAllParts; }
2530
2535 bool pointOnAllParts() const { return mPointOnAllParts; }
2536
2543 bool clipPoints() const { return mClipPoints; }
2544
2551 void setClipPoints( bool clipPoints ) { mClipPoints = clipPoints; }
2552
2559 bool clipOnCurrentPartOnly() const { return mClipOnCurrentPartOnly; }
2560
2567 void setClipOnCurrentPartOnly( bool clipOnCurrentPartOnly ) { mClipOnCurrentPartOnly = clipOnCurrentPartOnly; }
2568
2569 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2570 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
2571
2572 protected:
2573
2574 std::unique_ptr< QgsMarkerSymbol > mMarker;
2575 bool mPointOnSurface = false;
2576 bool mPointOnAllParts = true;
2577 bool mClipPoints = false;
2578 bool mClipOnCurrentPartOnly = false;
2579
2580 bool mRenderingFeature = false;
2581 double mFeatureSymbolOpacity = 1;
2582 bool mUseSelectedColor = false;
2583
2584 private:
2585#ifdef SIP_RUN
2587#endif
2588 struct Part
2589 {
2590 QPolygonF exterior;
2591 QVector<QPolygonF> rings;
2592 };
2593
2594 void render( QgsRenderContext &context, const QVector<Part> &parts, const QgsFeature &feature, bool selected );
2595 QVector<Part> mCurrentParts;
2596};
2597
2598#endif
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
MarkerClipMode
Marker clipping modes.
Definition qgis.h:2770
@ Shape
Clip to polygon shape.
LineClipMode
Line clipping modes.
Definition qgis.h:2784
@ ClipPainterOnly
Applying clipping on the painter only (i.e. line endpoints will coincide with polygon bounding box,...
GradientColorSource
Gradient color sources.
Definition qgis.h:2699
@ SimpleTwoColor
Simple two color gradient.
GradientSpread
Gradient spread options, which control how gradients are rendered outside of their start and end poin...
Definition qgis.h:2743
@ Pad
Pad out gradient using colors at endpoint of gradient.
PointCountMethod
Methods which define the number of points randomly filling a polygon.
Definition qgis.h:2758
@ Absolute
The point count is used as an absolute count of markers.
RenderUnit
Rendering size units.
Definition qgis.h:4489
@ Millimeters
Millimeters.
GradientType
Gradient types.
Definition qgis.h:2713
@ Linear
Linear gradient.
SymbolCoordinateReference
Symbol coordinate reference modes.
Definition qgis.h:2728
@ Feature
Relative to feature/shape being rendered.
void setPointOnAllParts(bool pointOnAllParts)
Sets whether a point is drawn for all parts or only on the biggest part of multi-part features.
void setClipOnCurrentPartOnly(bool clipOnCurrentPartOnly)
Sets whether point markers should be clipped to the current part boundary only.
void setClipPoints(bool clipPoints)
Sets whether point markers should be clipped to the polygon boundary.
std::unique_ptr< QgsMarkerSymbol > mMarker
bool pointOnAllParts() const
Returns whether a point is drawn for all parts or only on the biggest part of multi-part features.
bool clipPoints() const
Returns true if point markers should be clipped to the polygon boundary.
~QgsCentroidFillSymbolLayer() override
bool clipOnCurrentPartOnly() const
Returns true if point markers should be clipped to the current part boundary only.
Abstract base class for color ramps.
Exports QGIS layers to the DXF format.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
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,...
virtual QImage toTiledPatternImage() const
Renders the symbol layer as an image that can be used as a seamless pattern fill for polygons,...
QColor color2() const
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoC...
void setGradientSpread(Qgis::GradientSpread gradientSpread)
Sets the gradient spread mode, which controls how the gradient behaves outside of the predefined stop...
Qgis::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
Qgis::SymbolCoordinateReference coordinateMode() const
Returns the coordinate mode for gradient, which controls how the gradient stops are positioned.
bool referencePoint2IsCentroid() const
Returns whether the end point for the gradient is taken from the feature centroid.
void setGradientType(Qgis::GradientType gradientType)
Sets the type of gradient, e.g., linear or radial.
void setReferencePoint2(QPointF referencePoint)
Sets the end point of gradient fill, in the range [0,0] - [1,1].
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the fill's offset.
void setCoordinateMode(Qgis::SymbolCoordinateReference coordinateMode)
Sets the coordinate mode for gradient, which controls how the gradient stops are positioned.
Qgis::SymbolCoordinateReference mCoordinateMode
Qgis::GradientSpread mGradientSpread
void setReferencePoint2IsCentroid(bool isCentroid)
Sets whether the end point for the gradient is taken from the feature centroid.
void setReferencePoint1IsCentroid(bool isCentroid)
Sets whether the starting point for the gradient is taken from the feature centroid.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
void setGradientColorType(Qgis::GradientColorSource gradientColorType)
Sets the gradient color mode, which controls how gradient color stops are created.
QPointF referencePoint1() const
Returns the starting point of gradient fill, in the range [0,0] - [1,1].
Qgis::GradientSpread gradientSpread() const
Returns the gradient spread mode, which controls how the gradient behaves outside of the predefined s...
QgsColorRamp * colorRamp()
Returns the color ramp used for the gradient fill.
void setReferencePoint1(QPointF referencePoint)
Sets the starting point of gradient fill, in the range [0,0] - [1,1].
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
Qgis::GradientColorSource gradientColorType() const
Returns the gradient color mode, which controls how gradient color stops are created.
QPointF offset() const
Returns the offset by which polygons will be translated during rendering.
Qgis::GradientColorSource mGradientColorType
Qgis::GradientType gradientType() const
Returns the type of gradient, e.g., linear or radial.
bool referencePoint1IsCentroid() const
Returns whether the starting point for the gradient is taken from the feature centroid.
QPointF referencePoint2() const
Returns the end point of gradient fill, in the range [0,0] - [1,1].
void setColor2(const QColor &color2)
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColo...
Base class for polygon renderers generating texture images.
QgsMapUnitScale mStrokeWidthMapUnitScale
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the units for the symbol's stroke width.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
Qgis::SymbolCoordinateReference coordinateReference() const
Returns the coordinate reference mode for fill which controls how the top left corner of the image fi...
void setCoordinateReference(Qgis::SymbolCoordinateReference coordinateReference)
Sets the coordinate reference mode for fill which controls how the top left corner of the image fill ...
Qgis::RenderUnit strokeWidthUnit() const
Returns the units for the symbol's stroke width.
virtual void applyDataDefinedSettings(QgsSymbolRenderContext &context)
Applies data defined settings prior to generating the fill symbol brush.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
~QgsImageFillSymbolLayer() override
A symbol fill consisting of repeated parallel lines.
Qgis::RenderUnit distanceUnit() const
Returns the units for the distance between lines in the fill pattern.
void setLineWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line width.
double lineWidth() const
Returns the width of the line subsymbol used to render the parallel lines in the fill.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line distance.
Qgis::LineClipMode clipMode() const
Returns the line clipping mode, which defines how lines are clipped at the edges of shapes.
double lineAngle() const
Returns the angle for the parallel lines used to fill the symbol.
Qgis::RenderUnit lineWidthUnit() const
Returns the units for the line's width.
void setLineWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the line's width.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the pattern's line offset.
void setDistance(double d)
Sets the distance between lines in the fill pattern.
const QgsMapUnitScale & lineWidthMapUnitScale() const
Returns the map unit scale for the pattern's line width.
void setClipMode(Qgis::LineClipMode mode)
Sets the line clipping mode, which defines how lines are clipped at the edges of shapes.
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the line pattern's offset.
const QgsMapUnitScale & distanceMapUnitScale() const
Returns the map unit scale for the pattern's line distance.
double offset() const
Returns the offset distance for lines within the fill, which is the distance to offset the parallel l...
void setDistanceUnit(Qgis::RenderUnit unit)
Sets the unit for the distance between lines in the fill pattern.
double distance() const
Returns the distance between lines in the fill pattern.
void setOffset(double offset)
Sets the offset distance for lines within the fill, which is the distance to offset the parallel line...
Qgis::RenderUnit offsetUnit() const
Returns the units for the line pattern's offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's line offset.
~QgsLinePatternFillSymbolLayer() override
A line symbol type, for rendering LineString and MultiLineString geometries.
Struct for storing maximum and minimum scales for measurements in map units.
A marker symbol type, for rendering Point and MultiPoint geometries.
Resolves relative paths into absolute paths and vice versa.
A fill symbol layer which fills polygon shapes with repeating marker symbols.
const QgsMapUnitScale & distanceYMapUnitScale() const
Returns the map unit scale for the vertical distance between points in the pattern.
void setDisplacementX(double d)
Sets the horizontal displacement for odd numbered rows in the pattern.
void setOffsetXUnit(Qgis::RenderUnit unit)
Sets the units for the horizontal offset between rows in the pattern.
Qgis::RenderUnit offsetYUnit() const
Returns the units for the vertical offset for rows in the pattern.
const QgsMapUnitScale & randomDeviationXMapUnitScale() const
Returns the unit scale for the horizontal random deviation of points in the pattern.
void setOffsetX(double offset)
Sets the horizontal offset values for points in the pattern.
double maximumRandomDeviationY() const
Returns the maximum vertical random deviation of points in the pattern.
void setDistanceYUnit(Qgis::RenderUnit unit)
Sets the unit for the vertical distance between points in the pattern.
Qgis::RenderUnit randomDeviationYUnit() const
Returns the units for the vertical random deviation of points in the pattern.
double displacementY() const
Returns the vertical displacement for odd numbered columns in the pattern.
void setDisplacementYUnit(Qgis::RenderUnit unit)
Sets the units for the vertical displacement between rows in the pattern.
void setRandomDeviationYUnit(Qgis::RenderUnit unit)
Sets the unit for the vertical random deviation of points in the pattern.
const QgsMapUnitScale & distanceXMapUnitScale() const
Returns the map unit scale for the horizontal distance between points in the pattern.
void setRandomDeviationYMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the vertical random deviation of points in the pattern.
unsigned long seed() const
Returns the random number seed to use when randomly shifting points, or 0 if a truly random sequence ...
Qgis::MarkerClipMode clipMode() const
Returns the marker clipping mode, which defines how markers are clipped at the edges of shapes.
void setRandomDeviationXMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the horizontal random deviation of points in the pattern.
Qgis::RenderUnit distanceXUnit() const
Returns the units for the horizontal distance between points in the pattern.
double offsetY() const
Returns the vertical offset values for points in the pattern.
void setDisplacementY(double d)
Sets the vertical displacement for odd numbered columns in the pattern.
void setMaximumRandomDeviationX(double deviation)
Sets the maximum horizontal random deviation of points in the pattern.
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the vertical displacement between odd numbered columns in the pattern.
void setSeed(unsigned long seed)
Sets the random number seed to use when randomly shifting points, or 0 if a truly random sequence wil...
void setOffsetY(double offset)
Sets the vertical offset values for points in the pattern.
const QgsMapUnitScale & offsetXMapUnitScale() const
Returns the unit scale for the horizontal offset for rows in the pattern.
const QgsMapUnitScale & displacementXMapUnitScale() const
Returns the map unit scale for the horizontal displacement between odd numbered rows in the pattern.
const QgsMapUnitScale & offsetYMapUnitScale() const
Returns the unit scale for the vertical offset between rows in the pattern.
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the horizontal distance between points in the pattern.
Qgis::RenderUnit distanceYUnit() const
Returns the units for the vertical distance between points in the pattern.
const QgsMapUnitScale & displacementYMapUnitScale() const
Returns the map unit scale for the vertical displacement between odd numbered columns in the pattern.
void setDistanceXUnit(Qgis::RenderUnit unit)
Sets the unit for the horizontal distance between points in the pattern.
void setOffsetYUnit(Qgis::RenderUnit unit)
Sets the units for the vertical offset for rows in the pattern.
const QgsMapUnitScale & randomDeviationYMapUnitScale() const
Returns the unit scale for the vertical random deviation of points in the pattern.
Qgis::RenderUnit offsetXUnit() const
Returns the units for the horizontal offset for rows in the pattern.
void setOffsetYMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the vertical offset for rows in the pattern.
void setDistanceY(double d)
Sets the vertical distance between rendered markers in the fill.
Qgis::RenderUnit displacementXUnit() const
Returns the units for the horizontal displacement between rows in the pattern.
Qgis::RenderUnit randomDeviationXUnit() const
Returns the units for the horizontal random deviation of points in the pattern.
void setDisplacementXUnit(Qgis::RenderUnit unit)
Sets the units for the horizontal displacement between rows in the pattern.
void setDistanceX(double d)
Sets the horizontal distance between rendered markers in the fill.
double offsetX() const
Returns the horizontal offset values for points in the pattern.
void setRandomDeviationXUnit(Qgis::RenderUnit unit)
Sets the unit for the horizontal random deviation of points in the pattern.
double maximumRandomDeviationX() const
Returns the maximum horizontal random deviation of points in the pattern.
std::unique_ptr< QgsMarkerSymbol > mMarkerSymbol
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the horizontal displacement between odd numbered rows in the pattern.
void setMaximumRandomDeviationY(double deviation)
Sets the maximum vertical random deviation of points in the pattern.
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the vertical distance between points in the pattern.
Qgis::RenderUnit displacementYUnit() const
Returns the units for the vertical displacement between rows in the pattern.
double displacementX() const
Returns the horizontal displacement for odd numbered rows in the pattern.
void setOffsetXMapUnitScale(const QgsMapUnitScale &scale)
Sets the unit scale for the horizontal offset for rows in the pattern.
~QgsPointPatternFillSymbolLayer() override
double distanceY() const
Returns the vertical distance between rendered markers in the fill.
void setClipMode(Qgis::MarkerClipMode mode)
Sets the marker clipping mode, which defines how markers are clipped at the edges of shapes.
A fill symbol layer which places markers at random locations within polygons.
~QgsRandomMarkerFillSymbolLayer() override
void setDensityAreaUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the density area.
Qgis::RenderUnit densityAreaUnit() const
Returns the units for the density area.
const QgsMapUnitScale & densityAreaUnitScale() const
Returns the map scale for the density area.
A class for filling symbols with a repeated raster image.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the image's width and height.
double width() const
Returns the width used for scaling the image used in the fill.
Q_DECL_DEPRECATED void setWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the image's width.
void setOffsetUnit(const Qgis::RenderUnit unit)
Sets the units for the fill's offset.
void setHeight(double height)
Sets the height for scaling the image.
Q_DECL_DEPRECATED const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
Qgis::SymbolCoordinateReference coordinateMode() const
Coordinate mode for fill.
Qgis::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
double opacity() const
Returns the opacity for the raster image used in the fill.
void setSizeUnit(Qgis::RenderUnit unit)
Sets the unit for the image's width and height.
~QgsRasterFillSymbolLayer() override
Q_DECL_DEPRECATED Qgis::RenderUnit widthUnit() const
Returns the units for the image's width.
Qgis::RenderUnit sizeUnit() const
Returns the units for the image's width and height.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
QString imageFilePath() const
The path to the raster image used for the fill.
Q_DECL_DEPRECATED void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
double height() const
Returns the height used for scaling the image used in the fill.
void setWidth(double width)
Sets the width for scaling the image used in the fill.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width and height.
QPointF offset() const
Returns the offset for the fill.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
void setOffset(QPointF offset)
Sets the offset for the fill.
Contains information about the context of a rendering operation.
A class for filling symbols with a repeated SVG file.
void setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's stroke.
QColor svgStrokeColor() const
Returns the stroke color used for rendering the SVG content.
void setSvgStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the stroke width.
Qgis::RenderUnit patternWidthUnit() const
Returns the units for the width of the SVG images in the pattern.
void setSvgFillColor(const QColor &c)
Sets the fill color used for rendering the SVG content.
const QgsMapUnitScale & svgStrokeWidthMapUnitScale() const
Returns the map unit scale for the pattern's stroke.
double svgStrokeWidth() const
Returns the stroke width used for rendering the SVG content.
QMap< QString, QgsProperty > parameters() const
Returns the dynamic SVG parameters.
void setSvgStrokeWidth(double w)
Sets the stroke width used for rendering the SVG content.
void setPatternWidthUnit(Qgis::RenderUnit unit)
Sets the unit for the width of the SVG images in the pattern.
QColor svgFillColor() const
Returns the fill color used for rendering the SVG content.
void setSvgStrokeColor(const QColor &c)
Sets the stroke color used for rendering the SVG content.
const QgsMapUnitScale & patternWidthMapUnitScale() const
Returns the map unit scale for the pattern's width.
Qgis::RenderUnit svgStrokeWidthUnit() const
Returns the units for the stroke width.
void setPatternWidth(double width)
Sets the width to render the SVG content as within the fill (i.e.
double patternWidth() const
Returns the width of the rendered SVG content within the fill (i.e.
~QgsSVGFillSymbolLayer() override
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the pattern's width.
~QgsShapeburstFillSymbolLayer() override
Qgis::RenderUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
QgsColorRamp * colorRamp()
Returns the color ramp used for the shapeburst fill.
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the units used for the offset for the shapeburst fill.
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading.
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
QgsShapeburstFillSymbolLayer & operator=(const QgsShapeburstFillSymbolLayer &other)=delete
QgsShapeburstFillSymbolLayer cannot be copied.
Qgis::RenderUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
QPointF offset() const
Returns the offset for the shapeburst fill.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
const QgsMapUnitScale & offsetMapUnitScale() const
void setDistanceUnit(Qgis::RenderUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
void setColorType(Qgis::GradientColorSource colorType)
Sets the color mode to use for the shapeburst fill.
Qgis::GradientColorSource colorType() const
Returns the color mode used for the shapeburst fill.
QgsShapeburstFillSymbolLayer(const QgsShapeburstFillSymbolLayer &other)=delete
QgsShapeburstFillSymbolLayer cannot be copied.
const QgsMapUnitScale & distanceMapUnitScale() const
Qgis::RenderUnit strokeWidthUnit() const
Returns the units for the width of the fill's stroke.
Qt::PenJoinStyle penJoinStyle() const
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setBrushStyle(Qt::BrushStyle style)
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
const QgsMapUnitScale & strokeWidthMapUnitScale() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the units for the width of the fill's stroke.
~QgsSimpleFillSymbolLayer() override
void setPenJoinStyle(Qt::PenJoinStyle style)
QColor fillColor() const override
Returns the fill color for the symbol layer.
Qt::PenStyle strokeStyle() const
QgsMapUnitScale mOffsetMapUnitScale
void setStrokeWidth(double strokeWidth)
QPointF offset() const
Returns the offset by which polygons will be translated during rendering.
Qgis::RenderUnit offsetUnit() const
Returns the units for the fill's offset.
void setStrokeStyle(Qt::PenStyle strokeStyle)
QgsMapUnitScale mStrokeWidthMapUnitScale
void setOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the fill's offset.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
void setOffset(QPointF offset)
Sets an offset by which polygons will be translated during rendering.
void setStrokeColor(const QColor &strokeColor) override
Sets the stroke color for the symbol layer.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
virtual void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called before the layer will be rendered for a particular feature.
virtual QgsMapUnitScale mapUnitScale() const
virtual QColor dxfBrushColor(QgsSymbolRenderContext &context) const
Gets brush/fill color.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual Qt::PenStyle dxfPenStyle() const
Gets pen style.
virtual QColor dxfColor(QgsSymbolRenderContext &context) const
Gets color.
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual Qgis::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol layer.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context)
Called after the layer has been rendered for a particular feature.
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets line width.
virtual QColor strokeColor() const
Returns the stroke color for the symbol layer.
virtual double dxfAngle(QgsSymbolRenderContext &context) const
Gets angle.
virtual bool canCauseArtifactsBetweenAdjacentTiles() const
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
virtual bool usesMapUnits() const
Returns true if the symbol layer has any components which use map unit based sizes.
virtual void setOutputUnit(Qgis::RenderUnit unit)
Sets the units to use for sizes and widths within the symbol layer.
virtual Qt::BrushStyle dxfBrushStyle() const
Gets brush/fill style.
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:94
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QMap< QString, QString > QgsStringMap
Definition qgis.h:5983
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define FINAL
Definition qgis_sip.h:242
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_ABSTRACT
Definition qgis_sip.h:213
#define SIP_FACTORY
Definition qgis_sip.h:76
#define DEFAULT_SIMPLEFILL_JOINSTYLE
#define DEFAULT_SIMPLEFILL_COLOR
#define DEFAULT_SIMPLEFILL_STYLE
#define DEFAULT_SIMPLEFILL_BORDERSTYLE
#define DEFAULT_SIMPLEFILL_BORDERCOLOR
#define DEFAULT_SIMPLEFILL_BORDERWIDTH