16#ifndef QGSLINESYMBOLLAYER_H 
   17#define QGSLINESYMBOLLAYER_H 
   33#define DEFAULT_SIMPLELINE_COLOR     QColor(35,35,35) 
   34#define DEFAULT_SIMPLELINE_WIDTH     Qgis::DEFAULT_LINE_WIDTH 
   35#define DEFAULT_SIMPLELINE_PENSTYLE  Qt::SolidLine 
   36#define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin 
   37#define DEFAULT_SIMPLELINE_CAPSTYLE  Qt::SquareCap 
   73    QString layerType() const override;
 
   74    Qgis::SymbolLayerFlags flags() const override;
 
   79    void renderPolygonStroke( const QPolygonF &points, const QVector<QPolygonF> *rings, 
QgsSymbolRenderContext &context ) override;
 
   80    QVariantMap properties() const override;
 
   82    Q_DECL_DEPRECATED 
void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override 
SIP_DEPRECATED;
 
   83    bool toSld( QDomDocument &doc, QDomElement &element, 
QgsSldExportContext &context ) const override;
 
   84    QString ogrFeatureStyle( 
double mmScaleFactor, 
double mapUnitScaleFactor ) const override;
 
   85    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
   86    Qgis::RenderUnit outputUnit() const override;
 
   87    bool usesMapUnits() const override;
 
   91    QVector<qreal> dxfCustomDashPattern( 
Qgis::RenderUnit &unit ) const override;
 
   92    Qt::PenStyle dxfPenStyle() const override;
 
   96    bool canCauseArtifactsBetweenAdjacentTiles() const override;
 
  103    Qt::PenStyle penStyle()
 const { 
return mPenStyle; }
 
  467    bool alignDashPattern() 
const;
 
  478    void setAlignDashPattern( 
bool enabled );
 
  490    bool tweakDashPatternOnCorners() 
const;
 
  502    void setTweakDashPatternOnCorners( 
bool enabled );
 
  506    Qt::PenStyle mPenStyle = Qt::SolidLine;
 
  512    bool mUseCustomDashPattern = 
false;
 
  516    double mDashPatternOffset = 0;
 
  520    double mTrimDistanceStart = 0;
 
  524    double mTrimDistanceEnd = 0;
 
  529    QVector<qreal> mCustomDashVector;
 
  531    bool mAlignDashPattern = 
false;
 
  532    bool mPatternCartographicTweakOnSharpCorners = 
false;
 
  534    bool mDrawInsidePolygon = 
false;
 
  537    void applyDataDefinedSymbology( 
QgsSymbolRenderContext &context, QPen &pen, QPen &selPen, 
double &offset );
 
  538    void drawPathWithDashPatternTweaks( QPainter *painter, 
const QPolygonF &points, QPen pen ) 
const;
 
 
  543#define DEFAULT_MARKERLINE_ROTATE     true 
  544#define DEFAULT_MARKERLINE_INTERVAL   3 
  567                                     double interval = 3 );
 
  641    Q_DECL_DEPRECATED 
void setPlacement( 
Qgis::MarkerLinePlacement placement ) 
SIP_DEPRECATED;
 
  648    Qgis::MarkerLinePlacements placements()
 const { 
return mPlacements; }
 
  809    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
  812    QVariantMap properties() const override;
 
  813    bool canCauseArtifactsBetweenAdjacentTiles() const override;
 
  826    virtual 
void setSymbolLineAngle( 
double angle ) = 0;
 
  831    virtual 
double symbolAngle() const = 0;
 
  836    virtual 
void setSymbolAngle( 
double angle ) = 0;
 
  850    virtual 
