QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
836 protected:
837
844 virtual void setSymbolLineAngle( double angle ) = 0;
845
849 virtual double symbolAngle() const = 0;
850
854 virtual void setSymbolAngle( double angle ) = 0;
855
868 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
869
874
879 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
880
881
882 private:
883
884 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
885 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
886 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
887 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
888
902 void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context,
903 Qgis::MarkerLinePlacement placement, const QList<QPair<double, double>> &blankSegments );
904
905
906 static void collectOffsetPoints( const QVector< QPointF> &points,
907 QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset,
908 QList<int> *pointIndices = nullptr,
909 double initialLag = 0,
910 int numberPointsRequired = -1 );
911
912 bool mRotateSymbols = true;
913 double mInterval = 3;
914 Qgis::RenderUnit mIntervalUnit = Qgis::RenderUnit::Millimeters;
915 QgsMapUnitScale mIntervalMapUnitScale;
916 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
917 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
918 Qgis::RenderUnit mOffsetAlongLineUnit = Qgis::RenderUnit::Millimeters; //unit for offset along line
919 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
920 double mAverageAngleLength = 4;
921 Qgis::RenderUnit mAverageAngleLengthUnit = Qgis::RenderUnit::Millimeters;
922 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
923 Qgis::RenderUnit mBlankSegmentsUnit = Qgis::RenderUnit::MapUnits;
924 bool mPlaceOnEveryPart = true;
925
926 bool mRenderingFeature = false;
927 bool mHasRenderedFirstPart = false;
928 QPointF mFinalVertex;
929 bool mCurrentFeatureIsSelected = false;
930 double mFeatureSymbolOpacity = 1;
931 int mRingIndex = 0; // current ring index while rendering
932
934
935};
936
943{
944 public:
945
955
957
958 // static stuff
959
965 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
966
970 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
971
972 // implemented from base classes
973
974 QString layerType() const override;
975 void startRender( QgsSymbolRenderContext &context ) override;
976 void stopRender( QgsSymbolRenderContext &context ) override;
978 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
979 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
980 void setColor( const QColor &color ) override;
981 QColor color() const override;
982 QgsSymbol *subSymbol() override;
983 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
984 void setWidth( double width ) override;
985 double width() const override;
986 double width( const QgsRenderContext &context ) const override;
987 double estimateMaxBleed( const QgsRenderContext &context ) const override;
988 void setOutputUnit( Qgis::RenderUnit unit ) override;
989 bool usesMapUnits() const override;
990 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
991 bool hasDataDefinedProperties() const override;
992 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
993
1000 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
1001
1006 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
1007
1008 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1009
1010 protected:
1011
1012 std::unique_ptr< QgsMarkerSymbol > mMarker;
1013
1014 void setSymbolLineAngle( double angle ) override;
1015 double symbolAngle() const override;
1016 void setSymbolAngle( double angle ) override;
1017 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1018
1019 private:
1020
1021#ifdef SIP_RUN
1023#endif
1024
1025
1026};
1027
1028
1038{
1039 public:
1040
1048 QgsHashedLineSymbolLayer( bool rotateSymbol = true,
1049 double interval = 3 );
1050
1052
1058 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1059
1060 QString layerType() const override;
1061 void startRender( QgsSymbolRenderContext &context ) override;
1062 void stopRender( QgsSymbolRenderContext &context ) override;
1063 QVariantMap properties() const override;
1064 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1065 void setColor( const QColor &color ) override;
1066 QColor color() const override;
1067 QgsSymbol *subSymbol() override;
1068 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1069 void setWidth( double width ) override;
1070 double width() const override;
1071 double width( const QgsRenderContext &context ) const override;
1072 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1073 void setOutputUnit( Qgis::RenderUnit unit ) override;
1074 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1075 bool hasDataDefinedProperties() const override;
1076 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1077 bool usesMapUnits() const override;
1078
1084 double hashAngle() const;
1085
1091 void setHashAngle( double angle );
1092
1098 double hashLength() const { return mHashLength; }
1099
1105 void setHashLength( double length ) { mHashLength = length; }
1106
1112 void setHashLengthUnit( Qgis::RenderUnit unit ) { mHashLengthUnit = unit; }
1113
1119 Qgis::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1120
1127 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1128
1135 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1136
1137 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1138
1139 protected:
1140
1141 void setSymbolLineAngle( double angle ) override;
1142 double symbolAngle() const override;
1143 void setSymbolAngle( double angle ) override;
1144 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1145
1146 private:
1147#ifdef SIP_RUN
1149#endif
1150
1151 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1152
1153 double mSymbolLineAngle = 0;
1154 double mSymbolAngle = 0;
1155
1156 double mHashAngle = 0;
1157 double mHashLength = 3;
1159 QgsMapUnitScale mHashLengthMapUnitScale;
1160
1161};
1162
1163
1173{
1174 public:
1175
1181 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1182
1188 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1189
1195 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1196
1202 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1203
1204 protected:
1205
1209 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush,
1210 double patternThickness, double patternLength );
1211
1212 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1213 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1214
1215 private:
1216 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1217};
1218
1219
1220
1230{
1231 public:
1232
1236 QgsRasterLineSymbolLayer( const QString &path = QString() );
1238
1244 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1245
1250 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1251
1256 QString path() const { return mPath; }
1257
1262 void setPath( const QString &path );
1263
1269 double opacity() const { return mOpacity; }
1270
1276 void setOpacity( double opacity ) { mOpacity = opacity; }
1277
1278 QString layerType() const override;
1279 Qgis::SymbolLayerFlags flags() const override;
1280 void startRender( QgsSymbolRenderContext &context ) override;
1281 void stopRender( QgsSymbolRenderContext &context ) override;
1282 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1283 QVariantMap properties() const override;
1284 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1285 void setOutputUnit( Qgis::RenderUnit unit ) override;
1286 Qgis::RenderUnit outputUnit() const override;
1287 bool usesMapUnits() const override;
1288 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1289 QgsMapUnitScale mapUnitScale() const override;
1290 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1291 QColor color() const override;
1292
1293 protected:
1294 QString mPath;
1295 double mOpacity = 1.0;
1297
1298};
1299
1300
1313{
1314 public:
1315
1320 const QColor &color2 = Qt::white );
1322
1328 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1329
1330 QString layerType() const override;
1331 Qgis::SymbolLayerFlags flags() const override;
1332 void startRender( QgsSymbolRenderContext &context ) override;
1333 void stopRender( QgsSymbolRenderContext &context ) override;
1334 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1335 QVariantMap properties() const override;
1336 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1337 void setOutputUnit( Qgis::RenderUnit unit ) override;
1338 Qgis::RenderUnit outputUnit() const override;
1339 bool usesMapUnits() const override;
1340 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1341 QgsMapUnitScale mapUnitScale() const override;
1342 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1343
1349 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1350
1357
1364 QgsColorRamp *colorRamp();
1365
1373 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1374
1380 QColor color2() const { return mColor2; }
1381
1387 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1388
1389 protected:
1391 QColor mColor2;
1392 std::unique_ptr< QgsColorRamp > mGradientRamp;
1393
1394};
1395
1396
1406{
1407 public:
1408
1418
1424 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1425
1426 QString layerType() const override;
1427 void startRender( QgsSymbolRenderContext &context ) override;
1428 void stopRender( QgsSymbolRenderContext &context ) override;
1429 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1430 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1431 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1432 QVariantMap properties() const override;
1433 QgsFilledLineSymbolLayer *clone() const override SIP_FACTORY;
1434 QgsSymbol *subSymbol() override;
1435 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1436 bool hasDataDefinedProperties() const override;
1437 void setColor( const QColor &c ) override;
1438 QColor color() const override;
1439 void setOutputUnit( Qgis::RenderUnit unit ) override;
1440 Qgis::RenderUnit outputUnit() const override;
1441 bool usesMapUnits() const override;
1442 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1443 QgsMapUnitScale mapUnitScale() const override;
1444 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1445 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1446
1452 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1453
1459 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1460
1466 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1467
1473 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1474
1475 private:
1476
1477#ifdef SIP_RUN
1479#endif
1480
1482 std::unique_ptr< QgsFillSymbol > mFill;
1483 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
1484 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
1485
1486
1487};
1488
1489#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
Definition qgis.h:3129
GradientColorSource
Gradient color sources.
Definition qgis.h:3178
@ SimpleTwoColor
Simple two color gradient.
Definition qgis.h:3179
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
Definition qgis.h:887
RenderUnit
Rendering size units.
Definition qgis.h:5183
@ Millimeters
Millimeters.
Definition qgis.h:5184
QFlags< MarkerLinePlacement > MarkerLinePlacements
Definition qgis.h:3140
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:58
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
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.
void copyTemplateSymbolProperties(QgsTemplatedLineSymbolLayerBase *destLayer) const
Copies all common properties of this layer to another templated symbol layer.
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