QGIS API Documentation 3.99.0-Master (d270888f95f)
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:
48
57
59
60 // static stuff
61
67 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
68
72 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
73
74 QString layerType() const override;
75 Qgis::SymbolLayerFlags flags() const override;
76 void startRender( QgsSymbolRenderContext &context ) override;
77 void stopRender( QgsSymbolRenderContext &context ) override;
78 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
79 //overridden so that clip path can be set when using draw inside polygon option
80 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
81 QVariantMap properties() const override;
83 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
84 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
85 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
86 void setOutputUnit( Qgis::RenderUnit unit ) override;
87 Qgis::RenderUnit outputUnit() const override;
88 bool usesMapUnits() const override;
89 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
90 QgsMapUnitScale mapUnitScale() const override;
91 double estimateMaxBleed( const QgsRenderContext &context ) const override;
92 QVector<qreal> dxfCustomDashPattern( Qgis::RenderUnit &unit ) const override;
93 Qt::PenStyle dxfPenStyle() const override;
94 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
95 double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
96 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
97 bool canCauseArtifactsBetweenAdjacentTiles() const override;
98
104 Qt::PenStyle penStyle() const { return mPenStyle; }
105
111 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
112
118 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
119
125 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
126
132 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
133
139 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
140
147 bool useCustomDashPattern() const { return mUseCustomDashPattern; }
148
155 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
156
161 void setCustomDashPatternUnit( Qgis::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
162
167 Qgis::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
168
173 const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
174
179 void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
180
193 QVector<qreal> customDashVector() const { return mCustomDashVector; }
194
207 void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
208
221 double dashPatternOffset() const { return mDashPatternOffset; }
222
235 void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
236
246 void setDashPatternOffsetUnit( Qgis::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
247
257 Qgis::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
258
268 const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
269
279 void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
280
294 double trimDistanceStart() const { return mTrimDistanceStart; }
295
309 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
310
321 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
322
333 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
334
345 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
346
357 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
358
372 double trimDistanceEnd() const { return mTrimDistanceEnd; }
373
387 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
388
399 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
400
411 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
412
423 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
424
435 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
436
446 bool drawInsidePolygon() const { return mDrawInsidePolygon; }
447
457 void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
458
468 bool alignDashPattern() const;
469
479 void setAlignDashPattern( bool enabled );
480
491 bool tweakDashPatternOnCorners() const;
492
503 void setTweakDashPatternOnCorners( bool enabled );
504
505 private:
506
507 Qt::PenStyle mPenStyle = Qt::SolidLine;
508 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
509 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
510 QPen mPen;
511 QPen mSelPen;
512
513 bool mUseCustomDashPattern = false;
514 Qgis::RenderUnit mCustomDashPatternUnit = Qgis::RenderUnit::Millimeters;
515 QgsMapUnitScale mCustomDashPatternMapUnitScale;
516
517 double mDashPatternOffset = 0;
518 Qgis::RenderUnit mDashPatternOffsetUnit = Qgis::RenderUnit::Millimeters;
519 QgsMapUnitScale mDashPatternOffsetMapUnitScale;
520
521 double mTrimDistanceStart = 0;
522 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
523 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
524
525 double mTrimDistanceEnd = 0;
526 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
527 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
528
530 QVector<qreal> mCustomDashVector;
531
532 bool mAlignDashPattern = false;
533 bool mPatternCartographicTweakOnSharpCorners = false;
534
535 bool mDrawInsidePolygon = false;
536
537 //helper functions for data defined symbology
538 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
539 void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
540};
541
543
544#define DEFAULT_MARKERLINE_ROTATE true
545#define DEFAULT_MARKERLINE_INTERVAL 3
546
557{
558 public:
559
567 QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
568 double interval = 3 );
569
571
576 bool rotateSymbols() const { return mRotateSymbols; }
577
582 void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
583
589 double interval() const { return mInterval; }
590
597 void setInterval( double interval ) { mInterval = interval; }
598
605 void setIntervalUnit( Qgis::RenderUnit unit ) { mIntervalUnit = unit; }
606
612 Qgis::RenderUnit intervalUnit() const { return mIntervalUnit; }
613
620 void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
621
628 const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
629
635 Q_DECL_DEPRECATED Qgis::MarkerLinePlacement placement() const SIP_DEPRECATED;
636
642 Q_DECL_DEPRECATED void setPlacement( Qgis::MarkerLinePlacement placement ) SIP_DEPRECATED;
643
649 Qgis::MarkerLinePlacements placements() const { return mPlacements; }
650
657
672 bool placeOnEveryPart() const { return mPlaceOnEveryPart; }
673
688 void setPlaceOnEveryPart( bool respect ) { mPlaceOnEveryPart = respect; }
689
700 double offsetAlongLine() const { return mOffsetAlongLine; }
701
713 void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
714
721 Qgis::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
722
729 void setOffsetAlongLineUnit( Qgis::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
730
735 const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
736
741 void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
742
753 double averageAngleLength() const { return mAverageAngleLength; }
754
765 void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
766
775 void setAverageAngleUnit( Qgis::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
776
785 Qgis::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
786
795 void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
796
805 const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
806
807
814 void setBlankSegmentsUnit( Qgis::RenderUnit unit ) { mBlankSegmentsUnit = unit; }
815
822 Qgis::RenderUnit blankSegmentsUnit() const { return mBlankSegmentsUnit; }
823
824 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
825 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) final;
826 Qgis::RenderUnit outputUnit() const final;
827 void setOutputUnit( Qgis::RenderUnit unit ) override;
828 void setMapUnitScale( const QgsMapUnitScale &scale ) final;
829 QgsMapUnitScale mapUnitScale() const final;
830 QVariantMap properties() const override;
831 bool canCauseArtifactsBetweenAdjacentTiles() const override;
832
833 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
834 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
835
839 void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
840
841 protected:
842
849 virtual void setSymbolLineAngle( double angle ) = 0;
850
854 virtual double symbolAngle() const = 0;
855
859 virtual void setSymbolAngle( double angle ) = 0;
860
873 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
874
879 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
880
881 protected:
882 int mRingIndex = 0; // current ring index while rendering
883
884 private:
885
886 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
887 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
888 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
889
890 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
891
905 void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context,
906 Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
907
908
909 static void collectOffsetPoints( const QVector< QPointF> &points,
910 QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset,
911 QList<int> *pointIndices = nullptr,
912 double initialLag = 0,
913 int numberPointsRequired = -1 );
914
915 bool mRotateSymbols = true;
916 double mInterval = 3;
917 Qgis::RenderUnit mIntervalUnit = Qgis::RenderUnit::Millimeters;
918 QgsMapUnitScale mIntervalMapUnitScale;
919 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
920 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
921 Qgis::RenderUnit mOffsetAlongLineUnit = Qgis::RenderUnit::Millimeters; //unit for offset along line
922 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
923 double mAverageAngleLength = 4;
924 Qgis::RenderUnit mAverageAngleLengthUnit = Qgis::RenderUnit::Millimeters;
925 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
926 Qgis::RenderUnit mBlankSegmentsUnit = Qgis::RenderUnit::MapUnits;
927 bool mPlaceOnEveryPart = true;
928
929 bool mRenderingFeature = false;
930 bool mHasRenderedFirstPart = false;
931 QPointF mFinalVertex;
932 bool mCurrentFeatureIsSelected = false;
933 double mFeatureSymbolOpacity = 1;
934
936
937};
938
945{
946 public:
947
957
959
960 // static stuff
961
967 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
968
972 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
973
974 // implemented from base classes
975
976 QString layerType() const override;
977 void startRender( QgsSymbolRenderContext &context ) override;
978 void stopRender( QgsSymbolRenderContext &context ) override;
980 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
981 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
982 void setColor( const QColor &color ) override;
983 QColor color() const override;
984 QgsSymbol *subSymbol() override;
985 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
986 void setWidth( double width ) override;
987 double width() const override;
988 double width( const QgsRenderContext &context ) const override;
989 double estimateMaxBleed( const QgsRenderContext &context ) const override;
990 void setOutputUnit( Qgis::RenderUnit unit ) override;
991 bool usesMapUnits() const override;
992 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
993 bool hasDataDefinedProperties() const override;
994 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
995
1002 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
1003
1008 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
1009
1010 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1011
1012 protected:
1013
1014 std::unique_ptr< QgsMarkerSymbol > mMarker;
1015
1016 void setSymbolLineAngle( double angle ) override;
1017 double symbolAngle() const override;
1018 void setSymbolAngle( double angle ) override;
1019 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1020
1021 private:
1022
1023#ifdef SIP_RUN
1025#endif
1026
1027
1028};
1029
1030
1040{
1041 public:
1042
1050 QgsHashedLineSymbolLayer( bool rotateSymbol = true,
1051 double interval = 3 );
1052
1054
1060 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1061
1062 QString layerType() const override;
1063 void startRender( QgsSymbolRenderContext &context ) override;
1064 void stopRender( QgsSymbolRenderContext &context ) override;
1065 QVariantMap properties() const override;
1066 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1067 void setColor( const QColor &color ) override;
1068 QColor color() const override;
1069 QgsSymbol *subSymbol() override;
1070 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1071 void setWidth( double width ) override;
1072 double width() const override;
1073 double width( const QgsRenderContext &context ) const override;
1074 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1075 void setOutputUnit( Qgis::RenderUnit unit ) override;
1076 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1077 bool hasDataDefinedProperties() const override;
1078 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1079 bool usesMapUnits() const override;
1080
1086 double hashAngle() const;
1087
1093 void setHashAngle( double angle );
1094
1100 double hashLength() const { return mHashLength; }
1101
1107 void setHashLength( double length ) { mHashLength = length; }
1108
1114 void setHashLengthUnit( Qgis::RenderUnit unit ) { mHashLengthUnit = unit; }
1115
1121 Qgis::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1122
1129 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1130
1137 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1138
1139 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1140
1141 protected:
1142
1143 void setSymbolLineAngle( double angle ) override;
1144 double symbolAngle() const override;
1145 void setSymbolAngle( double angle ) override;
1146 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1147
1148 private:
1149#ifdef SIP_RUN
1151#endif
1152
1153 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1154
1155 double mSymbolLineAngle = 0;
1156 double mSymbolAngle = 0;
1157
1158 double mHashAngle = 0;
1159 double mHashLength = 3;
1161 QgsMapUnitScale mHashLengthMapUnitScale;
1162
1163};
1164
1165
1175{
1176 public:
1177
1183 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1184
1190 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1191
1197 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1198
1204 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1205
1206 protected:
1207
1211 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush,
1212 double patternThickness, double patternLength );
1213
1214 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1215 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1216
1217 private:
1218 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1219};
1220
1221
1222
1232{
1233 public:
1234
1238 QgsRasterLineSymbolLayer( const QString &path = QString() );
1240
1246 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1247
1252 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1253
1258 QString path() const { return mPath; }
1259
1264 void setPath( const QString &path );
1265
1271 double opacity() const { return mOpacity; }
1272
1278 void setOpacity( double opacity ) { mOpacity = opacity; }
1279
1280 QString layerType() const override;
1281 Qgis::SymbolLayerFlags flags() const override;
1282 void startRender( QgsSymbolRenderContext &context ) override;
1283 void stopRender( QgsSymbolRenderContext &context ) override;
1284 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1285 QVariantMap properties() const override;
1286 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1287 void setOutputUnit( Qgis::RenderUnit unit ) override;
1288 Qgis::RenderUnit outputUnit() const override;
1289 bool usesMapUnits() const override;
1290 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1291 QgsMapUnitScale mapUnitScale() const override;
1292 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1293 QColor color() const override;
1294
1295 protected:
1296 QString mPath;
1297 double mOpacity = 1.0;
1299
1300};
1301
1302
1315{
1316 public:
1317
1322 const QColor &color2 = Qt::white );
1324
1330 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1331
1332 QString layerType() const override;
1333 Qgis::SymbolLayerFlags flags() const override;
1334 void startRender( QgsSymbolRenderContext &context ) override;
1335 void stopRender( QgsSymbolRenderContext &context ) override;
1336 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1337 QVariantMap properties() const override;
1338 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1339 void setOutputUnit( Qgis::RenderUnit unit ) override;
1340 Qgis::RenderUnit outputUnit() const override;
1341 bool usesMapUnits() const override;
1342 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1343 QgsMapUnitScale mapUnitScale() const override;
1344 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1345
1351 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1352
1359
1366 QgsColorRamp *colorRamp();
1367
1375 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1376
1382 QColor color2() const { return mColor2; }
1383
1389 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1390
1391 protected:
1393 QColor mColor2;
1394 std::unique_ptr< QgsColorRamp > mGradientRamp;
1395
1396};
1397
1398
1408{
1409 public:
1410
1420
1426 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1427
1428 QString layerType() const override;
1429 void startRender( QgsSymbolRenderContext &context ) override;
1430 void stopRender( QgsSymbolRenderContext &context ) override;
1431 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1432 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1433 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1434 QVariantMap properties() const override;
1435 QgsFilledLineSymbolLayer *clone() const override SIP_FACTORY;
1436 QgsSymbol *subSymbol() override;
1437 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1438 bool hasDataDefinedProperties() const override;
1439 void setColor( const QColor &c ) override;
1440 QColor color() const override;
1441 void setOutputUnit( Qgis::RenderUnit unit ) override;
1442 Qgis::RenderUnit outputUnit() const override;
1443 bool usesMapUnits() const override;
1444 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1445 QgsMapUnitScale mapUnitScale() const override;
1446 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1447 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1448
1454 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1455
1461 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1462
1468 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1469
1475 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1476
1477 private:
1478
1479#ifdef SIP_RUN
1481#endif
1482
1484 std::unique_ptr< QgsFillSymbol > mFill;
1485 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
1486 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
1487
1488
1489};
1490
1491#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:59
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
Definition qgis.h:3188
GradientColorSource
Gradient color sources.
Definition qgis.h:3237
@ SimpleTwoColor
Simple two color gradient.
Definition qgis.h:3238
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
Definition qgis.h:906
RenderUnit
Rendering size units.
Definition qgis.h:5255
@ Millimeters
Millimeters.
Definition qgis.h:5256
QFlags< MarkerLinePlacement > MarkerLinePlacements
Definition qgis.h:3199
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:231
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:114
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:84
#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