QGIS API Documentation 4.1.0-Master (ca2ac17535b)
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"
21#include "qgssymbollayer.h"
22#include "qgssymbollayerutils.h"
23
24#include <QPen>
25#include <QVector>
26
27class QgsExpression;
28class QgsMarkerSymbol;
29class QgsLineSymbol;
30class QgsPathResolver;
31class QgsColorRamp;
32class QgsFillSymbol;
33
34#define DEFAULT_SIMPLELINE_COLOR QColor( 35, 35, 35 )
35#define DEFAULT_SIMPLELINE_WIDTH Qgis::DEFAULT_LINE_WIDTH
36#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
37#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
38#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
39
46{
47 public:
54
56
57 // static stuff
58
64 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
65
69 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
70
71 QString layerType() const override;
72 Qgis::SymbolLayerFlags flags() const override;
73 void startRender( QgsSymbolRenderContext &context ) override;
74 void stopRender( QgsSymbolRenderContext &context ) override;
75 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
76 //overridden so that clip path can be set when using draw inside polygon option
77 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
78 QVariantMap properties() const override;
80 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
81 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
82 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
83 void setOutputUnit( Qgis::RenderUnit unit ) override;
84 Qgis::RenderUnit outputUnit() const override;
85 bool usesMapUnits() const override;
86 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
87 QgsMapUnitScale mapUnitScale() const override;
88 double estimateMaxBleed( const QgsRenderContext &context ) const override;
89 QVector<qreal> dxfCustomDashPattern( Qgis::RenderUnit &unit ) const override;
90 Qt::PenStyle dxfPenStyle() const override;
92 double dxfWidth( QgsSymbolRenderContext &context ) const override;
94 double dxfOffset( QgsSymbolRenderContext &context ) const override;
95 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
96 bool canCauseArtifactsBetweenAdjacentTiles() const override;
97
103 Qt::PenStyle penStyle() const { return mPenStyle; }
104
110 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
111
117 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
118
124 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
125
131 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
132
138 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
139
146 bool useCustomDashPattern() const { return mUseCustomDashPattern; }
147
154 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
155
160 void setCustomDashPatternUnit( Qgis::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
161
166 Qgis::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
167
172 const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
173
178 void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
179
192 QVector<qreal> customDashVector() const { return mCustomDashVector; }
193
206 void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
207
220 double dashPatternOffset() const { return mDashPatternOffset; }
221
234 void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
235
245 void setDashPatternOffsetUnit( Qgis::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
246
256 Qgis::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
257
267 const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
268
278 void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
279
293 double trimDistanceStart() const { return mTrimDistanceStart; }
294
308 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
309
320 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
321
332 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
333
344 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
345
356 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
357
371 double trimDistanceEnd() const { return mTrimDistanceEnd; }
372
386 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
387
398 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
399
410 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
411
422 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
423
434 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
435
445 bool drawInsidePolygon() const { return mDrawInsidePolygon; }
446
456 void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
457
467 bool alignDashPattern() const;
468
478 void setAlignDashPattern( bool enabled );
479
490 bool tweakDashPatternOnCorners() const;
491
502 void setTweakDashPatternOnCorners( bool enabled );
503
504 private:
505 Qt::PenStyle mPenStyle = Qt::SolidLine;
506 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
507 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
508 QPen mPen;
509 QPen mSelPen;
510
511 bool mUseCustomDashPattern = false;
512 Qgis::RenderUnit mCustomDashPatternUnit = Qgis::RenderUnit::Millimeters;
513 QgsMapUnitScale mCustomDashPatternMapUnitScale;
514
515 double mDashPatternOffset = 0;
516 Qgis::RenderUnit mDashPatternOffsetUnit = Qgis::RenderUnit::Millimeters;
517 QgsMapUnitScale mDashPatternOffsetMapUnitScale;
518
519 double mTrimDistanceStart = 0;
520 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
521 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
522
523 double mTrimDistanceEnd = 0;
524 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
525 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
526
528 QVector<qreal> mCustomDashVector;
529
530 bool mAlignDashPattern = false;
531 bool mPatternCartographicTweakOnSharpCorners = false;
532
533 bool mDrawInsidePolygon = false;
534
535 //helper functions for data defined symbology
536 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
537 void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
538};
539
541
542#define DEFAULT_MARKERLINE_ROTATE true
543#define DEFAULT_MARKERLINE_INTERVAL 3
544
555{
556 public:
564 QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true, double interval = 3 );
565
567
572 bool rotateSymbols() const { return mRotateSymbols; }
573
578 void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
579
585 double interval() const { return mInterval; }
586
593 void setInterval( double interval ) { mInterval = interval; }
594
601 void setIntervalUnit( Qgis::RenderUnit unit ) { mIntervalUnit = unit; }
602
608 Qgis::RenderUnit intervalUnit() const { return mIntervalUnit; }
609
616 void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
617
624 const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
625
631 Q_DECL_DEPRECATED Qgis::MarkerLinePlacement placement() const SIP_DEPRECATED;
632
638 Q_DECL_DEPRECATED void setPlacement( Qgis::MarkerLinePlacement placement ) SIP_DEPRECATED;
639
645 Qgis::MarkerLinePlacements placements() const { return mPlacements; }
646
653
668 bool placeOnEveryPart() const { return mPlaceOnEveryPart; }
669
684 void setPlaceOnEveryPart( bool respect ) { mPlaceOnEveryPart = respect; }
685
696 double offsetAlongLine() const { return mOffsetAlongLine; }
697
709 void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
710
717 Qgis::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
718
725 void setOffsetAlongLineUnit( Qgis::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
726
731 const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
732
737 void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
738
749 double averageAngleLength() const { return mAverageAngleLength; }
750
761 void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
762
771 void setAverageAngleUnit( Qgis::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
772
781 Qgis::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
782
791 void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
792
801 const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
802
803
810 void setBlankSegmentsUnit( Qgis::RenderUnit unit ) { mBlankSegmentsUnit = unit; }
811
818 Qgis::RenderUnit blankSegmentsUnit() const { return mBlankSegmentsUnit; }
819
833 double trimDistanceStart() const { return mTrimDistanceStart; }
834
848 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
849
860 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
861
872 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
873
884 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
885
896 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
897
911 double trimDistanceEnd() const { return mTrimDistanceEnd; }
912
926 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
927
938 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
939
950 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
951
962 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
963
974 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
975
976 void renderPolyline( const QPolygonF &pts, QgsSymbolRenderContext &context ) override;
977 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) final;
978 Qgis::RenderUnit outputUnit() const final;
979 void setOutputUnit( Qgis::RenderUnit unit ) override;
980 void setMapUnitScale( const QgsMapUnitScale &scale ) final;
981 QgsMapUnitScale mapUnitScale() const final;
982 QVariantMap properties() const override;
983 bool canCauseArtifactsBetweenAdjacentTiles() const override;
984
985 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
986 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
987
991 void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
992
993 protected:
1000 virtual void setSymbolLineAngle( double angle ) = 0;
1001
1005 virtual double symbolAngle() const = 0;
1006
1010 virtual void setSymbolAngle( double angle ) = 0;
1011
1024 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
1025
1030 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
1031
1032 protected:
1033 int mRingIndex = 0; // current ring index while rendering
1034
1035 private:
1036 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsSymbolLayerUtils::BlankSegments &blankSegments );
1037 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsSymbolLayerUtils::BlankSegments &blankSegments );
1038 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsSymbolLayerUtils::BlankSegments &blankSegments );
1039
1040 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
1041
1055 void renderOffsetVertexAlongLine(
1056 const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsSymbolLayerUtils::BlankSegments &blankSegments
1057 );
1058
1059
1060 static void collectOffsetPoints(
1061 const QVector< QPointF> &points, QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, QList<int> *pointIndices = nullptr, double initialLag = 0, int numberPointsRequired = -1
1062 );
1063
1064 bool mRotateSymbols = true;
1065 double mInterval = 3;
1066 Qgis::RenderUnit mIntervalUnit = Qgis::RenderUnit::Millimeters;
1067 QgsMapUnitScale mIntervalMapUnitScale;
1068 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
1069 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
1070 Qgis::RenderUnit mOffsetAlongLineUnit = Qgis::RenderUnit::Millimeters; //unit for offset along line
1071 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
1072 double mAverageAngleLength = 4;
1073 Qgis::RenderUnit mAverageAngleLengthUnit = Qgis::RenderUnit::Millimeters;
1074 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
1075 Qgis::RenderUnit mBlankSegmentsUnit = Qgis::RenderUnit::MapUnits;
1076 bool mPlaceOnEveryPart = true;
1077
1078 bool mRenderingFeature = false;
1079 bool mHasRenderedFirstPart = false;
1080 QPointF mFinalVertex;
1081 bool mCurrentFeatureIsSelected = false;
1082 double mFeatureSymbolOpacity = 1;
1083
1084 double mTrimDistanceStart = 0;
1085 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
1086 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
1087
1088 double mTrimDistanceEnd = 0;
1089 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
1090 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
1091
1092 // We need to block render extra items. When rendering a multi geometry
1093 // we have to render extra items only once
1094 bool mBlockExtraItemsRendering = false;
1095
1097};
1098
1105{
1106 public:
1115
1117
1118 // static stuff
1119
1125 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1126
1130 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1131
1132 // implemented from base classes
1133
1134 QString layerType() const override;
1135 void startRender( QgsSymbolRenderContext &context ) override;
1136 void stopRender( QgsSymbolRenderContext &context ) override;
1137 QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
1138 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
1139 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
1140 void setColor( const QColor &color ) override;
1141 QColor color() const override;
1142 QgsSymbol *subSymbol() override;
1143 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1144 void setWidth( double width ) override;
1145 double width() const override;
1146 double width( const QgsRenderContext &context ) const override;
1147 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1148 void setOutputUnit( Qgis::RenderUnit unit ) override;
1149 bool usesMapUnits() const override;
1150 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1151 bool hasDataDefinedProperties() const override;
1152 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1153
1160 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
1161
1166 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
1167
1168 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1169
1170 protected:
1171 std::unique_ptr< QgsMarkerSymbol > mMarker;
1172
1173 void setSymbolLineAngle( double angle ) override;
1174 double symbolAngle() const override;
1175 void setSymbolAngle( double angle ) override;
1176 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1177
1178 private:
1179#ifdef SIP_RUN
1181#endif
1182};
1183
1184
1194{
1195 public:
1203 QgsHashedLineSymbolLayer( bool rotateSymbol = true, double interval = 3 );
1204
1206
1212 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1213
1214 QString layerType() const override;
1215 void startRender( QgsSymbolRenderContext &context ) override;
1216 void stopRender( QgsSymbolRenderContext &context ) override;
1217 QVariantMap properties() const override;
1218 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1219 void setColor( const QColor &color ) override;
1220 QColor color() const override;
1221 QgsSymbol *subSymbol() override;
1222 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1223 void setWidth( double width ) override;
1224 double width() const override;
1225 double width( const QgsRenderContext &context ) const override;
1226 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1227 void setOutputUnit( Qgis::RenderUnit unit ) override;
1228 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1229 bool hasDataDefinedProperties() const override;
1230 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1231 bool usesMapUnits() const override;
1232
1238 double hashAngle() const;
1239
1245 void setHashAngle( double angle );
1246
1252 double hashLength() const { return mHashLength; }
1253
1259 void setHashLength( double length ) { mHashLength = length; }
1260
1266 void setHashLengthUnit( Qgis::RenderUnit unit ) { mHashLengthUnit = unit; }
1267
1273 Qgis::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1274
1281 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1282
1289 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1290
1291 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1292
1293 protected:
1294 void setSymbolLineAngle( double angle ) override;
1295 double symbolAngle() const override;
1296 void setSymbolAngle( double angle ) override;
1297 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1298
1299 private:
1300#ifdef SIP_RUN
1302#endif
1303
1304 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1305
1306 double mSymbolLineAngle = 0;
1307 double mSymbolAngle = 0;
1308
1309 double mHashAngle = 0;
1310 double mHashLength = 3;
1312 QgsMapUnitScale mHashLengthMapUnitScale;
1313};
1314
1315
1325{
1326 public:
1332 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1333
1339 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1340
1346 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1347
1353 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1354
1355 protected:
1359 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush, double patternThickness, double patternLength );
1360
1361 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1362 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1363
1364 private:
1365 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1366};
1367
1368
1378{
1379 public:
1383 QgsRasterLineSymbolLayer( const QString &path = QString() );
1385
1391 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1392
1397 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1398
1403 QString path() const { return mPath; }
1404
1409 void setPath( const QString &path );
1410
1416 double opacity() const { return mOpacity; }
1417
1423 void setOpacity( double opacity ) { mOpacity = opacity; }
1424
1425 QString layerType() const override;
1426 Qgis::SymbolLayerFlags flags() const override;
1427 void startRender( QgsSymbolRenderContext &context ) override;
1428 void stopRender( QgsSymbolRenderContext &context ) override;
1429 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1430 QVariantMap properties() const override;
1431 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1432 void setOutputUnit( Qgis::RenderUnit unit ) override;
1433 Qgis::RenderUnit outputUnit() const override;
1434 bool usesMapUnits() const override;
1435 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1436 QgsMapUnitScale mapUnitScale() const override;
1437 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1438 QColor color() const override;
1439
1440 protected:
1441 QString mPath;
1442 double mOpacity = 1.0;
1444};
1445
1446
1459{
1460 public:
1464 QgsLineburstSymbolLayer( const QColor &color = DEFAULT_SIMPLELINE_COLOR, const QColor &color2 = Qt::white );
1466
1472 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1473
1474 QString layerType() const override;
1475 Qgis::SymbolLayerFlags flags() const override;
1476 void startRender( QgsSymbolRenderContext &context ) override;
1477 void stopRender( QgsSymbolRenderContext &context ) override;
1478 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1479 QVariantMap properties() const override;
1480 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1481 void setOutputUnit( Qgis::RenderUnit unit ) override;
1482 Qgis::RenderUnit outputUnit() const override;
1483 bool usesMapUnits() const override;
1484 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1485 QgsMapUnitScale mapUnitScale() const override;
1486 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1487
1493 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1494
1501
1508 QgsColorRamp *colorRamp();
1509
1517 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1518
1524 QColor color2() const { return mColor2; }
1525
1531 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1532
1533 protected:
1535 QColor mColor2;
1536 std::unique_ptr< QgsColorRamp > mGradientRamp;
1537};
1538
1539
1549{
1550 public:
1560
1566 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1567
1568 QString layerType() const override;
1569 void startRender( QgsSymbolRenderContext &context ) override;
1570 void stopRender( QgsSymbolRenderContext &context ) override;
1571 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1572 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1573 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1574 QVariantMap properties() const override;
1575 QgsFilledLineSymbolLayer *clone() const override SIP_FACTORY;
1576 QgsSymbol *subSymbol() override;
1577 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1578 bool hasDataDefinedProperties() const override;
1579 void setColor( const QColor &c ) override;
1580 QColor color() const override;
1581 void setOutputUnit( Qgis::RenderUnit unit ) override;
1582 Qgis::RenderUnit outputUnit() const override;
1583 bool usesMapUnits() const override;
1584 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1585 QgsMapUnitScale mapUnitScale() const override;
1586 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1587 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1588
1594 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1595
1601 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1602
1608 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1609
1615 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1616
1617 private:
1618#ifdef SIP_RUN
1620#endif
1621
1623 std::unique_ptr< QgsFillSymbol > mFill;
1624 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
1625 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
1626};
1627
1628#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
Definition qgis.h:3310
GradientColorSource
Gradient color sources.
Definition qgis.h:3359
@ SimpleTwoColor
Simple two color gradient.
Definition qgis.h:3360
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
Definition qgis.h:935
RenderUnit
Rendering size units.
Definition qgis.h:5566
@ Millimeters
Millimeters.
Definition qgis.h:5567
QFlags< MarkerLinePlacement > MarkerLinePlacements
Definition qgis.h:3321
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.
Abstract base class for color ramps.
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.
double dxfWidth(QgsSymbolRenderContext &context) const override
Gets line width.
double dxfOffset(QgsSymbolRenderContext &context) const override
Gets offset.
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...
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.
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.
Contains utility functions for working with symbols and symbol layers.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Property
Data definable properties.
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
QgsSymbolLayer(const QgsSymbolLayer &other)
Encapsulates the context in which a symbol is being rendered.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
Base class for templated line symbols, e.g.
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.
void setTrimDistanceStartMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the start of the line.
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...
const QgsMapUnitScale & trimDistanceEndMapUnitScale() const
Returns the map unit scale for the trim distance for the end of the line.
const QgsMapUnitScale & trimDistanceStartMapUnitScale() const
Returns the map unit scale for the trim distance for the start of the line.
Qgis::RenderUnit trimDistanceStartUnit() const
Returns the unit for the trim distance for the start of the line.
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.
void setTrimDistanceEndMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the end of the line.
double trimDistanceStart() const
Returns the trim distance for the start of the line, which dictates a length from the start of the li...
Qgis::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
Qgis::RenderUnit trimDistanceEndUnit() const
Returns the unit for the trim distance for the end of the line.
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 setTrimDistanceStartUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the start of the line.
void setPlaceOnEveryPart(bool respect)
Sets whether the placement applies for every part of multi-part feature geometries.
double trimDistanceEnd() const
Returns the trim distance for the end of the line, which dictates a length from the end of the line a...
void setPlacements(Qgis::MarkerLinePlacements placements)
Sets the placement of the symbols.
void setTrimDistanceStart(double distance)
Sets the trim distance for the start of the line, which dictates a length from the start of the line ...
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.
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...
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols.
void setTrimDistanceEndUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the end of the line.
virtual void renderSymbol(const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer=-1, bool selected=false)=0
Renders the templated symbol at the specified point, using the given render context.
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the interval between symbols.
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for symbols.
void setAverageAngleLength(double length)
Sets the length of line over which the line's direction is averaged when calculating individual symbo...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83
#define DEFAULT_MARKERLINE_INTERVAL
#define DEFAULT_SIMPLELINE_WIDTH
#define DEFAULT_MARKERLINE_ROTATE
#define DEFAULT_SIMPLELINE_PENSTYLE
#define DEFAULT_SIMPLELINE_JOINSTYLE
#define DEFAULT_SIMPLELINE_COLOR
#define DEFAULT_SIMPLELINE_CAPSTYLE