QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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 QVariantMap &properties = QVariantMap() ) 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  QVariantMap properties() const override;
73  QgsSimpleLineSymbolLayer *clone() const override SIP_FACTORY;
74  void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &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  bool usesMapUnits() const override;
79  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
80  QgsMapUnitScale mapUnitScale() const override;
81  double estimateMaxBleed( const QgsRenderContext &context ) const override;
82  QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit &unit ) const override;
83  Qt::PenStyle dxfPenStyle() const override;
84  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
85  double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
86  QColor dxfColor( QgsSymbolRenderContext &context ) const override;
87  bool canCauseArtifactsBetweenAdjacentTiles() const override;
88 
94  Qt::PenStyle penStyle() const { return mPenStyle; }
95 
101  void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
102 
108  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
109 
115  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
116 
122  Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
123 
129  void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
130 
137  bool useCustomDashPattern() const { return mUseCustomDashPattern; }
138 
145  void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
146 
151  void setCustomDashPatternUnit( QgsUnitTypes::RenderUnit unit ) { mCustomDashPatternUnit = unit; }
152 
157  QgsUnitTypes::RenderUnit customDashPatternUnit() const { return mCustomDashPatternUnit; }
158 
163  const QgsMapUnitScale &customDashPatternMapUnitScale() const { return mCustomDashPatternMapUnitScale; }
164 
169  void setCustomDashPatternMapUnitScale( const QgsMapUnitScale &scale ) { mCustomDashPatternMapUnitScale = scale; }
170 
183  QVector<qreal> customDashVector() const { return mCustomDashVector; }
184 
197  void setCustomDashVector( const QVector<qreal> &vector ) { mCustomDashVector = vector; }
198 
211  double dashPatternOffset() const { return mDashPatternOffset; }
212 
225  void setDashPatternOffset( double offset ) { mDashPatternOffset = offset; }
226 
236  void setDashPatternOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mDashPatternOffsetUnit = unit; }
237 
247  QgsUnitTypes::RenderUnit dashPatternOffsetUnit() const { return mDashPatternOffsetUnit; }
248 
258  const QgsMapUnitScale &dashPatternOffsetMapUnitScale() const { return mDashPatternOffsetMapUnitScale; }
259 
269  void setDashPatternOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mDashPatternOffsetMapUnitScale = scale; }
270 
280  bool drawInsidePolygon() const { return mDrawInsidePolygon; }
281 
291  void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygon = drawInsidePolygon; }
292 
302  bool alignDashPattern() const;
303 
313  void setAlignDashPattern( bool enabled );
314 
325  bool tweakDashPatternOnCorners() const;
326 
337  void setTweakDashPatternOnCorners( bool enabled );
338 
339  private:
340 
341  Qt::PenStyle mPenStyle = Qt::SolidLine;
342  Qt::PenJoinStyle mPenJoinStyle = DEFAULT_SIMPLELINE_JOINSTYLE;
343  Qt::PenCapStyle mPenCapStyle = DEFAULT_SIMPLELINE_CAPSTYLE;
344  QPen mPen;
345  QPen mSelPen;
346 
347  bool mUseCustomDashPattern = false;
349  QgsMapUnitScale mCustomDashPatternMapUnitScale;
350 
351  double mDashPatternOffset = 0;
353  QgsMapUnitScale mDashPatternOffsetMapUnitScale;
354 
356  QVector<qreal> mCustomDashVector;
357 
358  bool mAlignDashPattern = false;
359  bool mPatternCartographicTweakOnSharpCorners = false;
360 
361  bool mDrawInsidePolygon = false;
362 
363  //helper functions for data defined symbology
364  void applyDataDefinedSymbology( QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, double &offset );
365  void drawPathWithDashPatternTweaks( QPainter *painter, const QPolygonF &points, QPen pen ) const;
366 };
367 
369 
370 #define DEFAULT_MARKERLINE_ROTATE true
371 #define DEFAULT_MARKERLINE_INTERVAL 3
372 
383 {
384  public:
385 
390  {
398  };
399 
407  QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
408  double interval = 3 );
409 
414  bool rotateSymbols() const { return mRotateSymbols; }
415 
420  void setRotateSymbols( bool rotate ) { mRotateSymbols = rotate; }
421 
427  double interval() const { return mInterval; }
428 
435  void setInterval( double interval ) { mInterval = interval; }
436 
443  void setIntervalUnit( QgsUnitTypes::RenderUnit unit ) { mIntervalUnit = unit; }
444 
450  QgsUnitTypes::RenderUnit intervalUnit() const { return mIntervalUnit; }
451 
458  void setIntervalMapUnitScale( const QgsMapUnitScale &scale ) { mIntervalMapUnitScale = scale; }
459 
466  const QgsMapUnitScale &intervalMapUnitScale() const { return mIntervalMapUnitScale; }
467 
472  Placement placement() const { return mPlacement; }
473 
478  void setPlacement( Placement placement ) { mPlacement = placement; }
479 
490  double offsetAlongLine() const { return mOffsetAlongLine; }
491 
503  void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = offsetAlongLine; }
504 
511  QgsUnitTypes::RenderUnit offsetAlongLineUnit() const { return mOffsetAlongLineUnit; }
512 
519  void setOffsetAlongLineUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetAlongLineUnit = unit; }
520 
525  const QgsMapUnitScale &offsetAlongLineMapUnitScale() const { return mOffsetAlongLineMapUnitScale; }
526 
531  void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetAlongLineMapUnitScale = scale; }
532 
543  double averageAngleLength() const { return mAverageAngleLength; }
544 
555  void setAverageAngleLength( double length ) { mAverageAngleLength = length; }
556 
565  void setAverageAngleUnit( QgsUnitTypes::RenderUnit unit ) { mAverageAngleLengthUnit = unit; }
566 
575  QgsUnitTypes::RenderUnit averageAngleUnit() const { return mAverageAngleLengthUnit; }
576 
585  void setAverageAngleMapUnitScale( const QgsMapUnitScale &scale ) { mAverageAngleLengthMapUnitScale = scale; }
586 
595  const QgsMapUnitScale &averageAngleMapUnitScale() const { return mAverageAngleLengthMapUnitScale; }
596 
597  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
598  void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, QgsSymbolRenderContext &context ) FINAL;
600  void setMapUnitScale( const QgsMapUnitScale &scale ) FINAL;
601  QgsMapUnitScale mapUnitScale() const FINAL;
602  QVariantMap properties() const override;
603  bool canCauseArtifactsBetweenAdjacentTiles() const override;
604 
605  protected:
606 
613  virtual void setSymbolLineAngle( double angle ) = 0;
614 
618  virtual double symbolAngle() const = 0;
619 
623  virtual void setSymbolAngle( double angle ) = 0;
624 
637  virtual void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) = 0;
638 
642  void copyTemplateSymbolProperties( QgsTemplatedLineSymbolLayerBase *destLayer ) const;
643 
648  static void setCommonProperties( QgsTemplatedLineSymbolLayerBase *destLayer, const QVariantMap &properties );
649 
650  private:
651 
652  void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
653  void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::Vertex );
654  void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
655  double markerAngle( const QPolygonF &points, bool isRing, int vertex );
656 
668  void renderOffsetVertexAlongLine( const QPolygonF &points, int vertex, double distance, QgsSymbolRenderContext &context );
669 
670 
671  static void collectOffsetPoints( const QVector< QPointF> &points,
672  QVector< QPointF> &dest, double intervalPainterUnits, double initialOffset, double initialLag = 0,
673  int numberPointsRequired = -1 );
674 
675  bool mRotateSymbols = true;
676  double mInterval = 3;
677  QgsUnitTypes::RenderUnit mIntervalUnit = QgsUnitTypes::RenderMillimeters;
678  QgsMapUnitScale mIntervalMapUnitScale;
679  Placement mPlacement = Interval;
680  double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
681  QgsUnitTypes::RenderUnit mOffsetAlongLineUnit = QgsUnitTypes::RenderMillimeters; //unit for offset along line
682  QgsMapUnitScale mOffsetAlongLineMapUnitScale;
683  double mAverageAngleLength = 4;
684  QgsUnitTypes::RenderUnit mAverageAngleLengthUnit = QgsUnitTypes::RenderMillimeters;
685  QgsMapUnitScale mAverageAngleLengthMapUnitScale;
686 
687  friend class TestQgsMarkerLineSymbol;
688 
689 };
690 
697 {
698  public:
699 
708  double interval = DEFAULT_MARKERLINE_INTERVAL );
709 
710  // static stuff
711 
717  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
718 
722  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
723 
724  // implemented from base classes
725 
726  QString layerType() const override;
727  void startRender( QgsSymbolRenderContext &context ) override;
728  void stopRender( QgsSymbolRenderContext &context ) override;
729  QgsMarkerLineSymbolLayer *clone() const override SIP_FACTORY;
730  void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
731  void setColor( const QColor &color ) override;
732  QColor color() const override;
733  QgsSymbol *subSymbol() override;
734  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
735  void setWidth( double width ) override;
736  double width() const override;
737  double width( const QgsRenderContext &context ) const override;
738  double estimateMaxBleed( const QgsRenderContext &context ) const override;
739  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
740  bool usesMapUnits() const override;
741  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
742  bool hasDataDefinedProperties() const override;
743  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
744 
751  Q_DECL_DEPRECATED bool rotateMarker() const SIP_DEPRECATED { return rotateSymbols(); }
752 
757  Q_DECL_DEPRECATED void setRotateMarker( bool rotate ) SIP_DEPRECATED { setRotateSymbols( rotate ); }
758 
759  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
760 
761  protected:
762 
763  std::unique_ptr< QgsMarkerSymbol > mMarker;
764 
765  void setSymbolLineAngle( double angle ) override;
766  double symbolAngle() const override;
767  void setSymbolAngle( double angle ) override;
768  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
769 
770  private:
771 
772 #ifdef SIP_RUN
774 #endif
775 
776 
777 };
778 
779 
789 {
790  public:
791 
799  QgsHashedLineSymbolLayer( bool rotateSymbol = true,
800  double interval = 3 );
801 
807  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
808 
809  QString layerType() const override;
810  void startRender( QgsSymbolRenderContext &context ) override;
811  void stopRender( QgsSymbolRenderContext &context ) override;
812  QVariantMap properties() const override;
813  QgsHashedLineSymbolLayer *clone() const override SIP_FACTORY;
814  void setColor( const QColor &color ) override;
815  QColor color() const override;
816  QgsSymbol *subSymbol() override;
817  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
818  void setWidth( double width ) override;
819  double width() const override;
820  double width( const QgsRenderContext &context ) const override;
821  double estimateMaxBleed( const QgsRenderContext &context ) const override;
822  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
823  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
824  bool hasDataDefinedProperties() const override;
825  void setDataDefinedProperty( QgsSymbolLayer::Property key, const QgsProperty &property ) override;
826  bool usesMapUnits() const override;
827 
833  double hashAngle() const;
834 
840  void setHashAngle( double angle );
841 
847  double hashLength() const { return mHashLength; }
848 
854  void setHashLength( double length ) { mHashLength = length; }
855 
861  void setHashLengthUnit( QgsUnitTypes::RenderUnit unit ) { mHashLengthUnit = unit; }
862 
868  QgsUnitTypes::RenderUnit hashLengthUnit() const { return mHashLengthUnit; }
869 
876  void setHashLengthMapUnitScale( const QgsMapUnitScale &scale ) { mHashLengthMapUnitScale = scale; }
877 
884  const QgsMapUnitScale &hashLengthMapUnitScale() const { return mHashLengthMapUnitScale; }
885 
886  void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) override;
887 
888  protected:
889 
890  void setSymbolLineAngle( double angle ) override;
891  double symbolAngle() const override;
892  void setSymbolAngle( double angle ) override;
893  void renderSymbol( const QPointF &point, const QgsFeature *feature, QgsRenderContext &context, int layer = -1, bool selected = false ) override;
894 
895  private:
896 #ifdef SIP_RUN
898 #endif
899 
900  std::unique_ptr< QgsLineSymbol > mHashSymbol;
901 
902  double mSymbolLineAngle = 0;
903  double mSymbolAngle = 0;
904 
905  double mHashAngle = 0;
906  double mHashLength = 3;
908  QgsMapUnitScale mHashLengthMapUnitScale;
909 
910 };
911 
912 #endif
913 
914 
Exports QGIS layers to the DXF format.
Definition: qgsdxfexport.h:64
Class for parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
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.
double hashLength() const
Returns the length of hash symbols.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
virtual void setWidth(double width)
Sets the width of the line 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.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual double width() const
Returns the estimated width for the line symbol layer.
double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const override
Gets line width.
QgsMapUnitScale mapUnitScale() const override
void setMapUnitScale(const QgsMapUnitScale &scale) override
double offset() const
Returns the line's offset.
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.
Q_DECL_DEPRECATED bool rotateMarker() const
Shall the marker be rotated.
std::unique_ptr< QgsMarkerSymbol > mMarker
Q_DECL_DEPRECATED void setRotateMarker(bool rotate)
Shall the marker be rotated.
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.
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.
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.
QVector< qreal > customDashVector() const
Returns the custom dash vector, which is the pattern of alternating drawn/skipped lengths used while ...
void setCustomDashPatternUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
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 ...
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale 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.
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...
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
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...
Property
Data definable properties.
virtual double dxfOffset(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets offset.
virtual QColor color() const
The fill color.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
Saves the symbol layer as SLD.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
virtual QVector< qreal > dxfCustomDashPattern(QgsUnitTypes::RenderUnit &unit) const
Gets dash pattern.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual Qt::PenStyle dxfPenStyle() const
Gets pen style.
virtual QColor dxfColor(QgsSymbolRenderContext &context) const
Gets color.
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 void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
virtual bool canCauseArtifactsBetweenAdjacentTiles() const
Returns true if the symbol layer rendering can cause visible artifacts across a single feature when t...
virtual bool usesMapUnits() const
Returns true if the symbol layer has any components which use map unit based sizes.
virtual void setColor(const QColor &color)
The fill color.
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:65
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:167
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
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