QGIS API Documentation  3.21.0-Master (5b68dc587e)
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 
26 class QgsExpression;
27 class QgsMarkerSymbol;
28 class QgsLineSymbol;
29 
30 #define DEFAULT_SIMPLELINE_COLOR QColor(35,35,35)
31 #define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH
32 #define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
33 #define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
34 #define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
35 
41 class CORE_EXPORT QgsSimpleLineSymbolLayer : public QgsLineSymbolLayer
42 {
43  public:
44 
51  double width = DEFAULT_SIMPLELINE_WIDTH,
52  Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE );
53 
55 
56  // static stuff
57 
63  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
64 
68  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
69 
70  QString layerType() const override;
71  void startRender( QgsSymbolRenderContext &context ) override;
72  void stopRender( QgsSymbolRenderContext &context ) override;
73  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
74  //overridden so that clip path can be set when using draw inside polygon option
75  void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
76  QVariantMap properties() const override;
77  QgsSimpleLineSymbolLayer *clone() const override SIP_FACTORY;
78  void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
79  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
80  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
81  QgsUnitTypes::RenderUnit outputUnit() const override;
82  bool usesMapUnits() const override;
83  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
84  QgsMapUnitScale mapUnitScale() const override;
85  double estimateMaxBleed( const QgsRenderContext &context ) const override;
86  QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit &unit ) const override;
87  Qt::PenStyle dxfPenStyle() const override;
88  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
89  double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
90  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
91  bool canCauseArtifactsBetweenAdjacentTiles() const override;
92 
98  Qt::PenStyle penStyle() const { return mPenStyle; }
99 
105  void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
106 
112  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
113 
119  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
120 
126  Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
127 
133  void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
134 
141  bool useCustomDashPattern() const { return mUseCustomDashPattern; }
142 
149  void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
150 
155  void setCustomDashPatternUnit( QgsUnitTypes::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
156 
161  QgsUnitTypes::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
162 
167  const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
168 
173  void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
174 
187  QVector<qreal> customDashVector() const { return mCustomDashVector; }
188 
201  void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
202 
215  double dashPatternOffset() const { return mDashPatternOffset; }
216 
229  void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
230 
240  void setDashPatternOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
241 
251  QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
252 
262  const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
263 
273  void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
274 
288  double trimDistanceStart() const { return mTrimDistanceStart; }
289 
303  void setTrimDistanceStart( double distance ) { mTrimDistanceStart = distance; }
304 
315  void setTrimDistanceStartUnit( QgsUnitTypes::RenderUnit unit ) { mTrimDistanceStartUnit = unit; }
316 
327  QgsUnitTypes::RenderUnit trimDistanceStartUnit() const { return mTrimDistanceStartUnit; }
328 
339  const QgsMapUnitScale &trimDistanceStartMapUnitScale() const { return mTrimDistanceStartMapUnitScale; }
340 
351  void setTrimDistanceStartMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceStartMapUnitScale = scale; }
352 
366  double trimDistanceEnd() const { return mTrimDistanceEnd; }
367 
381  void setTrimDistanceEnd( double distance ) { mTrimDistanceEnd = distance; }
382 
393  void setTrimDistanceEndUnit( QgsUnitTypes::RenderUnit unit ) { mTrimDistanceEndUnit = unit; }
394 
405  QgsUnitTypes::RenderUnit trimDistanceEndUnit() const { return mTrimDistanceEndUnit; }
406 
417  const QgsMapUnitScale &trimDistanceEndMapUnitScale() const { return mTrimDistanceEndMapUnitScale; }
418 
429  void setTrimDistanceEndMapUnitScale( const QgsMapUnitScale &scale ) { mTrimDistanceEndMapUnitScale = scale; }
430 
440  bool drawInsidePolygon() const { return mDrawInsidePolygon; }
441 
451  void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
452 
462  bool alignDashPattern() const;
463 
473  void setAlignDashPattern( bool enabled );
474 
485  bool tweakDashPatternOnCorners() const;
486 
497  void setTweakDashPatternOnCorners( bool enabled );
498 
499  private:
500 
501  Qt::PenStyle mPenStyle = Qt::SolidLine;
502  Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
503  Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
504  QPen mPen;
505  QPen mSelPen;
506 
507  bool mUseCustomDashPattern = false;
509  QgsMapUnitScale mCustomDashPatternMapUnitScale;
510 
511  double mDashPatternOffset = 0;
513  QgsMapUnitScale mDashPatternOffsetMapUnitScale;
514 
515  double mTrimDistanceStart = 0;
517  QgsMapUnitScale mTrimDistanceStartMapUnitScale;
518 
519  double mTrimDistanceEnd = 0;
521  QgsMapUnitScale mTrimDistanceEndMapUnitScale;
522 
524  QVector<qreal> mCustomDashVector;
525 
526  bool mAlignDashPattern = false;
527  bool mPatternCartographicTweakOnSharpCorners = false;
528 
529  bool mDrawInsidePolygon = false;
530 
531  //helper functions for data defined symbology
532  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
533  void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
534 };
535 
537 
538 #define DEFAULT_MARKERLINE_ROTATE true
539 #define DEFAULT_MARKERLINE_INTERVAL 3
540 
551 {
552  public:
553 
558  {
566  };
567 
575  QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
576  double interval = 3 );
577 
579 
584  bool rotateSymbols() const { return mRotateSymbols; }
585 
590  void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
591 
597  double interval() const { return mInterval; }
598 
605  void setInterval( double interval ) { mInterval = interval; }
606 
613  void setIntervalUnit( QgsUnitTypes::RenderUnit unit ) { mIntervalUnit = unit; }
614 
620  QgsUnitTypes::RenderUnit intervalUnit() const { return mIntervalUnit; }
621 
628  void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
629 
636  const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
637 
642  Placement placement() const { return mPlacement; }
643 
648  void setPlacement( Placement placement ) { mPlacement = placement; }
649 
660  double offsetAlongLine() const { return mOffsetAlongLine; }
661 
673  void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
674 
681  QgsUnitTypes::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
682 
689  void setOffsetAlongLineUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
690 
695  const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
696 
701  void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
702 
713  double averageAngleLength() const { return mAverageAngleLength; }
714 
725  void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
726 
735  void setAverageAngleUnit( QgsUnitTypes::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
736 
745  QgsUnitTypes::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
746 
755  void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
756 
765  const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
766 
767  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
768  void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) FINAL;
770  void setMapUnitScale( const QgsMapUnitScale &scale ) FINAL;
771  QgsMapUnitScale mapUnitScale() const FINAL;
772  QVariantMap properties() const override;
773  bool canCauseArtifactsBetweenAdjacentTiles() const override;
774 
775  protected:
776 
783  virtual void setSymbolLineAngle( double angle ) = 0;
784 
788  virtual double symbolAngle() const = 0;
789 
793  virtual void setSymbolAngle( double angle ) = 0;
794 
807  virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
808 
812  void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
813 
818  static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
819 
820  private:
821 
822  void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
823  void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::Vertex );
824  void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
825  double markerAngle( const QPolygonF &points, bool isRing, int vertex );
826 
838  void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context );
839 
840 
841  static void collectOffsetPoints( const QVector< QPointF> &points,
842  QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, double initialLag = 0,
843  int numberPointsRequired = -1 );
844 
845  bool mRotateSymbols = true;
846  double mInterval = 3;
847  QgsUnitTypes::RenderUnit mIntervalUnit = QgsUnitTypes::RenderMillimeters;
848  QgsMapUnitScale mIntervalMapUnitScale;
849  Placement mPlacement = Interval;
850  double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
851  QgsUnitTypes::RenderUnit mOffsetAlongLineUnit = QgsUnitTypes::RenderMillimeters; //unit for offset along line
852  QgsMapUnitScale mOffsetAlongLineMapUnitScale;
853  double mAverageAngleLength = 4;
854  QgsUnitTypes::RenderUnit mAverageAngleLengthUnit = QgsUnitTypes::RenderMillimeters;
855  QgsMapUnitScale mAverageAngleLengthMapUnitScale;
856 
857  friend class TestQgsMarkerLineSymbol;
858 
859 };
860 
867 {
868  public:
869 
878  double interval = DEFAULT_MARKERLINE_INTERVAL );
879 
881 
882  // static stuff
883 
889  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
890 
894  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
895 
896  // implemented from base classes
897 
898  QString layerType() const override;
899  void startRender( QgsSymbolRenderContext &context ) override;
900  void stopRender( QgsSymbolRenderContext &context ) override;
901  QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
902  void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
903  void setColor( const QColor &color ) override;
904  QColor color() const override;
905  QgsSymbol *subSymbol() override;
906  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
907  void setWidth( double width ) override;
908  double width() const override;
909  double width( const QgsRenderContext &context ) const override;
910  double estimateMaxBleed( const QgsRenderContext &context ) const override;
911  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
912  bool usesMapUnits() const override;
913  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
914  bool hasDataDefinedProperties() const override;
915  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
916 
923  Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
924 
929  Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
930 
931  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
932 
933  protected:
934 
935  std::unique_ptr< QgsMarkerSymbol > mMarker;
936 
937  void setSymbolLineAngle( double angle ) override;
938  double symbolAngle() const override;
939  void setSymbolAngle( double angle ) override;
940  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
941 
942  private:
943 
944 #ifdef SIP_RUN
946 #endif
947 
948 
949 };
950 
951 
961 {
962  public:
963 
971  QgsHashedLineSymbolLayer( bool rotateSymbol = true,
972  double interval = 3 );
973 
975 
981  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
982 
983  QString layerType() const override;
984  void startRender( QgsSymbolRenderContext &context ) override;
985  void stopRender( QgsSymbolRenderContext &context ) override;
986  QVariantMap properties() const override;
987  QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
988  void setColor( const QColor &color ) override;
989  QColor color() const override;
990  QgsSymbol *subSymbol() override;
991  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
992  void setWidth( double width ) override;
993  double width() const override;
994  double width( const QgsRenderContext &context ) const override;
995  double estimateMaxBleed( const QgsRenderContext &context ) const override;
996  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
997  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
998  bool hasDataDefinedProperties() const override;
999  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
1000  bool usesMapUnits() const override;
1001 
1007  double hashAngle() const;
1008 
1014  void setHashAngle( double angle );
1015 
1021  double hashLength() const { return mHashLength; }
1022 
1028  void setHashLength( double length ) { mHashLength = length; }
1029 
1035  void setHashLengthUnit( QgsUnitTypes::RenderUnit unit ) { mHashLengthUnit = unit; }
1036 
1042  QgsUnitTypes::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
1043 
1050  void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
1051 
1058  const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
1059 
1060  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
1061 
1062  protected:
1063 
1064  void setSymbolLineAngle( double angle ) override;
1065  double symbolAngle() const override;
1066  void setSymbolAngle( double angle ) override;
1067  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
1068 
1069  private:
1070 #ifdef SIP_RUN
1072 #endif
1073 
1074  std::unique_ptr< QgsLineSymbol > mHashSymbol;
1075 
1076  double mSymbolLineAngle = 0;
1077  double mSymbolAngle = 0;
1078 
1079  double mHashAngle = 0;
1080  double mHashLength = 3;
1082  QgsMapUnitScale mHashLengthMapUnitScale;
1083 
1084 };
1085 
1086 #endif
1087 
1088 
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.
QgsUnitTypes::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
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
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.
A store for object properties.
Definition: qgsproperty.h:232
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...
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
const QgsMapUnitScale & trimDistanceStartMapUnitScale() const
Returns the map unit scale for the trim distance for the start of the line.
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.
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.
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
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...
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 ...
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale for the dash pattern offset value.
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.
const QgsMapUnitScale & trimDistanceEndMapUnitScale() const
Returns the map unit scale for the trim distance for the end of the line.
const QgsMapUnitScale & customDashPatternMapUnitScale() const
Returns the map unit scale for lengths used in the custom dash pattern.
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.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38
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.
double averageAngleLength() const
Returns the length of line over which the line's direction is averaged when calculating individual sy...
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
void setRotateSymbols(bool rotate)
Sets whether the repeating symbols should be rotated to match their line segment orientation.
Placement placement() const
Returns the placement of the symbols.
Placement
Defines how/where the templated symbol should be placed on the line.
@ Vertex
Place symbols on every vertex in the line.
@ LastVertex
Place symbols on the last vertex in the line.
@ CentralPoint
Place symbols at the mid point of the line.
@ FirstVertex
Place symbols on the first vertex in the line.
@ SegmentCenter
Place symbols at the center of every line segment.
@ Interval
Place symbols at regular intervals.
@ CurvePoint
Place symbols at every virtual curve point in the line (used when rendering curved geometry types onl...
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...
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 setPlacement(Placement placement)
Sets the placement of the symbols.
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.
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols.
QgsUnitTypes::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line's direction is averaged when calculating individu...
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for 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.
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:228
#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