QGIS API Documentation  3.17.0-Master (3b262f2a79)
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 
28 #define DEFAULT_SIMPLELINE_COLOR QColor(35,35,35)
29 #define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH
30 #define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
31 #define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
32 #define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
33 
39 class CORE_EXPORT QgsSimpleLineSymbolLayer : public QgsLineSymbolLayer
40 {
41  public:
42 
49  double width = DEFAULT_SIMPLELINE_WIDTH,
50  Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE );
51 
52  // static stuff
53 
59  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
60 
64  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
65 
66  QString layerType() const override;
67  void startRender( QgsSymbolRenderContext &context ) override;
68  void stopRender( QgsSymbolRenderContext &context ) override;
69  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
70  //overridden so that clip path can be set when using draw inside polygon option
71  void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) override;
72  QgsStringMap properties() const override;
73  QgsSimpleLineSymbolLayer *clone() const override SIP_FACTORY;
74  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
75  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
76  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
77  QgsUnitTypes::RenderUnit outputUnit() const override;
78  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
79  QgsMapUnitScale mapUnitScale() const override;
80  double estimateMaxBleed( const QgsRenderContext &context ) const override;
81  QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit &unit ) const override;
82  Qt::PenStyle dxfPenStyle() const override;
83  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
84  double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
85  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
86 
92  Qt::PenStyle penStyle() const { return mPenStyle; }
93 
99  void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
100 
106  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
107 
113  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
114 
120  Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
121 
127  void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
128 
135  bool useCustomDashPattern() const { return mUseCustomDashPattern; }
136 
143  void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
144 
149  void setCustomDashPatternUnit( QgsUnitTypes::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
150 
155  QgsUnitTypes::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
156 
161  const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
162 
167  void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
168 
181  QVector<qreal> customDashVector() const { return mCustomDashVector; }
182 
195  void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
196 
209  double dashPatternOffset() const { return mDashPatternOffset; }
210 
223  void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
224 
234  void setDashPatternOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
235 
245  QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
246 
256  const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
257 
267  void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
268 
278  bool drawInsidePolygon() const { return mDrawInsidePolygon; }
279 
289  void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
290 
300  bool alignDashPattern() const;
301 
311  void setAlignDashPattern( bool enabled );
312 
323  bool tweakDashPatternOnCorners() const;
324 
335  void setTweakDashPatternOnCorners( bool enabled );
336 
337  private:
338 
339  Qt::PenStyle mPenStyle = Qt::SolidLine;
340  Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
341  Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
342  QPen mPen;
343  QPen mSelPen;
344 
345  bool mUseCustomDashPattern = false;
347  QgsMapUnitScale mCustomDashPatternMapUnitScale;
348 
349  double mDashPatternOffset = 0;
351  QgsMapUnitScale mDashPatternOffsetMapUnitScale;
352 
354  QVector<qreal> mCustomDashVector;
355 
356  bool mAlignDashPattern = false;
357  bool mPatternCartographicTweakOnSharpCorners = false;
358 
359  bool mDrawInsidePolygon = false;
360 
361  //helper functions for data defined symbology
362  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
363  void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
364 };
365 
367 
368 #define DEFAULT_MARKERLINE_ROTATE true
369 #define DEFAULT_MARKERLINE_INTERVAL 3
370 
381 {
382  public:
383 
388  {
396  };
397 
405  QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
406  double interval = 3 );
407 
412  bool rotateSymbols() const { return mRotateSymbols; }
413 
418  void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
419 
425  double interval() const { return mInterval; }
426 
433  void setInterval( double interval ) { mInterval = interval; }
434 
441  void setIntervalUnit( QgsUnitTypes::RenderUnit unit ) { mIntervalUnit = unit; }
442 
448  QgsUnitTypes::RenderUnit intervalUnit() const { return mIntervalUnit; }
449 
456  void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
457 
464  const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
465 
470  Placement placement() const { return mPlacement; }
471 
476  void setPlacement( Placement placement ) { mPlacement = placement; }
477 
488  double offsetAlongLine() const { return mOffsetAlongLine; }
489 
501  void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
502 
509  QgsUnitTypes::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
510 
517  void setOffsetAlongLineUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
518 
523  const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
524 
529  void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
530 
541  double averageAngleLength() const { return mAverageAngleLength; }
542 
553  void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
554 
563  void setAverageAngleUnit( QgsUnitTypes::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
564 
573  QgsUnitTypes::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
574 
583  void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
584 
593  const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
594 
595  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
596  void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) FINAL;
598  void setMapUnitScale( const QgsMapUnitScale &scale ) FINAL;
600  QgsStringMap properties() const override;
601 
602  protected:
603 
610  virtual void setSymbolLineAngle( double angle ) = 0;
611 
615  virtual double symbolAngle() const = 0;
616 
620  virtual void setSymbolAngle( double angle ) = 0;
621 
634  virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
635 
639  void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
640 
645  static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QgsStringMap &properties );
646 
647  private:
648 
649  void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
650  void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::Vertex );
651  void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
652  double markerAngle( const QPolygonF &points, bool isRing, int vertex );
653 
665  void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context );
666 
667 
668  static void collectOffsetPoints( const QVector< QPointF> &points,
669  QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, double initialLag = 0,
670  int numberPointsRequired = -1 );
671 
672  bool mRotateSymbols = true;
673  double mInterval = 3;
675  QgsMapUnitScale mIntervalMapUnitScale;
676  Placement mPlacement = Interval;
677  double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
678  QgsUnitTypes::RenderUnit mOffsetAlongLineUnit = QgsUnitTypes::RenderMillimeters; //unit for offset along line
679  QgsMapUnitScale mOffsetAlongLineMapUnitScale;
680  double mAverageAngleLength = 4;
682  QgsMapUnitScale mAverageAngleLengthMapUnitScale;
683 
684  friend class TestQgsMarkerLineSymbol;
685 
686 };
687 
694 {
695  public:
696 
705  double interval = DEFAULT_MARKERLINE_INTERVAL );
706 
707  // static stuff
708 
714  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
715 
719  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
720 
721  // implemented from base classes
722 
723  QString layerType() const override;
724  void startRender( QgsSymbolRenderContext &context ) override;
725  void stopRender( QgsSymbolRenderContext &context ) override;
726  QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
727  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
728  void setColor( const QColor &color ) override;
729  QColor color() const override;
730  QgsSymbol *subSymbol() override;
731  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
732  void setWidth( double width ) override;
733  double width() const override;
734  double width( const QgsRenderContext &context ) const override;
735  double estimateMaxBleed( const QgsRenderContext &context ) const override;
736  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
737  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
738  bool hasDataDefinedProperties() const override;
739  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
740 
747  Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
748 
753  Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
754 
755  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
756 
757  protected:
758 
759  std::unique_ptr< QgsMarkerSymbol > mMarker;
760 
761  void setSymbolLineAngle( double angle ) override;
762  double symbolAngle() const override;
763  void setSymbolAngle( double angle ) override;
764  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
765 
766  private:
767 
768 #ifdef SIP_RUN
770 #endif
771 
772 
773 };
774 
775 
785 {
786  public:
787 
795  QgsHashedLineSymbolLayer( bool rotateSymbol = true,
796  double interval = 3 );
797 
803  static QgsSymbolLayer *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
804 
805  QString layerType() const override;
806  void startRender( QgsSymbolRenderContext &context ) override;
807  void stopRender( QgsSymbolRenderContext &context ) override;
808  QgsStringMap properties() const override;
809  QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
810  void setColor( const QColor &color ) override;
811  QColor color() const override;
812  QgsSymbol *subSymbol() override;
813  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
814  void setWidth( double width ) override;
815  double width() const override;
816  double width( const QgsRenderContext &context ) const override;
817  double estimateMaxBleed( const QgsRenderContext &context ) const override;
818  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
819  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
820  bool hasDataDefinedProperties() const override;
821  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
822 
828  double hashAngle() const;
829 
835  void setHashAngle( double angle );
836 
842  double hashLength() const { return mHashLength; }
843 
849  void setHashLength( double length ) { mHashLength = length; }
850 
856  void setHashLengthUnit( QgsUnitTypes::RenderUnit unit ) { mHashLengthUnit = unit; }
857 
863  QgsUnitTypes::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
864 
871  void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
872 
879  const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
880 
881  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
882 
883  protected:
884 
885  void setSymbolLineAngle( double angle ) override;
886  double symbolAngle() const override;
887  void setSymbolAngle( double angle ) override;
888  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
889 
890  private:
891 #ifdef SIP_RUN
893 #endif
894 
895  std::unique_ptr< QgsLineSymbol > mHashSymbol;
896 
897  double mSymbolLineAngle = 0;
898  double mSymbolAngle = 0;
899 
900  double mHashAngle = 0;
901  double mHashLength = 3;
903  QgsMapUnitScale mHashLengthMapUnitScale;
904 
905 };
906 
907 #endif
908 
909 
Class for parsing and evaluation of expressions (formerly called "search strings").
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the symbol placement.
double hashLength() const
Returns the length of hash symbols.
virtual QVector< qreal > dxfCustomDashPattern(QgsUnitTypes::RenderUnit &unit) const
Gets dash pattern.
QgsUnitTypes::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
Place symbols on the first vertex in the line.
void setMapUnitScale(const QgsMapUnitScale &scale) override
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
void setPlacement(Placement placement)
Sets the placement of the symbols.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:64
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
virtual QgsSymbol * subSymbol()
Returns the symbol&#39;s sub symbol, if present.
virtual double dxfOffset(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets offset.
Q_DECL_DEPRECATED void setRotateMarker(bool rotate)
Shall the marker be rotated.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
A simple line symbol layer, which renders lines using a line in a variety of styles (e...
double averageAngleLength() const
Returns the length of line over which the line&#39;s direction is averaged when calculating individual sy...
virtual void setSymbolLineAngle(double angle)=0
Sets the line angle modification for the symbol&#39;s angle.
#define DEFAULT_MARKERLINE_INTERVAL
const QgsMapUnitScale & hashLengthMapUnitScale() const
Returns the map unit scale for the hash length.
QgsUnitTypes::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line&#39;s direction is averaged when calculating individu...
#define DEFAULT_SIMPLELINE_JOINSTYLE
void setDashPatternOffset(double offset)
Sets the dash pattern offset, which dictates how far along the dash pattern the pattern should start ...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
Place symbols on every vertex in the line.
const QgsMapUnitScale & averageAngleMapUnitScale() const
Returns the map unit scale for the length over which the line&#39;s direction is averaged when calculatin...
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
QgsUnitTypes::RenderUnit intervalUnit() const
Returns the units for the interval between symbols.
double interval() const
Returns the interval between individual symbols.
double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets line width.
QMap< QString, QString > QgsStringMap
Definition: qgis.h:759
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
void setInterval(double interval)
Sets the interval between individual symbols.
virtual double width() const
Returns the estimated width for the line symbol layer.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context...
Place symbols at every virtual curve point in the line (used when rendering curved geometry types onl...
void setCustomDashPatternUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties...
virtual void setColor(const QColor &color)
The fill color.
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
Place symbols at the center of every line segment.
void setAverageAngleUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length over which the line&#39;s direction is averaged when calculating individual ...
std::unique_ptr< QgsMarkerSymbol > mMarker
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer&#39;s subsymbol. takes ownership of the passed symbol.
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for symbols...
void setIntervalUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the interval between symbols.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void setDashPatternOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the dash pattern offset.
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
#define DEFAULT_SIMPLELINE_CAPSTYLE
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
void setDashPatternOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the dash pattern offset.
Line symbol layer type which draws repeating line sections along a line feature.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
#define DEFAULT_SIMPLELINE_PENSTYLE
#define SIP_TRANSFER
Definition: qgis_sip.h:36
virtual QColor color() const
The fill color.
void setRotateSymbols(bool rotate)
Sets whether the repeating symbols should be rotated to match their line segment orientation.
virtual double symbolAngle() const =0
Returns the symbol&#39;s current angle, in degrees clockwise.
#define DEFAULT_SIMPLELINE_COLOR
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
Qt::PenJoinStyle penJoinStyle() const
Returns the pen join style used to render the line (e.g.
#define SIP_FACTORY
Definition: qgis_sip.h:76
double offset() const
Returns the line&#39;s offset.
bool useCustomDashPattern() const
Returns true if the line uses a custom dash pattern.
Base class for templated line symbols, e.g.
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 bool rotateMarker() const
Shall the marker be rotated.
A store for object properties.
Definition: qgsproperty.h:231
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for symbols...
void setPenStyle(Qt::PenStyle style)
Sets the pen style used to render the line (e.g.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
void setHashLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the length of hash symbols.
Place symbols at regular intervals.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the pen cap style used to render the line (e.g.
QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
virtual Qt::PenStyle dxfPenStyle() const
Gets pen style.
#define DEFAULT_SIMPLELINE_WIDTH
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
Contains information about the context of a rendering operation.
#define FINAL
Definition: qgis_sip.h:228
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
bool drawInsidePolygon() const
Returns true if the line should only be drawn inside polygons, and any portion of the line which fall...
Line symbol layer type which draws repeating marker symbols along a line feature. ...
Struct for storing maximum and minimum scales for measurements in map units.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for lengths used in the custom dash pattern.
Placement
Defines how/where the templated symbol should be placed on the line.
virtual QColor dxfColor(QgsSymbolRenderContext &context) const
Gets color.
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the interval between symbols.
Qt::PenStyle penStyle() const
Returns the pen style used to render the line (e.g.
virtual void setSymbolAngle(double angle)=0
Sets the symbol&#39;s angle, in degrees clockwise.
void setDrawInsidePolygon(bool drawInsidePolygon)
Sets whether the line should only be drawn inside polygons, and any portion of the line which falls o...
void setCustomDashVector(const QVector< qreal > &vector)
Sets the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ren...
Placement placement() const
Returns the placement of the symbols.
Place symbols on the last vertex in the line.
const QgsMapUnitScale & customDashPatternMapUnitScale() const
Returns the map unit scale for lengths used in the custom dash pattern.
void setOffsetAlongLineUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit used for calculating the offset along line for symbols.
void setAverageAngleLength(double length)
Sets the length of line over which the line&#39;s direction is averaged when calculating individual symbo...
Place symbols at the mid point of the line.
void setAverageAngleMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the length over which the line&#39;s direction is averaged when calculating i...
void setHashLength(double length)
Sets the length of hash symbols.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap 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...
#define DEFAULT_MARKERLINE_ROTATE
double offsetAlongLine() const
Returns the offset along the line for the symbol placement.
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.
QgsMapUnitScale mapUnitScale() const override
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets 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...
Property
Data definable properties.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:166
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
QgsUnitTypes::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale the dash pattern offset value.
virtual QString layerType() const =0
Returns a string that represents this layer type.
bool rotateSymbols() const
Returns true if the repeating symbols be rotated to match their line segment orientation.