QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgslinesymbollayer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslinesymbollayer.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 QGSLINESYMBOLLAYER_H
17#define QGSLINESYMBOLLAYER_H
18
19#include "qgis.h"
20#include "qgis_core.h"
22#include "qgssymbollayer.h"
23
24#include <QPen>
25#include <QVector>
26
27class QgsExpression;
28class QgsMarkerSymbol;
29class QgsLineSymbol;
30class QgsPathResolver;
31class QgsColorRamp;
32class QgsFillSymbol;
33
34#define DEFAULT_SIMPLELINE_COLOR QColor( 35, 35, 35 )
35#define DEFAULT_SIMPLELINE_WIDTH Qgis::DEFAULT_LINE_WIDTH
36#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
37#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
38#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
39
46{
47 public:
54
56
57 // static stuff
58
64 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
65
69 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
70
71 QString layerType() const override;
72 Qgis::SymbolLayerFlags flags() const override;
73 void startRender( QgsSymbolRenderContext &context ) override;
74 void stopRender( QgsSymbolRenderContext &context ) override;
75 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
76 //overridden so that clip path can be set when using draw inside polygon option
77 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
78 QVariantMap properties() const override;
80 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
81 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
82 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
83 void setOutputUnit( Qgis::RenderUnit unit ) override;
84 Qgis::RenderUnit outputUnit() const override;
85 bool usesMapUnits() const override;
86 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
87 QgsMapUnitScale mapUnitScale() const override;
88 double estimateMaxBleed( const QgsRenderContext &context ) const override;
89 QVector<qreal> dxfCustomDashPattern( Qgis::RenderUnit &unit ) const override;
90 Qt::PenStyle dxfPenStyle() const override;
91 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
92 double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
93 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
94 bool canCauseArtifactsBetweenAdjacentTiles() const override;
95
101 Qt::PenStyle penStyle() const { return mPenStyle; }
102
108 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
109
115 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
116
122 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
123
129 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
130
136 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
137
144 bool useCustomDashPattern() const { return mUseCustomDashPattern; }
145
152 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
153
158 void setCustomDashPatternUnit( Qgis::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
159
164 Qgis::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
165
170 const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
171
176 void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
177
190 QVector<qreal> customDashVector() const { return mCustomDashVector; }
191
204 void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
205
218 double dashPatternOffset() const { return mDashPatternOffset; }
219
232 void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
233
243 void setDashPatternOffsetUnit( Qgis::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
244
254 Qgis::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
255
265 const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
266
276 void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
277
291 double trimDistanceStart() const { return mTrimDistanceStart; }
292
306 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
307
318 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
319
330 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
331
342 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
343
354 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
355
369 double trimDistanceEnd() const { return mTrimDistanceEnd; }
370
384 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
385
396 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
397
408 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
409
420 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
421
432 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
433
443 bool drawInsidePolygon() const { return mDrawInsidePolygon; }
444
454 void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
455
465 bool alignDashPattern() const;
466
476 void setAlignDashPattern( bool enabled );
477
488 bool tweakDashPatternOnCorners() const;
489
500 void setTweakDashPatternOnCorners( bool enabled );
501
502 private:
503 Qt::PenStyle mPenStyle = Qt::SolidLine;
504 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
505 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
506 QPen mPen;
507 QPen mSelPen;
508
509 bool mUseCustomDashPattern = false;
510 Qgis::RenderUnit mCustomDashPatternUnit = Qgis::RenderUnit::Millimeters;
511 QgsMapUnitScale mCustomDashPatternMapUnitScale;
512
513 double mDashPatternOffset = 0;
514 Qgis::RenderUnit mDashPatternOffsetUnit = Qgis::RenderUnit::Millimeters;
515 QgsMapUnitScale mDashPatternOffsetMapUnitScale;
516
517 double mTrimDistanceStart = 0;
518 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
519 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
520
521 double mTrimDistanceEnd = 0;
522 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
523 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
524
526 QVector<qreal> mCustomDashVector;
527
528 bool mAlignDashPattern = false;
529 bool mPatternCartographicTweakOnSharpCorners = false;
530
531 bool mDrawInsidePolygon = false;
532
533 //helper functions for data defined symbology
534 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
535 void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
536};
537
539
540#define DEFAULT_MARKERLINE_ROTATE true
541#define DEFAULT_MARKERLINE_INTERVAL 3
542
553{
554 public:
562 QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true, double interval = 3 );
563
565
570 bool rotateSymbols() const { return mRotateSymbols; }
571
576 void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
577
583 double interval() const { return mInterval; }
584
591 void setInterval( double interval ) { mInterval = interval; }
592
599 void setIntervalUnit( Qgis::RenderUnit unit ) { mIntervalUnit = unit; }
600
606 Qgis::RenderUnit intervalUnit() const { return mIntervalUnit; }
607
614 void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
615
622 const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
623
629 Q_DECL_DEPRECATED Qgis::MarkerLinePlacement placement() const SIP_DEPRECATED;
630
636 Q_DECL_DEPRECATED void setPlacement( Qgis::MarkerLinePlacement placement ) SIP_DEPRECATED;
637
643 Qgis::MarkerLinePlacements placements() const { return mPlacements; }
644
651
666 bool placeOnEveryPart() const { return mPlaceOnEveryPart; }
667
682 void setPlaceOnEveryPart( bool respect ) { mPlaceOnEveryPart = respect; }
683
694 double offsetAlongLine() const { return mOffsetAlongLine; }
695
707 void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
708
715 Qgis::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
716
723 void setOffsetAlongLineUnit( Qgis::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
724
729 const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
730
735 void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
736
747 double averageAngleLength() const { return mAverageAngleLength; }
748
759 void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
760
769 void setAverageAngleUnit( Qgis::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
770
779 Qgis::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
780
789 void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
790
799 const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
800
801
808 void setBlankSegmentsUnit( Qgis::RenderUnit unit ) { mBlankSegmentsUnit = unit; }
809
816 Qgis::RenderUnit blankSegmentsUnit() const { return mBlankSegmentsUnit; }
817
818 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
819 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) final;
820 Qgis::RenderUnit outputUnit() const final;
821 void setOutputUnit( Qgis::RenderUnit unit ) override;
822 void setMapUnitScale( const QgsMapUnitScale &scale ) final;
823 QgsMapUnitScale mapUnitScale() const final;
824 QVariantMap properties() const override;
825 bool canCauseArtifactsBetweenAdjacentTiles() const override;
826
827 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
828 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
829
833 void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
834
835 protected:
842 virtual void setSymbolLineAngle( double angle ) = 0;
843
847 virtual double symbolAngle() const = 0;
848
852 virtual void setSymbolAngle( double angle ) = 0;
853
866 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
867
872 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
873
874 protected:
875 int mRingIndex = 0; // current ring index while rendering
876
877 private:
878 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
879 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
880 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
881
882 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
883
897 void renderOffsetVertexAlongLine(
898 const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments
899 );
900
901
902 static void collectOffsetPoints(
903 const QVector< QPointF> &points, QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, QList<int> *pointIndices = nullptr, double initialLag = 0, int numberPointsRequired = -1
904 );
905
906 bool mRotateSymbols = true;
907 double mInterval = 3;
908 Qgis::RenderUnit mIntervalUnit = Qgis::RenderUnit::Millimeters;
909 QgsMapUnitScale mIntervalMapUnitScale;
910 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
911 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
912 Qgis::RenderUnit mOffsetAlongLineUnit = Qgis::RenderUnit::Millimeters; //unit for offset along line
913 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
914 double mAverageAngleLength = 4;
915 Qgis::RenderUnit mAverageAngleLengthUnit = Qgis::RenderUnit::Millimeters;
916 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
917 Qgis::RenderUnit mBlankSegmentsUnit = Qgis::RenderUnit::MapUnits;
918 bool mPlaceOnEveryPart = true;
919
920 bool mRenderingFeature = false;
921 bool mHasRenderedFirstPart = false;
922 QPointF mFinalVertex;
923 bool mCurrentFeatureIsSelected = false;
924 double mFeatureSymbolOpacity = 1;
925
927};
928
935{
936 public:
945
947
948 // static stuff
949
955 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
956
960 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
961
962 // implemented from base classes
963
964 QString layerType() const override;
965 void startRender( QgsSymbolRenderContext &context ) override;
966 void stopRender( QgsSymbolRenderContext &context ) override;
968 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
969 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
970 void setColor( const QColor &color ) override;
971 QColor color() const override;
972 QgsSymbol *subSymbol() override;
973 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
974 void setWidth( double width ) override;
975 double width() const override;
976 double width( const QgsRenderContext &context ) const override;
977 double estimateMaxBleed( const QgsRenderContext &context ) const override;
978 void setOutputUnit( Qgis::RenderUnit unit ) override;
979 bool usesMapUnits() const override;
980 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
981 bool hasDataDefinedProperties() const override;
982 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
983
990 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
991
996 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
997
998 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
999
1000 protected:
1001 std::unique_ptr< QgsMarkerSymbol > mMarker;
1002
1003 void setSymbolLineAngle( double angle ) override;
1004 double symbolAngle() const override;
1005 void setSymbolAngle( double angle ) override;
1006 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1007
1008 private:
1009#ifdef SIP_RUN
1011#endif
1012};
1013
1014
1024{
1025 public:
1033 QgsHashedLineSymbolLayer( bool rotateSymbol = true, double interval = 3 );
1034
1036
1042 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1043
1044 QString layerType() const override;
1045 void startRender( QgsSymbolRenderContext &context ) override;
1046 void stopRender( QgsSymbolRenderContext &context ) override;
1047 QVariantMap properties() const override;
1048 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1049 void setColor( const QColor &color ) override;
1050 QColor color() const override;
1051 QgsSymbol *subSymbol() override;
1052 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1053 void setWidth( double width ) override;
1054 double width() const override;
1055 double width( const QgsRenderContext &context ) const override;
1056 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1057 void setOutputUnit( Qgis::RenderUnit unit ) override;
1058 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1059 bool hasDataDefinedProperties() const override;
1060 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1061 bool usesMapUnits() const override;
1062
1068 double hashAngle() const;
1069
1075 void setHashAngle( double angle );
1076
1082 double hashLength() const { return mHashLength; }
1083
1089 void setHashLength( double length ) { mHashLength = length; }
1090
1096 void setHashLengthUnit( Qgis::RenderUnit unit ) { mHashLengthUnit = unit; }
1097
1103 Qgis::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1104
1111 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1112
1119 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1120
1121 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1122
1123 protected:
1124 void setSymbolLineAngle( double angle ) override;
1125 double symbolAngle() const override;
1126 void setSymbolAngle( double angle ) override;
1127 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1128
1129 private:
1130#ifdef SIP_RUN
1132#endif
1133
1134 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1135
1136 double mSymbolLineAngle = 0;
1137 double mSymbolAngle = 0;
1138
1139 double mHashAngle = 0;
1140 double mHashLength = 3;
1142 QgsMapUnitScale mHashLengthMapUnitScale;
1143};
1144
1145
1155{
1156 public:
1162 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1163
1169 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1170
1176 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1177
1183 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1184
1185 protected:
1189 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush, double patternThickness, double patternLength );
1190
1191 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1192 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1193
1194 private:
1195 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1196};
1197
1198
1208{
1209 public:
1213 QgsRasterLineSymbolLayer( const QString &path = QString() );
1215
1221 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1222
1227 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1228
1233 QString path() const { return mPath; }
1234
1239 void setPath( const QString &path );
1240
1246 double opacity() const { return mOpacity; }
1247
1253 void setOpacity( double opacity ) { mOpacity = opacity; }
1254
1255 QString layerType() const override;
1256 Qgis::SymbolLayerFlags flags() const override;
1257 void startRender( QgsSymbolRenderContext &context ) override;
1258 void stopRender( QgsSymbolRenderContext &context ) override;
1259 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1260 QVariantMap properties() const override;
1261 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1262 void setOutputUnit( Qgis::RenderUnit unit ) override;
1263 Qgis::RenderUnit outputUnit() const override;
1264 bool usesMapUnits() const override;
1265 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1266 QgsMapUnitScale mapUnitScale() const override;
1267 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1268 QColor color() const override;
1269
1270 protected:
1271 QString mPath;
1272 double mOpacity = 1.0;
1274};
1275
1276
1289{
1290 public:
1294 QgsLineburstSymbolLayer( const QColor &color = DEFAULT_SIMPLELINE_COLOR, const QColor &color2 = Qt::white );
1296
1302 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1303
1304 QString layerType() const override;
1305 Qgis::SymbolLayerFlags flags() const override;
1306 void startRender( QgsSymbolRenderContext &context ) override;
1307 void stopRender( QgsSymbolRenderContext &context ) override;
1308 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1309 QVariantMap properties() const override;
1310 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1311 void setOutputUnit( Qgis::RenderUnit unit ) override;
1312 Qgis::RenderUnit outputUnit() const override;
1313 bool usesMapUnits() const override;
1314 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1315 QgsMapUnitScale mapUnitScale() const override;
1316 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1317
1323 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1324
1331
1338 QgsColorRamp *colorRamp();
1339
1347 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1348
1354 QColor color2() const { return mColor2; }
1355
1361 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1362
1363 protected:
1365 QColor mColor2;
1366 std::unique_ptr< QgsColorRamp > mGradientRamp;
1367};
1368
1369
1379{
1380 public:
1390
1396 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1397
1398 QString layerType() const override;
1399 void startRender( QgsSymbolRenderContext &context ) override;
1400 void stopRender( QgsSymbolRenderContext &context ) override;
1401 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1402 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1403 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1404 QVariantMap properties() const override;
1405 QgsFilledLineSymbolLayer *clone() const override SIP_FACTORY;
1406 QgsSymbol *subSymbol() override;
1407 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1408 bool hasDataDefinedProperties() const override;
1409 void setColor( const QColor &c ) override;
1410 QColor color() const override;
1411 void setOutputUnit( Qgis::RenderUnit unit ) override;
1412 Qgis::RenderUnit outputUnit() const override;
1413 bool usesMapUnits() const override;
1414 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1415 QgsMapUnitScale mapUnitScale() const override;
1416 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1417 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1418
1424 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1425
1431 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1432
1438 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1439
1445 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1446
1447 private:
1448#ifdef SIP_RUN
1450#endif
1451
1453 std::unique_ptr< QgsFillSymbol > mFill;
1454 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
1455 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
1456};
1457
1458#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
Definition qgis.h:3243
GradientColorSource
Gradient color sources.
Definition qgis.h:3292
@ SimpleTwoColor
Simple two color gradient.
Definition qgis.h:3293
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
Definition qgis.h:913
RenderUnit
Rendering size units.
Definition qgis.h:5340
@ Millimeters
Millimeters.
Definition qgis.h:5341
QFlags< MarkerLinePlacement > MarkerLinePlacements
Definition qgis.h:3254
Base class for line symbol layer types which draws line sections using a QBrush.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
Helper class to manipulate blank segments.
Abstract base class for color ramps.
Exports QGIS layers to the DXF format.
Handles parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol layer type which fills a stroked line with a QgsFillSymbol.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
QString layerType() const override
Returns a string that represents this layer type.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsFilledLineSymbolLayer, using the settings serialized in the properties map (correspo...
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
~QgsFilledLineSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
QgsFilledLineSymbolLayer(double width=DEFAULT_SIMPLELINE_WIDTH, QgsFillSymbol *fillSymbol=nullptr)
Constructor for QgsFilledLineSymbolLayer.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setColor(const QColor &c) override
Sets the "representative" color for the symbol layer.
QColor color() const override
Returns the "representative" color of the symbol layer.
void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called after the layer has been rendered for a particular feature.
void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called before the layer will be rendered for a particular feature.
QgsFilledLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsMapUnitScale mapUnitScale() const override
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
Line symbol layer type which draws repeating line sections along a line feature.
void setHashLength(double length)
Sets the length of hash symbols.
double hashAngle() const
Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.
QgsHashedLineSymbolLayer(bool rotateSymbol=true, double interval=3)
Constructor for QgsHashedLineSymbolLayer.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
void setWidth(double width) override
Sets the width of the line symbol layer.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
double width() const override
Returns the estimated width for the line symbol layer.
void setDataDefinedProperty(QgsSymbolLayer::Property key, const QgsProperty &property) override
Sets a data defined property for the layer.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsHashedLineSymbolLayer, using the settings serialized in the properties map (correspo...
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
QgsHashedLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Qgis::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
~QgsHashedLineSymbolLayer() override
double hashLength() const
Returns the length of hash symbols.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QColor color() const override
Returns the "representative" color of the symbol layer.
void setColor(const QColor &color) override
Sets the "representative" color for the symbol layer.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setHashLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the length of hash symbols.
QString layerType() const override
Returns a string that represents this layer type.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setHashAngle(double angle)
Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.
QgsLineSymbolLayer(const QgsLineSymbolLayer &other)=delete
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)
Renders the line symbol layer along the outline of polygon, using the given render context.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context.
virtual double width() const
Returns the estimated width for the line symbol layer.
double offset() const
Returns the line's offset.
A line symbol type, for rendering LineString and MultiLineString geometries.
std::unique_ptr< QgsColorRamp > mGradientRamp
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QColor color2() const
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoC...
Qgis::GradientColorSource mGradientColorType
QString layerType() const override
Returns a string that represents this layer type.
~QgsLineburstSymbolLayer() override
QgsLineburstSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Qgis::GradientColorSource gradientColorType() const
Returns the gradient color mode, which controls how gradient color stops are created.
void setGradientColorType(Qgis::GradientColorSource gradientColorType)
Sets the gradient color mode, which controls how gradient color stops are created.
QgsMapUnitScale mapUnitScale() const override
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsLineburstSymbolLayer, using the settings serialized in the properties map (correspon...
Qgis::SymbolLayerFlags flags() const override
Returns flags which control the symbol layer's behavior.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setColor2(const QColor &color2)
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColo...
QgsLineburstSymbolLayer(const QColor &color=DEFAULT_SIMPLELINE_COLOR, const QColor &color2=Qt::white)
Constructor for QgsLineburstSymbolLayer, with the specified start and end gradient colors.
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
Struct for storing maximum and minimum scales for measurements in map units.
Q_DECL_DEPRECATED bool rotateMarker() const
Shall the marker be rotated.
std::unique_ptr< QgsMarkerSymbol > mMarker
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
QgsMarkerLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
void setDataDefinedProperty(QgsSymbolLayer::Property key, const QgsProperty &property) override
Sets a data defined property for the layer.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
void setColor(const QColor &color) override
Sets the "representative" color for the symbol layer.
double symbolAngle() const override
Returns the symbol's current angle, in degrees clockwise.
double width() const override
Returns the estimated width for the line symbol layer.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsMarkerLineSymbolLayer, using the settings serialized in the properties map (correspo...
QgsMarkerLineSymbolLayer(bool rotateMarker=DEFAULT_MARKERLINE_ROTATE, double interval=DEFAULT_MARKERLINE_INTERVAL)
Constructor for QgsMarkerLineSymbolLayer.
void setWidth(double width) override
Sets the width of the line symbol layer.
QColor color() const override
Returns the "representative" color of the symbol layer.
void setSymbolLineAngle(double angle) override
Sets the line angle modification for the symbol's angle.
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
~QgsMarkerLineSymbolLayer() override
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QString layerType() const override
Returns a string that represents this layer type.
static QgsSymbolLayer * createFromSld(QDomElement &element)
Creates a new QgsMarkerLineSymbolLayer from an SLD XML DOM element.
void setSymbolAngle(double angle) override
Sets the symbol's angle, in degrees clockwise.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
Q_DECL_DEPRECATED void setRotateMarker(bool rotate)
Shall the marker be rotated.
void renderSymbol(const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer=-1, bool selected=false) override
Renders the templated symbol at the specified point, using the given render context.
A marker symbol type, for rendering Point and MultiPoint geometries.
Resolves relative paths into absolute paths and vice versa.
A store for object properties.
Line symbol layer type which draws line sections using a raster image file.
double opacity() const
Returns the line opacity.
QString path() const
Returns the raster image path.
static void resolvePaths(QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving)
Turns relative paths in properties map to absolute when reading and vice versa when writing.
QgsRasterLineSymbolLayer(const QString &path=QString())
Constructor for QgsRasterLineSymbolLayer, with the specified raster image path.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsRasterLineSymbolLayer, using the settings serialized in the properties map (correspo...
~QgsRasterLineSymbolLayer() override
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void setOpacity(double opacity)
Set the line opacity.
Contains information about the context of a rendering operation.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setDrawInsidePolygon(bool drawInsidePolygon)
Sets whether the line should only be drawn inside polygons, and any portion of the line which falls o...
const QgsMapUnitScale & customDashPatternMapUnitScale() const
Returns the map unit scale for lengths used in the custom dash pattern.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
Qgis::SymbolLayerFlags flags() const override
Returns flags which control the symbol layer's behavior.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QgsMapUnitScale mapUnitScale() const override
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleLineSymbolLayer, using the settings serialized in the properties map (correspo...
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
const QgsMapUnitScale & trimDistanceEndMapUnitScale() const
Returns the map unit scale for the trim distance for the end of the line.
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the outline of polygon, using the given render context.
const QgsMapUnitScale & trimDistanceStartMapUnitScale() const
Returns the map unit scale for the trim distance for the start of the line.
Qt::PenStyle dxfPenStyle() const override
Gets pen style.
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for lengths used in the custom dash pattern.
void setTrimDistanceEndMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the end of the line.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
void setTrimDistanceEnd(double distance)
Sets the trim distance for the end of the line, which dictates a length from the end of the line at w...
double dxfOffset(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets offset.
QgsSimpleLineSymbolLayer(const QColor &color=DEFAULT_SIMPLELINE_COLOR, double width=DEFAULT_SIMPLELINE_WIDTH, Qt::PenStyle penStyle=DEFAULT_SIMPLELINE_PENSTYLE)
Constructor for QgsSimpleLineSymbolLayer.
double trimDistanceStart() const
Returns the trim distance for the start of the line, which dictates a length from the start of the li...
~QgsSimpleLineSymbolLayer() override
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
Qgis::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
double trimDistanceEnd() const
Returns the trim distance for the end of the line, which dictates a length from the end of the line a...
Qgis::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale for the dash pattern offset value.
bool canCauseArtifactsBetweenAdjacentTiles() const override
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
void setCustomDashVector(const QVector< qreal > &vector)
Sets the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ren...
bool useCustomDashPattern() const
Returns true if the line uses a custom dash pattern.
void setDashPatternOffset(double offset)
Sets the dash pattern offset, which dictates how far along the dash pattern the pattern should start ...
QColor dxfColor(QgsSymbolRenderContext &context) const override
Gets color.
QString layerType() const override
Returns a string that represents this layer type.
void setDashPatternOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the dash pattern offset.
QgsSimpleLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setPenStyle(Qt::PenStyle style)
Sets the pen style used to render the line (e.g.
Qt::PenStyle penStyle() const
Returns the pen style used to render the line (e.g.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
double dashPatternOffset() const
Returns the dash pattern offset, which dictates how far along the dash pattern the pattern should sta...
static QgsSymbolLayer * createFromSld(QDomElement &element)
Creates a new QgsSimpleLineSymbolLayer from an SLD XML DOM element.
double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets line width.
void setTrimDistanceStartMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the start of the line.
QVector< qreal > dxfCustomDashPattern(Qgis::RenderUnit &unit) const override
Gets dash pattern.
Qgis::RenderUnit trimDistanceStartUnit() const
Returns the unit for the trim distance for the start of the line.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
void setTrimDistanceEndUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the end of the line.
void setDashPatternOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the dash pattern offset.
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
bool drawInsidePolygon() const
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setTrimDistanceStart(double distance)
Sets the trim distance for the start of the line, which dictates a length from the start of the line ...
QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const override
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setTrimDistanceStartUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the start of the line.
Qgis::RenderUnit trimDistanceEndUnit() const
Returns the unit for the trim distance for the end of the line.
void setCustomDashPatternUnit(Qgis::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Property
Data definable properties.
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 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 QColor color() const
Returns the "representative" color of the symbol layer.
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
QgsSymbolLayer(const QgsSymbolLayer &other)
Encapsulates the context in which a symbol is being rendered.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
Base class for templated line symbols, e.g.
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.
bool placeOnEveryPart() const
Returns true if the placement applies for every part of multi-part feature geometries.
static void setCommonProperties(QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties)
Sets all common symbol properties in the destLayer, using the settings serialized in the properties m...
double averageAngleLength() const
Returns the length of line over which the line's direction is averaged when calculating individual sy...
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void setRotateSymbols(bool rotate)
Sets whether the repeating symbols should be rotated to match their line segment orientation.
void setIntervalUnit(Qgis::RenderUnit unit)
Sets the units for the interval between symbols.
void setAverageAngleUnit(Qgis::RenderUnit unit)
Sets the unit for the length over which the line's direction is averaged when calculating individual ...
const QgsMapUnitScale & averageAngleMapUnitScale() const
Returns the map unit scale for the length over which the line's direction is averaged when calculatin...
double interval() const
Returns the interval between individual symbols.
void setOffsetAlongLineUnit(Qgis::RenderUnit unit)
Sets the unit used for calculating the offset along line for symbols.
void setAverageAngleMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the length over which the line's direction is averaged when calculating i...
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
double offsetAlongLine() const
Returns the offset along the line for the symbol placement.
Qgis::MarkerLinePlacements placements() const
Returns the placement of the symbols.
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the symbol placement.
Qgis::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
QgsTemplatedLineSymbolLayerBase(bool rotateSymbol=true, double interval=3)
Constructor for QgsTemplatedLineSymbolLayerBase.
virtual void setSymbolLineAngle(double angle)=0
Sets the line angle modification for the symbol's angle.
virtual double symbolAngle() const =0
Returns the symbol's current angle, in degrees clockwise.
virtual void setSymbolAngle(double angle)=0
Sets the symbol's angle, in degrees clockwise.
void setInterval(double interval)
Sets the interval between individual symbols.
Qgis::RenderUnit intervalUnit() const
Returns the units for the interval between symbols.
Q_DECL_DEPRECATED Qgis::MarkerLinePlacement placement() const
Returns the placement of the symbols.
void setPlaceOnEveryPart(bool respect)
Sets whether the placement applies for every part of multi-part feature geometries.
void setPlacements(Qgis::MarkerLinePlacements placements)
Sets the placement of the symbols.
Qgis::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line's direction is averaged when calculating individu...
Qgis::RenderUnit blankSegmentsUnit() const
Returns the unit for for blank segments start and end distances.
void setBlankSegmentsUnit(Qgis::RenderUnit unit)
Sets the unit for blank segments start and end distances.
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols.
virtual void renderSymbol(const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer=-1, bool selected=false)=0
Renders the templated symbol at the specified point, using the given render context.
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the interval between symbols.
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for symbols.
void setAverageAngleLength(double length)
Sets the length of line over which the line's direction is averaged when calculating individual symbo...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83
#define DEFAULT_MARKERLINE_INTERVAL
#define DEFAULT_SIMPLELINE_WIDTH
#define DEFAULT_MARKERLINE_ROTATE
#define DEFAULT_SIMPLELINE_PENSTYLE
#define DEFAULT_SIMPLELINE_JOINSTYLE
#define DEFAULT_SIMPLELINE_COLOR
#define DEFAULT_SIMPLELINE_CAPSTYLE