void renderSymbol( const QPointF &point, const 
QgsFeature *feature, 
QgsRenderContext &context, 
int layer = -1, 
bool selected = false ) = 0;
 
  865    void renderPolylineInterval( const QPolygonF &points, 
QgsSymbolRenderContext &context, 
double averageAngleOver );
 
  866    void renderPolylineVertex( const QPolygonF &points, 
QgsSymbolRenderContext &context, 
Qgis::MarkerLinePlacement placement = 
Qgis::MarkerLinePlacement::Vertex );
 
  867    void renderPolylineCentral( const QPolygonF &points, 
QgsSymbolRenderContext &context, 
double averageAngleOver );
 
  868    double markerAngle( const QPolygonF &points, 
bool isRing, 
int vertex );
 
  882    void renderOffsetVertexAlongLine( const QPolygonF &points, 
int vertex, 
double distance, 
QgsSymbolRenderContext &context,
 
  883                                      Qgis::MarkerLinePlacement placement );
 
  886    static 
void collectOffsetPoints( const QVector< QPointF> &points,
 
  887                                     QVector< QPointF> &dest, 
double intervalPainterUnits, 
double initialOffset, 
double initialLag = 0,
 
  888                                     int numberPointsRequired = -1 );
 
  890    bool mRotateSymbols = true;
 
  891    double mInterval = 3;
 
  892    Qgis::RenderUnit mIntervalUnit = 
Qgis::RenderUnit::Millimeters;
 
  894    Qgis::MarkerLinePlacements mPlacements = 
Qgis::MarkerLinePlacement::Interval;
 
  895    double mOffsetAlongLine = 0; 
 
  896    Qgis::RenderUnit mOffsetAlongLineUnit = 
Qgis::RenderUnit::Millimeters; 
 
  898    double mAverageAngleLength = 4;
 
  899    Qgis::RenderUnit mAverageAngleLengthUnit = 
Qgis::RenderUnit::Millimeters;
 
  901    bool mPlaceOnEveryPart = true;
 
  903    bool mRenderingFeature = false;
 
  904    bool mHasRenderedFirstPart = false;
 
  905    QPointF mFinalVertex;
 
  906    bool mCurrentFeatureIsSelected = false;
 
  907    double mFeatureSymbolOpacity = 1;
 
  909    friend class TestQgsMarkerLineSymbol;
 
 
  950    QString layerType() const override;
 
  954    Q_DECL_DEPRECATED 
void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override 
SIP_DEPRECATED;
 
  955    bool toSld( QDomDocument &doc, QDomElement &element, 
QgsSldExportContext &context ) const override;
 
  956    void setColor( const QColor &color ) override;
 
  957    QColor color() const override;
 
  960    void setWidth( 
double width ) override;
 
  961    double width() const override;
 
  964    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
  965    bool usesMapUnits() const override;
 
  966    QSet<QString> usedAttributes( const 
QgsRenderContext &context ) const override;
 
  967    bool hasDataDefinedProperties() const override;
 
  976    Q_DECL_DEPRECATED 
bool rotateMarker() const 
SIP_DEPRECATED { 
return rotateSymbols(); }
 
  990    void setSymbolLineAngle( 
double angle ) 
override;
 
  991    double symbolAngle() 
const override;
 
  992    void setSymbolAngle( 
double angle ) 
override;
 
  993    void renderSymbol( 
const QPointF &point, 
const QgsFeature *feature, 
QgsRenderContext &context, 
int layer = -1, 
bool selected = 
false ) 
override;
 
 
 1025                              double interval = 3 );
 
 1036    QString layerType() const override;
 
 1039    QVariantMap properties() const override;
 
 1041    void setColor( const QColor &color ) override;
 
 1042    QColor color() const override;
 
 1045    void setWidth( 
double width ) override;
 
 1046    double width() const override;
 
 1049    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
 1050    QSet<QString> usedAttributes( const 
QgsRenderContext &context ) const override;
 
 1051    bool hasDataDefinedProperties() const override;
 
 1053    bool usesMapUnits() const override;
 
 1060    double hashAngle() const;
 
 1067    void setHashAngle( 
double angle );
 
 1074    double hashLength()
 const { 
return mHashLength; }
 
 1117    void setSymbolLineAngle( 
double angle ) 
override;
 
 1118    double symbolAngle() 
