QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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_core.h"
20#include "qgis.h"
21#include "qgssymbollayer.h"
22
23#include <QPen>
24#include <QVector>
25
26class QgsExpression;
27class QgsMarkerSymbol;
28class QgsLineSymbol;
29class QgsPathResolver;
30class QgsColorRamp;
31
32#define DEFAULT_SIMPLELINE_COLOR QColor(35,35,35)
33#define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH
34#define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
35#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
36#define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
37
44{
45 public:
46
53 double width = DEFAULT_SIMPLELINE_WIDTH,
54 Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE );
55
57
58 // static stuff
59
65 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
66
70 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
71
72 QString layerType() 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;
79 QgsSimpleLineSymbolLayer *clone() const override SIP_FACTORY;
80 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
81 QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
82 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
83 QgsUnitTypes::RenderUnit outputUnit() const override;
84 bool usesMapUnits() const override;
85 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
86 QgsMapUnitScale mapUnitScale() const override;
87 double estimateMaxBleed( const QgsRenderContext &context ) const override;
88 QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit &unit ) const override;
89 Qt::PenStyle dxfPenStyle() const override;
90 double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
91 double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
92 QColor dxfColor( QgsSymbolRenderContext &context ) const override;
93 bool canCauseArtifactsBetweenAdjacentTiles() const override;
94
100 Qt::PenStyle penStyle() const { return mPenStyle; }
101
107 void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
108
114 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
115
121 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
122
128 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
129
135 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
136
143 bool useCustomDashPattern() const { return mUseCustomDashPattern; }
144
151 void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
152
157 void setCustomDashPatternUnit( QgsUnitTypes::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
158
163 QgsUnitTypes::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
164
169 const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
170
175 void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
176
189 QVector<qreal> customDashVector() const { return mCustomDashVector; }
190
203 void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
204
217 double dashPatternOffset() const { return mDashPatternOffset; }
218
231 void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
232
242 void setDashPatternOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
243
253 QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
254
264 const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
265
275 void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
276
290 double trimDistanceStart() const { return mTrimDistanceStart; }
291
305 void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
306
317 void setTrimDistanceStartUnit( QgsUnitTypes::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
318
329 QgsUnitTypes::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
330
341 const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
342
353 void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
354
368 double trimDistanceEnd() const { return mTrimDistanceEnd; }
369
383 void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
384
395 void setTrimDistanceEndUnit( QgsUnitTypes::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
396
407 QgsUnitTypes::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
408
419 const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
420
431 void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
432
442 bool drawInsidePolygon() const { return mDrawInsidePolygon; }
443
453 void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
454
464 bool alignDashPattern() const;
465
475 void setAlignDashPattern( bool enabled );
476
487 bool tweakDashPatternOnCorners() const;
488
499 void setTweakDashPatternOnCorners( bool enabled );
500
501 private:
502
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;
511 QgsMapUnitScale mCustomDashPatternMapUnitScale;
512
513 double mDashPatternOffset = 0;
515 QgsMapUnitScale mDashPatternOffsetMapUnitScale;
516
517 double mTrimDistanceStart = 0;
519 QgsMapUnitScale mTrimDistanceStartMapUnitScale;
520
521 double mTrimDistanceEnd = 0;
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:
555
563 QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
564 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( QgsUnitTypes::RenderUnit unit ) { mIntervalUnit = unit; }
602
608 QgsUnitTypes::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
652 void setPlacements( Qgis::MarkerLinePlacements placements ) { mPlacements = placements; }
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 QgsUnitTypes::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
718
725 void setOffsetAlongLineUnit( QgsUnitTypes::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( QgsUnitTypes::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
772
781 QgsUnitTypes::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
782
791 void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
792
801 const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
802
803 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
804 void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) FINAL;
806 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
807 void setMapUnitScale( const QgsMapUnitScale &scale ) FINAL;
808 QgsMapUnitScale mapUnitScale() const FINAL;
809 QVariantMap properties() const override;
810 bool canCauseArtifactsBetweenAdjacentTiles() const override;
811
812 void startFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
813 void stopFeatureRender( const QgsFeature &feature, QgsRenderContext &context ) override;
814
815 protected:
816
823 virtual void setSymbolLineAngle( double angle ) = 0;
824
828 virtual double symbolAngle() const = 0;
829
833 virtual void setSymbolAngle( double angle ) = 0;
834
847 virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
848
852 void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
853
858 static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
859
860 private:
861
862 void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
863 void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement = Qgis::MarkerLinePlacement::Vertex );
864 void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
865 double markerAngle( const QPolygonF &points, bool isRing, int vertex );
866
879 void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context,
880 Qgis::MarkerLinePlacement placement );
881
882
883 static void collectOffsetPoints( const QVector< QPointF> &points,
884 QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, double initialLag = 0,
885 int numberPointsRequired = -1 );
886
887 bool mRotateSymbols = true;
888 double mInterval = 3;
889 QgsUnitTypes::RenderUnit mIntervalUnit = QgsUnitTypes::RenderMillimeters;
890 QgsMapUnitScale mIntervalMapUnitScale;
891 Qgis::MarkerLinePlacements mPlacements = Qgis::MarkerLinePlacement::Interval;
892 double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
893 QgsUnitTypes::RenderUnit mOffsetAlongLineUnit = QgsUnitTypes::RenderMillimeters; //unit for offset along line
894 QgsMapUnitScale mOffsetAlongLineMapUnitScale;
895 double mAverageAngleLength = 4;
896 QgsUnitTypes::RenderUnit mAverageAngleLengthUnit = QgsUnitTypes::RenderMillimeters;
897 QgsMapUnitScale mAverageAngleLengthMapUnitScale;
898 bool mPlaceOnEveryPart = true;
899
900 bool mRenderingFeature = false;
901 bool mHasRenderedFirstPart = false;
902 QPointF mFinalVertex;
903 bool mCurrentFeatureIsSelected = false;
904 double mFeatureSymbolOpacity = 1;
905
906 friend class TestQgsMarkerLineSymbol;
907
908};
909
916{
917 public:
918
927 double interval = DEFAULT_MARKERLINE_INTERVAL );
928
930
931 // static stuff
932
938 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
939
943 static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
944
945 // implemented from base classes
946
947 QString layerType() const override;
948 void startRender( QgsSymbolRenderContext &context ) override;
949 void stopRender( QgsSymbolRenderContext &context ) override;
950 QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
951 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
952 void setColor( const QColor &color ) override;
953 QColor color() const override;
954 QgsSymbol *subSymbol() override;
955 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
956 void setWidth( double width ) override;
957 double width() const override;
958 double width( const QgsRenderContext &context ) const override;
959 double estimateMaxBleed( const QgsRenderContext &context ) const override;
960 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
961 bool usesMapUnits() const override;
962 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
963 bool hasDataDefinedProperties() const override;
964 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
965
972 Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
973
978 Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
979
980 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
981
982 protected:
983
984 std::unique_ptr< QgsMarkerSymbol > mMarker;
985
986 void setSymbolLineAngle( double angle ) override;
987 double symbolAngle() const override;
988 void setSymbolAngle( double angle ) override;
989 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
990
991 private:
992
993#ifdef SIP_RUN
995#endif
996
997
998};
999
1000
1010{
1011 public:
1012
1020 QgsHashedLineSymbolLayer( bool rotateSymbol = true,
1021 double interval = 3 );
1022
1024
1030 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1031
1032 QString layerType() const override;
1033 void startRender( QgsSymbolRenderContext &context ) override;
1034 void stopRender( QgsSymbolRenderContext &context ) override;
1035 QVariantMap properties() const override;
1036 QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
1037 void setColor( const QColor &color ) override;
1038 QColor color() const override;
1039 QgsSymbol *subSymbol() override;
1040 bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
1041 void setWidth( double width ) override;
1042 double width() const override;
1043 double width( const QgsRenderContext &context ) const override;
1044 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1045 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1046 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
1047 bool hasDataDefinedProperties() const override;
1048 void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1049 bool usesMapUnits() const override;
1050
1056 double hashAngle() const;
1057
1063 void setHashAngle( double angle );
1064
1070 double hashLength() const { return mHashLength; }
1071
1077 void setHashLength( double length ) { mHashLength = length; }
1078
1084 void setHashLengthUnit( QgsUnitTypes::RenderUnit unit ) { mHashLengthUnit = unit; }
1085
1091 QgsUnitTypes::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1092
1099 void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1100
1107 const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1108
1109 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1110
1111 protected:
1112
1113 void setSymbolLineAngle( double angle ) override;
1114 double symbolAngle() const override;
1115 void setSymbolAngle( double angle ) override;
1116 void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1117
1118 private:
1119#ifdef SIP_RUN
1121#endif
1122
1123 std::unique_ptr< QgsLineSymbol > mHashSymbol;
1124
1125 double mSymbolLineAngle = 0;
1126 double mSymbolAngle = 0;
1127
1128 double mHashAngle = 0;
1129 double mHashLength = 3;
1131 QgsMapUnitScale mHashLengthMapUnitScale;
1132
1133};
1134
1135
1145{
1146 public:
1147
1153 Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1154
1160 void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1161
1167 Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
1168
1174 void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
1175
1176 protected:
1177
1181 void renderPolylineUsingBrush( const QPolygonF &points, QgsSymbolRenderContext &context, const QBrush &brush,
1182 double patternThickness, double patternLength );
1183
1184 Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
1185 Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
1186
1187 private:
1188 void renderLine( const QPolygonF &points, QgsSymbolRenderContext &context, const double lineThickness, const double patternLength, const QBrush &sourceBrush );
1189};
1190
1191
1192
1202{
1203 public:
1204
1208 QgsRasterLineSymbolLayer( const QString &path = QString() );
1210
1216 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1217
1222 static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
1223
1228 QString path() const { return mPath; }
1229
1234 void setPath( const QString &path );
1235
1241 double opacity() const { return mOpacity; }
1242
1248 void setOpacity( double opacity ) { mOpacity = opacity; }
1249
1250 QString layerType() const override;
1251 void startRender( QgsSymbolRenderContext &context ) override;
1252 void stopRender( QgsSymbolRenderContext &context ) override;
1253 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1254 QVariantMap properties() const override;
1255 QgsRasterLineSymbolLayer *clone() const override SIP_FACTORY;
1256 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1257 QgsUnitTypes::RenderUnit outputUnit() const override;
1258 bool usesMapUnits() const override;
1259 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1260 QgsMapUnitScale mapUnitScale() const override;
1261 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1262 QColor color() const override;
1263
1264 protected:
1265 QString mPath;
1266 double mOpacity = 1.0;
1267 QImage mLineImage;
1268
1269};
1270
1271
1284{
1285 public:
1286
1291 const QColor &color2 = Qt::white );
1293
1299 static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
1300
1301 QString layerType() const override;
1302 void startRender( QgsSymbolRenderContext &context ) override;
1303 void stopRender( QgsSymbolRenderContext &context ) override;
1304 void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1305 QVariantMap properties() const override;
1306 QgsLineburstSymbolLayer *clone() const override SIP_FACTORY;
1307 void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
1308 QgsUnitTypes::RenderUnit outputUnit() const override;
1309 bool usesMapUnits() const override;
1310 void setMapUnitScale( const QgsMapUnitScale &scale ) override;
1311 QgsMapUnitScale mapUnitScale() const override;
1312 double estimateMaxBleed( const QgsRenderContext &context ) const override;
1313 QColor color() const override;
1314
1320 Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
1321
1327 void setGradientColorType( Qgis::GradientColorSource gradientColorType ) { mGradientColorType = gradientColorType; }
1328
1335 QgsColorRamp *colorRamp();
1336
1344 void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
1345
1351 QColor color2() const { return mColor2; }
1352
1358 void setColor2( const QColor &color2 ) { mColor2 = color2; }
1359
1360 protected:
1362 QColor mColor2;
1363 std::unique_ptr< QgsColorRamp > mGradientRamp;
1364
1365};
1366
1367#endif
1368
1369
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:72
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
Definition: qgis.h:1581
GradientColorSource
Gradient color sources.
Definition: qgis.h:1603
@ SimpleTwoColor
Simple two color gradient.
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.
Definition: qgscolorramp.h:30
Exports QGIS layers to the DXF format.
Definition: qgsdxfexport.h:65
Class for 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:56
Line symbol layer type which draws repeating line sections along a line feature.
void setHashLength(double length)
Sets the length of hash symbols.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
QgsUnitTypes::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
void setHashLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length of hash symbols.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
~QgsHashedLineSymbolLayer() override
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.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
double offset() const
Returns the line's offset.
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:30
Line symbol layer type which draws a gradient pattern perpendicularly along a line.
std::unique_ptr< QgsColorRamp > mGradientRamp
QColor color2() const
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoC...
~QgsLineburstSymbolLayer() override
void setGradientColorType(Qgis::GradientColorSource gradientColorType)
Sets the gradient color mode, which controls how gradient color stops are created.
void setColor2(const QColor &color2)
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColo...
Struct for storing maximum and minimum scales for measurements in map units.
Line symbol layer type which draws repeating marker symbols along a line feature.
std::unique_ptr< QgsMarkerSymbol > mMarker
~QgsMarkerLineSymbolLayer() override
Q_DECL_DEPRECATED void setRotateMarker(bool rotate)
Shall the marker be rotated.
A marker symbol type, for rendering Point and MultiPoint geometries.
Resolves relative paths into absolute paths and vice versa.
A store for object properties.
Definition: qgsproperty.h:230
Line symbol layer type which draws line sections using a raster image file.
double opacity() const
Returns the line opacity.
void setOpacity(double opacity)
Set the line opacity.
virtual ~QgsRasterLineSymbolLayer()
Contains information about the context of a rendering operation.
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
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.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
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 setDashPatternOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the dash pattern offset.
QgsUnitTypes::RenderUnit trimDistanceStartUnit() const
Returns the unit for the trim distance for the start of the line.
const QgsMapUnitScale & trimDistanceStartMapUnitScale() const
Returns the map unit scale for the trim distance for the start of the line.
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for lengths used in the custom dash pattern.
QgsUnitTypes::RenderUnit customDashPatternUnit() const
Returns the units 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.
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...
void setCustomDashPatternUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
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.
double trimDistanceEnd() const
Returns the trim distance for the end of the line, which dictates a length from the end of the line a...
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale for the dash pattern offset value.
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.
QgsUnitTypes::RenderUnit trimDistanceEndUnit() const
Returns the unit for the trim distance for the end of the line.
void setDashPatternOffset(double offset)
Sets the dash pattern offset, which dictates how far along the dash pattern the pattern should start ...
void setDashPatternOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the dash pattern offset.
void setPenStyle(Qt::PenStyle style)
Sets 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...
void setTrimDistanceStartUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the trim distance for the start of the line.
void setTrimDistanceStartMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the start of the line.
void setTrimDistanceEndUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the trim distance for the end of the line.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
bool drawInsidePolygon() const
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
void setTrimDistanceStart(double distance)
Sets the trim distance for the start of the line, which dictates a length from the start of the line ...
Property
Data definable properties.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
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.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:93
Base class for templated line symbols, e.g.
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.
bool placeOnEveryPart() const
Returns true if the placement applies for every part of multi-part feature geometries.
double averageAngleLength() const
Returns the length of line over which the line's direction is averaged when calculating individual sy...
void setRotateSymbols(bool rotate)
Sets whether the repeating symbols should be rotated to match their line segment orientation.
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 setAverageAngleMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the length over which the line's direction is averaged when calculating i...
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
double offsetAlongLine() const
Returns the offset along the line for the symbol placement.
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the symbol placement.
void setOffsetAlongLineUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit used for calculating the offset along line for symbols.
void setInterval(double interval)
Sets the interval between individual symbols.
QgsUnitTypes::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line's direction is averaged when calculating individu...
void setPlaceOnEveryPart(bool respect)
Sets whether the placement applies for every part of multi-part feature geometries.
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
void setPlacements(Qgis::MarkerLinePlacements placements)
Sets the placement of the symbols.
QgsUnitTypes::RenderUnit intervalUnit() const
Returns the units for the interval between symbols.
void setAverageAngleUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length over which the line's direction is averaged when calculating individual ...
void setIntervalUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the interval between symbols.
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols.
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...
Helper functions for various unit types.
Definition: qgsunittypes.h:39
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:168
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:169
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define FINAL
Definition: qgis_sip.h:237
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#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