QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsmarkersymbollayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmarkersymbollayer.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 QGSMARKERSYMBOLLAYER_H
17 #define QGSMARKERSYMBOLLAYER_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 #include "qgssymbollayer.h"
22 
23 #define DEFAULT_SIMPLEMARKER_NAME "circle"
24 #define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0)
25 #define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor( 35, 35, 35 )
26 #define DEFAULT_SIMPLEMARKER_JOINSTYLE Qt::BevelJoin
27 #define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE
28 #define DEFAULT_SIMPLEMARKER_ANGLE 0
29 
30 #include <QPen>
31 #include <QBrush>
32 #include <QPicture>
33 #include <QPolygonF>
34 #include <QFont>
35 
36 class QgsFillSymbol;
37 class QgsPathResolver;
38 
47 {
48 
49  public:
50 
52  static QList< Qgis::MarkerShape > availableShapes();
53 
59  static bool shapeIsFilled( Qgis::MarkerShape shape );
60 
69  double size = DEFAULT_SIMPLEMARKER_SIZE,
72 
74 
79  Qgis::MarkerShape shape() const { return mShape; }
80 
86  void setShape( Qgis::MarkerShape shape ) { mShape = shape; }
87 
96  static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = nullptr );
97 
104  static QString encodeShape( Qgis::MarkerShape shape );
105 
106  void startRender( QgsSymbolRenderContext &context ) override;
107  void stopRender( QgsSymbolRenderContext &context ) override;
108  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
109  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
110 
111  protected:
112 
116  bool prepareMarkerShape( Qgis::MarkerShape shape );
117 
121  bool prepareMarkerPath( Qgis::MarkerShape symbol );
122 
129  bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
130 
137  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
138 
147  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
148 
150  QPolygonF mPolygon;
151 
153  QPainterPath mPath;
154 
157 
158  private:
159 
168  virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
169 };
170 
177 {
178  public:
179 
191  double size = DEFAULT_SIMPLEMARKER_SIZE,
194  const QColor &color = DEFAULT_SIMPLEMARKER_COLOR,
195  const QColor &strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
196  Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
197 
199 
200  // static methods
201 
207  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
208 
214  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
215 
216  // reimplemented from base classes
217 
218  QString layerType() const override;
219  void startRender( QgsSymbolRenderContext &context ) override;
220  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
221  QVariantMap properties() const override;
222  QgsSimpleMarkerSymbolLayer *clone() const override SIP_FACTORY;
223  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
224  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
225  bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
226  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
227  QgsUnitTypes::RenderUnit outputUnit() const override;
228  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
229  QgsMapUnitScale mapUnitScale() const override;
230  bool usesMapUnits() const override;
231  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
232  QColor fillColor() const override { return mColor; }
233  void setFillColor( const QColor &color ) override { mColor = color; }
234  void setColor( const QColor &color ) override;
235  QColor color() const override;
236 
237  // new methods
238 
245  QColor strokeColor() const override { return mStrokeColor; }
246 
254  void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
255 
263  Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
264 
273  void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
274 
283  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
284 
294  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
295 
304  Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
305 
314  void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
315 
322  double strokeWidth() const { return mStrokeWidth; }
323 
331  void setStrokeWidth( double w ) { mStrokeWidth = w; }
332 
340  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit u ) { mStrokeWidthUnit = u; }
341 
348  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
349 
357  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
358 
365  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
366 
367  protected:
368 
375  void drawMarker( QPainter *p, QgsSymbolRenderContext &context );
376 
381  bool prepareCache( QgsSymbolRenderContext &context );
382 
384  QColor mStrokeColor;
386  Qt::PenStyle mStrokeStyle = Qt::SolidLine;
388  double mStrokeWidth = 0;
394  Qt::PenJoinStyle mPenJoinStyle;
396  Qt::PenCapStyle mPenCapStyle = Qt::SquareCap;
398  QPen mPen;
400  QBrush mBrush;
401 
403  QImage mCache;
405  QPen mSelPen;
407  QBrush mSelBrush;
409  QImage mSelCache;
410 
415  bool mUsingCache = false;
416 
418  static const int MAXIMUM_CACHE_WIDTH = 3000;
419 
420  private:
421  // cppcheck-suppress unusedPrivateFunction
422  void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
423 
424  double mCachedOpacity = 1.0;
425 
426 };
427 
436 {
437  public:
438 
447  double size = DEFAULT_SIMPLEMARKER_SIZE,
449  Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
450 
452 
458  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
459 
460  QString layerType() const override;
461  void startRender( QgsSymbolRenderContext &context ) override;
462  void stopRender( QgsSymbolRenderContext &context ) override;
463  QVariantMap properties() const override;
464  QgsFilledMarkerSymbolLayer *clone() const override SIP_FACTORY;
465  QgsSymbol *subSymbol() override;
466  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
467  double estimateMaxBleed( const QgsRenderContext &context ) const override;
468  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
469  bool hasDataDefinedProperties() const override;
470  void setColor( const QColor &c ) override;
471  QColor color() const override;
472  bool usesMapUnits() const override;
473 
474  private:
475 #ifdef SIP_RUN
477 #endif
478 
479  // cppcheck-suppress unusedPrivateFunction
480  void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
481 
483  std::unique_ptr< QgsFillSymbol > mFill;
484 };
485 
487 
488 #define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE
489 #define DEFAULT_SVGMARKER_ANGLE 0
490 
496 {
497  public:
499  QgsSvgMarkerSymbolLayer( const QString &path,
500  double size = DEFAULT_SVGMARKER_SIZE,
502  Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
503 
505 
506  // static stuff
507 
509  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
510  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
511 
517  static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
518 
519  // implemented from base classes
520 
521  QString layerType() const override;
522 
523  void startRender( QgsSymbolRenderContext &context ) override;
524 
525  void stopRender( QgsSymbolRenderContext &context ) override;
526 
527  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
528 
529  QVariantMap properties() const override;
530  bool usesMapUnits() const override;
531 
532  QgsSvgMarkerSymbolLayer *clone() const override SIP_FACTORY;
533 
534  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
535 
540  QString path() const { return mPath; }
541 
547  void setPath( const QString &path );
548 
553  double defaultAspectRatio() const { return mDefaultAspectRatio; }
554 
560  double updateDefaultAspectRatio();
561 
566  bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
567 
574  bool setPreservedAspectRatio( bool par );
575 
581  double fixedAspectRatio() const { return mFixedAspectRatio; }
582 
589  void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
590 
591  QColor fillColor() const override { return color(); }
592  void setFillColor( const QColor &color ) override { setColor( color ); }
593 
594  QColor strokeColor() const override { return mStrokeColor; }
595  void setStrokeColor( const QColor &c ) override { mStrokeColor = c; }
596 
597  double strokeWidth() const { return mStrokeWidth; }
598  void setStrokeWidth( double w ) { mStrokeWidth = w; }
599 
604  QMap<QString, QgsProperty> parameters() const { return mParameters; }
605 
610  void setParameters( const QMap<QString, QgsProperty> &parameters );
611 
617  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
618 
623  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
624 
625  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
626  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
627 
628  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
629  QgsUnitTypes::RenderUnit outputUnit() const override;
630 
631  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
632  QgsMapUnitScale mapUnitScale() const override;
633 
634  bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
635 
636  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
637 
638  void prepareExpressions( const QgsSymbolRenderContext &context ) override;
639 
640  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
641 
642  protected:
643 
650  double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
651 
652  QString mPath;
653 
655  double mDefaultAspectRatio = 0.0;
657  double mFixedAspectRatio = 0.0;
658  //param(fill), param(stroke), param(stroke-width) are going
659  //to be replaced in memory
660  bool mHasFillParam = false;
661  QColor mStrokeColor;
662  double mStrokeWidth;
663  QMap<QString, QgsProperty> mParameters;
664 
667 
668  private:
669  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
670  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
671 
672 };
673 
674 
676 
677 #define DEFAULT_RASTERMARKER_SIZE 2*DEFAULT_POINT_SIZE
678 #define DEFAULT_RASTERMARKER_ANGLE 0
679 
687 {
688  public:
690  QgsRasterMarkerSymbolLayer( const QString &path = QString(),
691  double size = DEFAULT_SVGMARKER_SIZE,
693  Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
694 
696 
697  // static stuff
698 
703  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
704 
710  static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
711 
712  // implemented from base classes
713 
714  QString layerType() const override;
715 
716  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
717  QVariantMap properties() const override;
718  QgsRasterMarkerSymbolLayer *clone() const override SIP_FACTORY;
719  bool usesMapUnits() const override;
720  QColor color() const override;
721 
728  double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
729 
734  QString path() const { return mPath; }
735 
741  void setPath( const QString &path );
742 
748  double opacity() const { return mOpacity; }
749 
755  void setOpacity( double opacity ) { mOpacity = opacity; }
756 
761  double defaultAspectRatio() const { return mDefaultAspectRatio; }
762 
768  double updateDefaultAspectRatio();
769 
774  bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
775 
782  bool setPreservedAspectRatio( bool par );
783 
789  double fixedAspectRatio() const { return mFixedAspectRatio; }
790 
797  void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
798 
799  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
800  QgsMapUnitScale mapUnitScale() const override;
801 
802  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
803 
804  protected:
805 
806  QString mPath;
808  double mOpacity = 1.0;
810  double mDefaultAspectRatio = 0.0;
812  double mFixedAspectRatio = 0.0;
813 
814  private:
815  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
816  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
817 
818 };
819 
820 
822 
823 #define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch
824 #define MM2POINT(x) ( (x) * 72 / 25.4 )
825 
826 #define DEFAULT_FONTMARKER_FONT "Dingbats"
827 #define DEFAULT_FONTMARKER_CHR QChar('A')
828 #define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
829 #define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
830 #define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
831 #define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
832 #define DEFAULT_FONTMARKER_ANGLE 0
833 
839 {
840  public:
841 
843  QgsFontMarkerSymbolLayer( const QString &fontFamily = DEFAULT_FONTMARKER_FONT,
844  QString chr = DEFAULT_FONTMARKER_CHR,
845  double pointSize = DEFAULT_FONTMARKER_SIZE,
846  const QColor &color = DEFAULT_FONTMARKER_COLOR,
847  double angle = DEFAULT_FONTMARKER_ANGLE );
848 
850 
851  // static stuff
852 
856  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
857 
861  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
862 
869  static void resolveFonts( const QVariantMap &properties, const QgsReadWriteContext &context );
870 
871  // implemented from base classes
872 
873  QString layerType() const override;
874 
875  void startRender( QgsSymbolRenderContext &context ) override;
876 
877  void stopRender( QgsSymbolRenderContext &context ) override;
878 
879  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
880 
881  QVariantMap properties() const override;
882 
883  QgsFontMarkerSymbolLayer *clone() const override SIP_FACTORY;
884 
885  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
886  bool usesMapUnits() const override;
887 
888  // new methods
889 
895  QString fontFamily() const { return mFontFamily; }
896 
902  void setFontFamily( const QString &family ) { mFontFamily = family; }
903 
910  QString fontStyle() const { return mFontStyle; }
911 
918  void setFontStyle( const QString &style ) { mFontStyle = style; }
919 
925  QString character() const { return mString; }
926 
932  void setCharacter( QString chr ) { mString = chr; }
933 
934  QColor strokeColor() const override { return mStrokeColor; }
935  void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
936 
946  double strokeWidth() const { return mStrokeWidth; }
947 
957  void setStrokeWidth( double width ) { mStrokeWidth = width; }
958 
968  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
969 
978  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
979 
989  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
990 
1000  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
1001 
1009  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
1010 
1018  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1019 
1020  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
1021 
1022  private:
1023 
1024  QString mFontFamily;
1025  QString mFontStyle;
1026  QFont mFont;
1027  std::unique_ptr< QFontMetrics >mFontMetrics;
1028 
1029  QString mString;
1030 
1031  double mChrWidth = 0;
1032  QPointF mChrOffset;
1034  double mFontSizeScale = 1.0;
1035  double mOrigSize;
1036 
1037  QColor mStrokeColor;
1038  double mStrokeWidth;
1039  QgsUnitTypes::RenderUnit mStrokeWidthUnit;
1040  QgsMapUnitScale mStrokeWidthMapUnitScale;
1041  Qt::PenJoinStyle mPenJoinStyle;
1042 
1043  QPen mPen;
1044  QBrush mBrush;
1045 
1046  bool mUseCachedPath = false;
1047  QPainterPath mCachedPath;
1048 
1049  // If font has a zero (or nearly zero) size, we skip rendering altogether..
1050  bool mNonZeroFontSize = true;
1051 
1052  QString characterToRender( QgsSymbolRenderContext &context, QPointF &charOffset, double &charWidth );
1053  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
1054  double calculateSize( QgsSymbolRenderContext &context );
1055 };
1056 
1057 // clazy:excludeall=qstring-allocations
1058 
1059 #endif
1060 
1061 
ScaleMethod
Scale methods.
Definition: qgis.h:197
MarkerShape
Marker shapes.
Definition: qgis.h:1042
Exports QGIS layers to the DXF format.
Definition: qgsdxfexport.h:65
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgsfillsymbol.h:30
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
~QgsFilledMarkerSymbolLayer() override
~QgsFontMarkerSymbolLayer() override
void setStrokeColor(const QColor &color) override
Sets the stroke color for the symbol layer.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
double strokeWidth() const
Returns the marker's stroke width.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the stroke width unit.
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
void setStrokeWidth(double width)
Set's the marker's stroke width.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
QString character() const
Returns the character(s) used when rendering points.
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QgsMapUnitScale mapUnitScale() const override
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Resolves relative paths into absolute paths and vice versa.
Raster marker symbol layer class.
void setOpacity(double opacity)
Set the marker opacity.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
~QgsRasterMarkerSymbolLayer() override
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
double opacity() const
Returns the marker opacity.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Abstract base class for simple marker symbol layers.
Qgis::MarkerShape mShape
Symbol shape.
QPainterPath mPath
Painter path representing shape. If mPolygon is empty then the shape is stored in mPath.
~QgsSimpleMarkerSymbolLayerBase() override
QPolygonF mPolygon
Polygon of points in shape. If polygon is empty then shape is using mPath.
Qgis::MarkerShape shape() const
Returns the shape for the rendered marker symbol.
void setShape(Qgis::MarkerShape shape)
Sets the rendered marker shape.
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
QPen mSelPen
QPen to use as stroke of selected symbols.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit u)
Sets the unit for the width of the marker's stroke.
QColor mStrokeColor
Stroke color.
QImage mSelCache
Cached image of selected marker, if using cached version.
QImage mCache
Cached image of marker, if using cached version.
QBrush mSelBrush
QBrush to use as fill of selected symbols.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
Qt::PenJoinStyle penJoinStyle() const
Returns the marker's stroke join style (e.g., miter, bevel, etc).
QPen mPen
QPen corresponding to marker's stroke style.
~QgsSimpleMarkerSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the marker's stroke cap style (e.g., flat, round, etc).
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker's stroke.
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker's stroke style (e.g., solid, dashed, etc)
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker's stroke.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
QColor strokeColor() const override
Returns the marker's stroke color.
QBrush mBrush
QBrush corresponding to marker's fill style.
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
Qt::PenStyle strokeStyle() const
Returns the marker's stroke style (e.g., solid, dashed, etc)
void setPenCapStyle(Qt::PenCapStyle style)
Sets the marker's stroke cap style (e.g., flat, round, etc).
QgsMapUnitScale mStrokeWidthMapUnitScale
Stroke width map unit scale.
double strokeWidth() const
Returns the width of the marker's stroke.
Qt::PenJoinStyle mPenJoinStyle
Stroke pen join style.
QColor fillColor() const override
Returns the fill color for the symbol layer.
QgsUnitTypes::RenderUnit mStrokeWidthUnit
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
QMap< QString, QgsProperty > mParameters
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the stroke width.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setStrokeColor(const QColor &c) override
Sets the stroke color for the symbol layer.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
QMap< QString, QgsProperty > parameters() const
Returns the dynamic SVG parameters.
~QgsSvgMarkerSymbolLayer() override
QgsMapUnitScale mStrokeWidthMapUnitScale
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
virtual void prepareExpressions(const QgsSymbolRenderContext &context)
Prepares all data defined property expressions for evaluation.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38
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
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 SIP_FORCE
Definition: qgis_sip.h:131
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define DEFAULT_SVGMARKER_ANGLE
#define DEFAULT_SIMPLEMARKER_JOINSTYLE
#define DEFAULT_FONTMARKER_CHR
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR
#define DEFAULT_SIMPLEMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_ANGLE
#define DEFAULT_SVGMARKER_SIZE
#define DEFAULT_FONTMARKER_FONT
#define DEFAULT_FONTMARKER_ANGLE
#define DEFAULT_FONTMARKER_COLOR
#define DEFAULT_FONTMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_COLOR
#define DEFAULT_SCALE_METHOD