const override;
 
 1119    void setSymbolAngle( 
double angle ) 
override;
 
 1120    void renderSymbol( 
const QPointF &point, 
const QgsFeature *feature, 
QgsRenderContext &context, 
int layer = -1, 
bool selected = 
false ) 
override;
 
 1127    std::unique_ptr< QgsLineSymbol > mHashSymbol;
 
 1129    double mSymbolLineAngle = 0;
 
 1130    double mSymbolAngle = 0;
 
 1132    double mHashAngle = 0;
 
 1133    double mHashLength = 3;
 
 
 1185    void renderPolylineUsingBrush( 
const QPolygonF &points, 
QgsSymbolRenderContext &context, 
const QBrush &brush,
 
 1186                                   double patternThickness, 
double patternLength );
 
 1188    Qt::PenJoinStyle mPenJoinStyle = Qt::PenJoinStyle::RoundJoin;
 
 1189    Qt::PenCapStyle mPenCapStyle = Qt::PenCapStyle::RoundCap;
 
 1192    void renderLine( 
const QPolygonF &points, 
QgsSymbolRenderContext &context, 
const double lineThickness, 
const double patternLength, 
const QBrush &sourceBrush );
 
 
 1226    static 
void resolvePaths( QVariantMap &properties, const 
QgsPathResolver &pathResolver, 
bool saving );
 
 1232    QString path()
 const { 
return mPath; }
 
 1238    void setPath( 
const QString &path );
 
 1261    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
 1262    Qgis::RenderUnit outputUnit() const override;
 
 1263    bool usesMapUnits() const override;
 
 1267    QColor color() const override;
 
 1271    double mOpacity = 1.0;
 
 
 1296                             const QColor &color2 = Qt::white );
 
 1306    QString layerType() const override;
 
 1307    Qgis::SymbolLayerFlags flags() const override;
 
 1311    QVariantMap properties() const override;
 
 1313    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
 1314    Qgis::RenderUnit outputUnit() const override;
 
 1315    bool usesMapUnits() const override;
 
 1325    Qgis::GradientColorSource gradientColorType()
 const { 
return mGradientColorType; }
 
 1363    void setColor2( 
const QColor &color2 ) { mColor2 = color2; }
 
 
 1402    QString layerType() const override;
 
 1408    QVariantMap properties() const override;
 
 1412    bool hasDataDefinedProperties() const override;
 
 1413    void setColor( const QColor &
c ) override;
 
 1414    QColor color() const override;
 
 1415    void setOutputUnit( 
Qgis::RenderUnit unit ) override;
 
 1416    Qgis::RenderUnit outputUnit() const override;
 
 1417    bool usesMapUnits() const override;
 
 1421    QSet<QString> usedAttributes( const 
QgsRenderContext &context ) const override;
 
 1428    Qt::PenJoinStyle penJoinStyle()
 const { 
return mPenJoinStyle; }
 
 1458    std::unique_ptr< QgsFillSymbol > mFill;
 
 
