QGIS API Documentation 4.1.0-Master (467af3bbe65)
Loading...
Searching...
No Matches
qgslinesymbollayer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslinesymbollayer.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSLINESYMBOLLAYER_H
17#define QGSLINESYMBOLLAYER_H
18
19#include "qgis.h"
20#include "qgis_core.h"
22#include "qgssymbollayer.h"
23
24#include <QPen>
25#include <QVector>
26
27class QgsExpression;
28class QgsMarkerSymbol;
29class QgsLineSymbol;
30class QgsPathResolver;
31class QgsColorRamp;
32class QgsFillSymbol;
33
34#define DEFAULT_SIMPLELINE_COLOR QColor( 35, 35, 35 )
35#define DEFAULT_SIMPLELINE_WIDTH Qgis::DEFAULT_LINE_WIDTH
36#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
37#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
38#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
39
46{
47 public:
54
56
57 // static stuff
58
64 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
65
69 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
70
71 QString layerType() const override;
72 Qgis::SymbolLayerFlags flags() const override;
73 void startRender( QgsSymbolRenderContext &context ) override;
74 void stopRender( QgsSymbolRenderContext &context ) override;
75 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
76 //overridden so that clip path can be set when using draw inside polygon option
77 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
78 QVariantMap properties() const override;
80 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
81 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
82 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
83 void setOutputUnit( Qgis::RenderUnit unit ) override;
84 Qgis::RenderUnit outputUnit() const override;
85 bool usesMapUnits() const override;
86 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
87 QgsMapUnitScale mapUnitScale() const override;
88 double estimateMaxBleed( const QgsRenderContext &context ) const override;
89 QVector<qreal> dxfCustomDashPattern( Qgis::RenderUnit &unit ) const override;
90 Qt::PenStyle dxfPenStyle() const override;
91 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
92 double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
93 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
94 bool canCauseArtifactsBetweenAdjacentTiles() const override;
95
101 Qt::PenStyle penStyle() const { return mPenStyle; }
102
108 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
109
115 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
116
122 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
123
129 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
130
136 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
137
144 bool useCustomDashPattern() const { return mUseCustomDashPattern; }
145
152 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
153
158 void setCustomDashPatternUnit( Qgis::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
159
164 Qgis::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
165
170 const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
171
176 void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
177
190 QVector<qreal> customDashVector() const { return mCustomDashVector; }
191
204 void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
205
218 double dashPatternOffset() const { return mDashPatternOffset; }
219
232 void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
233
243 void setDashPatternOffsetUnit( Qgis::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
244
254 Qgis::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
255
265 const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
266
276 void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
277
291 double trimDistanceStart() const { return mTrimDistanceStart; }
292
306 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
307
318 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
319
330 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
331
342 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
343
354 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
355
369 double trimDistanceEnd() const { return mTrimDistanceEnd; }
370
384 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
385
396 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
397
408 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
409
420 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
421
432 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
433
443 bool drawInsidePolygon() const { return mDrawInsidePolygon; }
444
454 void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
455
465 bool alignDashPattern() const;
466
476 void setAlignDashPattern( bool enabled );
477
488 bool tweakDashPatternOnCorners() const;
489
500 void setTweakDashPatternOnCorners( bool enabled );
501
502 private:
503 Qt::PenStyle mPenStyle = Qt::SolidLine;
504 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
505 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
506 QPen mPen;
507 QPen mSelPen;
508
509 bool mUseCustomDashPattern = false;
510 Qgis::RenderUnit mCustomDashPatternUnit = Qgis::RenderUnit::Millimeters;
511 QgsMapUnitScale mCustomDashPatternMapUnitScale;
512
513 double mDashPatternOffset = 0;
514 Qgis::RenderUnit mDashPatternOffsetUnit = Qgis::RenderUnit::Millimeters;
515 QgsMapUnitScale mDashPatternOffsetMapUnitScale;
516
517 double mTrimDistanceStart = 0;
518 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
519 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
520
521 double mTrimDistanceEnd = 0;
522 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
523 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
524
526 QVector<qreal> mCustomDashVector;
527
528 bool mAlignDashPattern = false;
529 bool mPatternCartographicTweakOnSharpCorners = false;
530
531 bool mDrawInsidePolygon = false;
532
533 //helper functions for data defined symbology
534 void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
535 void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
536};
537
539
540#define DEFAULT_MARKERLINE_ROTATE true
541#define DEFAULT_MARKERLINE_INTERVAL 3
542
553{
554 public:
562 QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true, double interval = 3 );
563
565
570 bool rotateSymbols() const { return mRotateSymbols; }
571
576 void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
577
583 double interval() const { return mInterval; }
584
591 void setInterval( double interval ) { mInterval = interval; }
592
599 void setIntervalUnit( Qgis::RenderUnit unit ) { mIntervalUnit = unit; }
600
606 Qgis::RenderUnit intervalUnit() const { return mIntervalUnit; }
607
614 void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
615
622 const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
623
629 Q_DECL_DEPRECATED Qgis::MarkerLinePlacement placement() const SIP_DEPRECATED;
630
636 Q_DECL_DEPRECATED void setPlacement( Qgis::MarkerLinePlacement placement ) SIP_DEPRECATED;
637
643 Qgis::MarkerLinePlacements placements() const { return mPlacements; }
644
651
666 bool placeOnEveryPart() const { return mPlaceOnEveryPart; }
667
682 void setPlaceOnEveryPart( bool respect ) { mPlaceOnEveryPart = respect; }
683
694 double offsetAlongLine() const { return mOffsetAlongLine; }
695
707 void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
708
715 Qgis::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
716
723 void setOffsetAlongLineUnit( Qgis::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
724
729 const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
730
735 void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
736
747 double averageAngleLength() const { return mAverageAngleLength; }
748
759 void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
760
769 void setAverageAngleUnit( Qgis::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
770
779 Qgis::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
780
789 void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
790
799 const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
800
801
808 void setBlankSegmentsUnit( Qgis::RenderUnit unit ) { mBlankSegmentsUnit = unit; }
809
816 Qgis::RenderUnit blankSegmentsUnit() const { return mBlankSegmentsUnit; }
817
831 double trimDistanceStart() const { return mTrimDistanceStart; }
832
846 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
847
858 void setTrimDistanceStartUnit( Qgis::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
859
870 Qgis::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
871
882 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
883
894 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
895
909 double trimDistanceEnd() const { return mTrimDistanceEnd; }
910
924 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
925
936 void setTrimDistanceEndUnit( Qgis::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
937
948 Qgis::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
949
960 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
961
972 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
973
974 void renderPolyline( const QPolygonF &pts, QgsSymbolRenderContext &context ) override;
975 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) final;
976 Qgis::RenderUnit outputUnit() const final;
977 void setOutputUnit( Qgis::RenderUnit unit ) override;
978 void setMapUnitScale( const QgsMapUnitScale &scale ) final;
979 QgsMapUnitScale mapUnitScale() const final;
980 QVariantMap properties() const override;
981 bool canCauseArtifactsBetweenAdjacentTiles() const override;
982
983 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
984 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
985
989 void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
990
991 protected:
998 virtual void setSymbolLineAngle( double angle ) = 0;
999
1003 virtual double symbolAngle() const = 0;
1004
1008 virtual void setSymbolAngle( double angle ) = 0;
1009
1022 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
1023
1028 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
1029
1030 protected:
1031 int mRingIndex = 0; // current ring index while rendering
1032
1033 private:
1034 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
1035 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
1036 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver, const QgsBlankSegmentUtils::BlankSegments &blankSegments );
1037
1038 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
1039
1053 void renderOffsetVertexAlongLine(
1054 const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement, const QgsBlankSegmentUtils::BlankSegments &blankSegments
1055 );
1056
1057
1058 static void collectOffsetPoints(
1059 const QVector< QPointF> &points, QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, QList<int> *pointIndices = nullptr, double initialLag = 0, int numberPointsRequired = -1
1060 );
1061
1062 bool mRotateSymbols = true;
1063 double mInterval = 3;
1064 Qgis::RenderUnit mIntervalUnit = Qgis::RenderUnit::Millimeters;
1065 QgsMapUnitScale mIntervalMapUnitScale;
1066 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
1067 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
1068 Qgis::RenderUnit mOffsetAlongLineUnit = Qgis::RenderUnit::Millimeters; //unit for offset along line
1069 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
1070 double mAverageAngleLength = 4;
1071 Qgis::RenderUnit mAverageAngleLengthUnit = Qgis::RenderUnit::Millimeters;
1072 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
1073 Qgis::RenderUnit mBlankSegmentsUnit = Qgis::RenderUnit::MapUnits;
1074 bool mPlaceOnEveryPart = true;
1075
1076 bool mRenderingFeature = false;
1077 bool mHasRenderedFirstPart = false;
1078 QPointF mFinalVertex;
1079 bool mCurrentFeatureIsSelected = false;
1080 double mFeatureSymbolOpacity = 1;
1081
1082 double mTrimDistanceStart = 0;
1083 Qgis::RenderUnit mTrimDistanceStartUnit = Qgis::RenderUnit::Millimeters;
1084 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
1085
1086 double mTrimDistanceEnd = 0;
1087 Qgis::RenderUnit mTrimDistanceEndUnit = Qgis::RenderUnit::Millimeters;
1088 QgsMapUnitScale mTrimDistanceEndMapUnitScale;
1089
1091};
1092
1099{
1100 public:
1109
1111
1112 // static stuff
1113
1119 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1120
1124 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
1125
1126 // implemented from base classes
1127
1128 QString layerType() const override;
1129 void startRender( QgsSymbolRenderContext &context ) override;
1130 void stopRender( QgsSymbolRenderContext &context ) override;
1131 QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
1132 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override SIP_DEPRECATED;
1133 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
1134 void setColor( const QColor &color ) override;
1135 QColor color() const override;
1136 QgsSymbol *subSymbol() override;
1137 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1138 void setWidth( double width ) override;
1139 double width() const override;
1140 double width( const QgsRenderContext &context ) const override;
1141 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1142 void setOutputUnit( Qgis::RenderUnit unit ) override;
1143 bool usesMapUnits() const override;
1144 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1145 bool hasDataDefinedProperties() const override;
1146 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1147
1154 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
1155
1160 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
1161
1162 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1163
1164 protected:
1165 std::unique_ptr< QgsMarkerSymbol > mMarker;
1166
1167 void setSymbolLineAngle( double angle ) override;
1168 double symbolAngle() const override;
1169 void setSymbolAngle( double angle ) override;
1170 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1171
1172 private:
1173#ifdef SIP_RUN
1175#endif
1176};
1177
1178
1188{
1189 public:
1197 QgsHashedLineSymbolLayer( bool rotateSymbol = true, double interval = 3 );
1198
1200
1206 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1207
1208 QString layerType() const override;
1209 void startRender( QgsSymbolRenderContext &context ) override;
1210 void stopRender( QgsSymbolRenderContext &context ) override;
1211 QVariantMap properties() const override;
1212 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1213 void setColor( const QColor &color ) override;
1214 QColor color() const override;
1215 QgsSymbol *subSymbol() override;
1216 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1217 void setWidth( double width ) override;
1218 double width() const override;
1219 double width( const QgsRenderContext &context ) const override;
1220 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1221 void setOutputUnit( Qgis::RenderUnit unit ) override;
1222 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1223 bool hasDataDefinedProperties() const override;
1224 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1225 bool usesMapUnits() const override;
1226
1232 double hashAngle() const;
1233
1239 void setHashAngle( double angle );
1240
1246 double hashLength() const { return mHashLength; }
1247
1253 void setHashLength( double length ) { mHashLength = length; }
1254
1260 void setHashLengthUnit( Qgis::RenderUnit unit ) { mHashLengthUnit = unit; }
1261
1267 Qgis::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1268
1275 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1276
1283 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1284
1285 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1286
1287 protected:
1288 void setSymbolLineAngle( double angle ) override;
1289 double symbolAngle() const override;
1290 void setSymbolAngle( double angle ) override;
1291 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1292
1293 private:
1294#ifdef SIP_RUN
1296#endif
1297
1298 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1299
1300 double mSymbolLineAngle = 0;
1301 double mSymbolAngle = 0;
1302
1303 double mHashAngle = 0;
1304 double mHashLength = 3;
1306 QgsMapUnitScale mHashLengthMapUnitScale;
1307};
1308
1309
1319{
1320 public:
1326 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1327
1333 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1334
1340 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1341
1347 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1348
1349 protected:
1353 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush, double patternThickness, double patternLength );
1354
1355 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1356 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1357
1358 private:
1359 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1360};
1361
1362
1372{
1373 public:
1377 QgsRasterLineSymbolLayer( const QString &path = QString() );
1379
1385 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1386
1391 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1392
1397 QString path() const { return mPath; }
1398
1403 void setPath( const QString &path );
1404
1410 double opacity() const { return mOpacity; }
1411
1417 void setOpacity( double opacity ) { mOpacity = opacity; }
1418
1419 QString layerType() const override;
1420 Qgis::SymbolLayerFlags flags() const override;
1421 void startRender( QgsSymbolRenderContext &context ) override;
1422 void stopRender( QgsSymbolRenderContext &context ) override;
1423 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1424 QVariantMap properties() const override;
1425 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1426 void setOutputUnit( Qgis::RenderUnit unit ) override;
1427 Qgis::RenderUnit outputUnit() const override;
1428 bool usesMapUnits() const override;
1429 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1430 QgsMapUnitScale mapUnitScale() const override;
1431 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1432 QColor color() const override;
1433
1434 protected:
1435 QString mPath;
1436 double mOpacity = 1.0;
1438};
1439
1440
1453{
1454 public:
1458 QgsLineburstSymbolLayer( const QColor &color = DEFAULT_SIMPLELINE_COLOR, const QColor &color2 = Qt::white );
1460
1466 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1467
1468 QString layerType() const override;
1469 Qgis::SymbolLayerFlags flags() const override;
1470 void startRender( QgsSymbolRenderContext &context ) override;
1471 void stopRender( QgsSymbolRenderContext &context ) override;
1472 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1473 QVariantMap properties() const override;
1474 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1475 void setOutputUnit( Qgis::RenderUnit unit ) override;
1476 Qgis::RenderUnit outputUnit() const override;
1477 bool usesMapUnits() const override;
1478 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1479 QgsMapUnitScale mapUnitScale() const override;
1480 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1481
1487 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1488
1495
1502 QgsColorRamp *colorRamp();
1503
1511 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1512
1518 QColor color2() const { return mColor2; }
1519
1525 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1526
1527 protected:
1529 QColor mColor2;
1530 std::unique_ptr< QgsColorRamp > mGradientRamp;
1531};
1532
1533
1543{
1544 public:
1554
1560 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1561
1562 QString layerType() const override;
1563 void startRender( QgsSymbolRenderContext &context ) override;
1564 void stopRender( QgsSymbolRenderContext &context ) override;
1565 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1566 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
1567 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1568 QVariantMap properties() const override;
1569 QgsFilledLineSymbolLayer *clone() const override SIP_FACTORY;
1570 QgsSymbol *subSymbol() override;
1571 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1572 bool hasDataDefinedProperties() const override;
1573 void setColor( const QColor &c ) override;
1574 QColor color() const override;
1575 void setOutputUnit( Qgis::RenderUnit unit ) override;
1576 Qgis::RenderUnit outputUnit() const override;
1577 bool usesMapUnits() const override;
1578 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1579 QgsMapUnitScale mapUnitScale() const override;
1580 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1581 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1582
1588 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1589
1595 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1596
1602 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1603
1609 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1610
1611 private:
1612#ifdef SIP_RUN
1614#endif
1615
1617 std::unique_ptr< QgsFillSymbol > mFill;
1618 Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
1619 Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
1620};
1621
1622#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:3295
GradientColorSource
Gradient color sources.
Definition qgis.h:3344
@ SimpleTwoColor
Simple two color gradient.
Definition qgis.h:3345
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
Definition qgis.h:934
RenderUnit
Rendering size units.
Definition qgis.h:5439
@ Millimeters
Millimeters.
Definition qgis.h:5440
QFlags< MarkerLinePlacement > MarkerLinePlacements
Definition qgis.h:3306
Base class for line symbol layer types which draws line sections using a QBrush.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
Helper class to manipulate blank segments.
Abstract base class for color ramps.
Exports QGIS layers to the DXF format.
Handles parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol layer type which fills a stroked line with a QgsFillSymbol.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
QString layerType() const override
Returns a string that represents this layer type.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsFilledLineSymbolLayer, using the settings serialized in the properties map (correspo...
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
~QgsFilledLineSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
QgsFilledLineSymbolLayer(double width=DEFAULT_SIMPLELINE_WIDTH, QgsFillSymbol *fillSymbol=nullptr)
Constructor for QgsFilledLineSymbolLayer.
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setColor(const QColor &c) override
Sets the "representative" color for the symbol layer.
QColor color() const override
Returns the "representative" color of the symbol layer.
void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called after the layer has been rendered for a particular feature.
void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called before the layer will be rendered for a particular feature.
QgsFilledLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsMapUnitScale mapUnitScale() const override
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
Line symbol layer type which draws repeating line sections along a line feature.
void setHashLength(double length)
Sets the length of hash symbols.
double hashAngle() const
Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.
QgsHashedLineSymbolLayer(bool rotateSymbol=true, double interval=3)
Constructor for QgsHashedLineSymbolLayer.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
void setWidth(double width) override
Sets the width of the line symbol layer.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
double width() const override
Returns the estimated width for the line symbol layer.
void setDataDefinedProperty(QgsSymbolLayer::Property key, const QgsProperty &property) override
Sets a data defined property for the layer.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsHashedLineSymbolLayer, using the settings serialized in the properties map (correspo...
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
QgsHashedLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
Qgis::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
~QgsHashedLineSymbolLayer() override
double hashLength() const
Returns the length of hash symbols.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QColor color() const override
Returns the "representative" color of the symbol layer.
void setColor(const QColor &color) override
Sets the "representative" color for the symbol layer.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setHashLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the length of hash symbols.
QString layerType() const override
Returns a string that represents this layer type.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setHashAngle(double angle)
Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.
QgsLineSymbolLayer(const QgsLineSymbolLayer &other)=delete
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)
Renders the line symbol layer along the outline of polygon, using the given render context.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context.
virtual double width() const
Returns the estimated width for the line symbol layer.
double offset() const
Returns the line's offset.
A line symbol type, for rendering LineString and MultiLineString geometries.
std::unique_ptr< QgsColorRamp > mGradientRamp
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QColor color2() const
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoC...
Qgis::GradientColorSource mGradientColorType
QString layerType() const override
Returns a string that represents this layer type.
~QgsLineburstSymbolLayer() override
QgsLineburstSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Qgis::GradientColorSource gradientColorType() const
Returns the gradient color mode, which controls how gradient color stops are created.
void setGradientColorType(Qgis::GradientColorSource gradientColorType)
Sets the gradient color mode, which controls how gradient color stops are created.
QgsMapUnitScale mapUnitScale() const override
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsLineburstSymbolLayer, using the settings serialized in the properties map (correspon...
Qgis::SymbolLayerFlags flags() const override
Returns flags which control the symbol layer's behavior.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setColor2(const QColor &color2)
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColo...
QgsLineburstSymbolLayer(const QColor &color=DEFAULT_SIMPLELINE_COLOR, const QColor &color2=Qt::white)
Constructor for QgsLineburstSymbolLayer, with the specified start and end gradient colors.
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
Struct for storing maximum and minimum scales for measurements in map units.
Q_DECL_DEPRECATED bool rotateMarker() const
Shall the marker be rotated.
std::unique_ptr< QgsMarkerSymbol > mMarker
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
QgsMarkerLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
void setDataDefinedProperty(QgsSymbolLayer::Property key, const QgsProperty &property) override
Sets a data defined property for the layer.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
void setColor(const QColor &color) override
Sets the "representative" color for the symbol layer.
double symbolAngle() const override
Returns the symbol's current angle, in degrees clockwise.
double width() const override
Returns the estimated width for the line symbol layer.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsMarkerLineSymbolLayer, using the settings serialized in the properties map (correspo...
QgsMarkerLineSymbolLayer(bool rotateMarker=DEFAULT_MARKERLINE_ROTATE, double interval=DEFAULT_MARKERLINE_INTERVAL)
Constructor for QgsMarkerLineSymbolLayer.
void setWidth(double width) override
Sets the width of the line symbol layer.
QColor color() const override
Returns the "representative" color of the symbol layer.
void setSymbolLineAngle(double angle) override
Sets the line angle modification for the symbol's angle.
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
~QgsMarkerLineSymbolLayer() override
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QString layerType() const override
Returns a string that represents this layer type.
static QgsSymbolLayer * createFromSld(QDomElement &element)
Creates a new QgsMarkerLineSymbolLayer from an SLD XML DOM element.
void setSymbolAngle(double angle) override
Sets the symbol's angle, in degrees clockwise.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
Q_DECL_DEPRECATED void setRotateMarker(bool rotate)
Shall the marker be rotated.
void renderSymbol(const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer=-1, bool selected=false) override
Renders the templated symbol at the specified point, using the given render context.
A marker symbol type, for rendering Point and MultiPoint geometries.
Resolves relative paths into absolute paths and vice versa.
A store for object properties.
Line symbol layer type which draws line sections using a raster image file.
double opacity() const
Returns the line opacity.
QString path() const
Returns the raster image path.
static void resolvePaths(QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving)
Turns relative paths in properties map to absolute when reading and vice versa when writing.
QgsRasterLineSymbolLayer(const QString &path=QString())
Constructor for QgsRasterLineSymbolLayer, with the specified raster image path.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsRasterLineSymbolLayer, using the settings serialized in the properties map (correspo...
~QgsRasterLineSymbolLayer() override
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void setOpacity(double opacity)
Set the line opacity.
Contains information about the context of a rendering operation.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setDrawInsidePolygon(bool drawInsidePolygon)
Sets whether the line should only be drawn inside polygons, and any portion of the line which falls o...
const QgsMapUnitScale & customDashPatternMapUnitScale() const
Returns the map unit scale for lengths used in the custom dash pattern.
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
Qgis::SymbolLayerFlags flags() const override
Returns flags which control the symbol layer's behavior.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
QgsMapUnitScale mapUnitScale() const override
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleLineSymbolLayer, using the settings serialized in the properties map (correspo...
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
const QgsMapUnitScale & trimDistanceEndMapUnitScale() const
Returns the map unit scale for the trim distance for the end of the line.
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the outline of polygon, using the given render context.
const QgsMapUnitScale & trimDistanceStartMapUnitScale() const
Returns the map unit scale for the trim distance for the start of the line.
Qt::PenStyle dxfPenStyle() const override
Gets pen style.
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for lengths used in the custom dash pattern.
void setTrimDistanceEndMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the end of the line.
double estimateMaxBleed(const QgsRenderContext &context) const override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
void setTrimDistanceEnd(double distance)
Sets the trim distance for the end of the line, which dictates a length from the end of the line at w...
double dxfOffset(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets offset.
QgsSimpleLineSymbolLayer(const QColor &color=DEFAULT_SIMPLELINE_COLOR, double width=DEFAULT_SIMPLELINE_WIDTH, Qt::PenStyle penStyle=DEFAULT_SIMPLELINE_PENSTYLE)
Constructor for QgsSimpleLineSymbolLayer.
double trimDistanceStart() const
Returns the trim distance for the start of the line, which dictates a length from the start of the li...
~QgsSimpleLineSymbolLayer() override
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
Qgis::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
double trimDistanceEnd() const
Returns the trim distance for the end of the line, which dictates a length from the end of the line a...
Qgis::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale for the dash pattern offset value.
bool canCauseArtifactsBetweenAdjacentTiles() const override
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
void setCustomDashVector(const QVector< qreal > &vector)
Sets the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ren...
bool useCustomDashPattern() const
Returns true if the line uses a custom dash pattern.
void setDashPatternOffset(double offset)
Sets the dash pattern offset, which dictates how far along the dash pattern the pattern should start ...
QColor dxfColor(QgsSymbolRenderContext &context) const override
Gets color.
QString layerType() const override
Returns a string that represents this layer type.
void setDashPatternOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the dash pattern offset.
QgsSimpleLineSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setPenStyle(Qt::PenStyle style)
Sets the pen style used to render the line (e.g.
Qt::PenStyle penStyle() const
Returns the pen style used to render the line (e.g.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
double dashPatternOffset() const
Returns the dash pattern offset, which dictates how far along the dash pattern the pattern should sta...
static QgsSymbolLayer * createFromSld(QDomElement &element)
Creates a new QgsSimpleLineSymbolLayer from an SLD XML DOM element.
double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets line width.
void setTrimDistanceStartMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the start of the line.
QVector< qreal > dxfCustomDashPattern(Qgis::RenderUnit &unit) const override
Gets dash pattern.
Qgis::RenderUnit trimDistanceStartUnit() const
Returns the unit for the trim distance for the start of the line.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
void setTrimDistanceEndUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the end of the line.
void setDashPatternOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the dash pattern offset.
void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context) override
Renders the line symbol layer along the line joining points, using the given render context.
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
bool drawInsidePolygon() const
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setTrimDistanceStart(double distance)
Sets the trim distance for the start of the line, which dictates a length from the start of the line ...
QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const override
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setTrimDistanceStartUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the start of the line.
Qgis::RenderUnit trimDistanceEndUnit() const
Returns the unit for the trim distance for the end of the line.
void setCustomDashPatternUnit(Qgis::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Property
Data definable properties.
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
QgsSymbolLayer(const QgsSymbolLayer &other)
Encapsulates the context in which a symbol is being rendered.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:227
Base class for templated line symbols, e.g.
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.
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