Provides global constants and enumerations for use throughout the application.
MarkerLinePlacement
Defines how/where the symbols should be placed on a line.
GradientColorSource
Gradient color sources.
@ SimpleTwoColor
Simple two color gradient.
QFlags< SymbolLayerFlag > SymbolLayerFlags
Symbol layer flags.
RenderUnit
Rendering size units.
@ Millimeters
Millimeters.
QFlags< MarkerLinePlacement > MarkerLinePlacements
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.
Exports QGIS layers to the DXF format.
Handles parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol layer type which fills a stroked line with a QgsFillSymbol.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the pen join style used to render the line (e.g.
~QgsFilledLineSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the pen cap 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.
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.
void setHashLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the hash length.
Qgis::RenderUnit hashLengthUnit() const
Returns the units for the length of hash symbols.
~QgsHashedLineSymbolLayer() override
void setHashLengthUnit(Qgis::RenderUnit unit)
Sets the unit for the length of hash symbols.
Abstract base class for line symbol layers.
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual void renderPolygonStroke(const QPolygonF &points, const QVector< QPolygonF > *rings, QgsSymbolRenderContext &context)
Renders the line symbol layer along the outline of polygon, using the given render context.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolRenderContext &context)=0
Renders the line symbol layer along the line joining points, using the given render context.
double offset() const
Returns the line's offset.
A line symbol type, for rendering LineString and MultiLineString geometries.
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.
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....
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.
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.
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...
double trimDistanceStart() const
Returns the trim distance for the start of the line, which dictates a length from the start of the li...
~QgsSimpleLineSymbolLayer() override
void setUseCustomDashPattern(bool b)
Sets whether the line uses a custom dash pattern.
Qgis::RenderUnit customDashPatternUnit() const
Returns the units for lengths used in the custom dash pattern.
double trimDistanceEnd() const
Returns the trim distance for the end of the line, which dictates a length from the end of the line a...
Qgis::RenderUnit dashPatternOffsetUnit() const
Returns the units for the dash pattern offset.
const QgsMapUnitScale & dashPatternOffsetMapUnitScale() const
Returns the map unit scale for the dash pattern offset value.
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 ...
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 setTrimDistanceStartMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the trim distance for the start of the line.
Qgis::RenderUnit trimDistanceStartUnit() const
Returns the unit for the trim distance for the start of the line.
Qt::PenCapStyle penCapStyle() const
Returns the pen cap style used to render the line (e.g.
void setTrimDistanceEndUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the end of the line.
void setDashPatternOffsetUnit(Qgis::RenderUnit unit)
Sets the unit for the dash pattern offset.
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 ...
void setTrimDistanceStartUnit(Qgis::RenderUnit unit)
Sets the unit for the trim distance for the start of the line.
Qgis::RenderUnit trimDistanceEndUnit() const
Returns the unit for the trim distance for the end of the line.
void setCustomDashPatternUnit(Qgis::RenderUnit unit)
Sets the unit for lengths used in the custom dash pattern.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
Abstract base class for symbol layers.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Property
Data definable properties.
virtual void startRender(QgsSymbolRenderContext &context)=0
Called before a set of rendering operations commences on the supplied render context.
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual QString layerType() const =0
Returns a string that represents this layer type.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Called after a set of rendering operations has finished on the supplied render context.
virtual Qgis::SymbolLayerFlags flags() const
Returns flags which control the symbol layer's behavior.
Encapsulates the context in which a symbol is being rendered.
Abstract base class for all rendered symbols.
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.
void setIntervalUnit(Qgis::RenderUnit unit)
Sets the units for the interval between symbols.
void setAverageAngleUnit(Qgis::RenderUnit unit)
Sets the unit for the length over which the line's direction is averaged when calculating individual ...
const QgsMapUnitScale & averageAngleMapUnitScale() const
Returns the map unit scale for the length over which the line's direction is averaged when calculatin...
double interval() const
Returns the interval between individual symbols.
void setOffsetAlongLineUnit(Qgis::RenderUnit unit)
Sets the unit used for calculating the offset along line for symbols.
void setAverageAngleMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the length over which the line's direction is averaged when calculating i...
const QgsMapUnitScale & intervalMapUnitScale() const
Returns the map unit scale for the interval between symbols.
double offsetAlongLine() const
Returns the offset along the line for the symbol placement.
~QgsTemplatedLineSymbolLayerBase() override
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the symbol placement.
Qgis::RenderUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for symbols.
void setInterval(double interval)
Sets the interval between individual symbols.
Qgis::RenderUnit intervalUnit() const
Returns the units for the interval between symbols.
void setPlaceOnEveryPart(bool respect)
Sets whether the placement applies for every part of multi-part feature geometries.
void setPlacements(Qgis::MarkerLinePlacements placements)
Sets the placement of the symbols.
Qgis::RenderUnit averageAngleUnit() const
Returns the unit for the length over which the line's direction is averaged when calculating individu...
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...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define 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