QGIS API Documentation  3.17.0-Master (a84647cf30)
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 
44 {
45  public:
46 
48  enum Shape
49  {
56  Star,
62  Line,
73  };
74 
76  static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes();
77 
83  static bool shapeIsFilled( QgsSimpleMarkerSymbolLayerBase::Shape shape );
84 
93  double size = DEFAULT_SIMPLEMARKER_SIZE,
96 
101  QgsSimpleMarkerSymbolLayerBase::Shape shape() const { return mShape; }
102 
108  void setShape( QgsSimpleMarkerSymbolLayerBase::Shape shape ) { mShape = shape; }
109 
118  static QgsSimpleMarkerSymbolLayerBase::Shape decodeShape( const QString &name, bool *ok = nullptr );
119 
126  static QString encodeShape( QgsSimpleMarkerSymbolLayerBase::Shape shape );
127 
128  void startRender( QgsSymbolRenderContext &context ) override;
129  void stopRender( QgsSymbolRenderContext &context ) override;
130  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
131  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
132 
133  protected:
134 
138  bool prepareMarkerShape( Shape shape );
139 
143  bool prepareMarkerPath( Shape symbol );
144 
151  bool shapeToPolygon( Shape shape, QPolygonF &polygon ) const;
152 
159  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
160 
169  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
170 
172  QPolygonF mPolygon;
173 
175  QPainterPath mPath;
176 
179 
180  private:
181 
190  virtual void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
191 };
192 
199 {
200  public:
201 
213  double size = DEFAULT_SIMPLEMARKER_SIZE,
216  const QColor &color = DEFAULT_SIMPLEMARKER_COLOR,
217  const QColor &strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR,
218  Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE );
219 
220  // static methods
221 
227  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
228 
234  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
235 
236  // reimplemented from base classes
237 
238  QString layerType() const override;
239  void startRender( QgsSymbolRenderContext &context ) override;
240  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
241  QVariantMap properties() const override;
242  QgsSimpleMarkerSymbolLayer *clone() const override SIP_FACTORY;
243  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
244  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const override;
245  bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
246  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
247  QgsUnitTypes::RenderUnit outputUnit() const override;
248  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
249  QgsMapUnitScale mapUnitScale() const override;
250  bool usesMapUnits() const override;
251  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
252  QColor fillColor() const override { return mColor; }
253  void setFillColor( const QColor &color ) override { mColor = color; }
254  void setColor( const QColor &color ) override;
255  QColor color() const override;
256 
257  // new methods
258 
265  QColor strokeColor() const override { return mStrokeColor; }
266 
274  void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
275 
283  Qt::PenStyle strokeStyle() const { return mStrokeStyle; }
284 
293  void setStrokeStyle( Qt::PenStyle strokeStyle ) { mStrokeStyle = strokeStyle; }
294 
302  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
303 
312  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
313 
320  double strokeWidth() const { return mStrokeWidth; }
321 
329  void setStrokeWidth( double w ) { mStrokeWidth = w; }
330 
338  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit u ) { mStrokeWidthUnit = u; }
339 
346  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
347 
355  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
356 
363  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
364 
365  protected:
366 
373  void drawMarker( QPainter *p, QgsSymbolRenderContext &context );
374 
379  bool prepareCache( QgsSymbolRenderContext &context );
380 
382  QColor mStrokeColor;
384  Qt::PenStyle mStrokeStyle = Qt::SolidLine;
386  double mStrokeWidth = 0;
392  Qt::PenJoinStyle mPenJoinStyle;
394  QPen mPen;
396  QBrush mBrush;
397 
399  QImage mCache;
401  QPen mSelPen;
403  QBrush mSelBrush;
405  QImage mSelCache;
406 
411  bool mUsingCache = false;
412 
414  static const int MAXIMUM_CACHE_WIDTH = 3000;
415 
416  private:
417  // cppcheck-suppress unusedPrivateFunction
418  void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
419 
420  double mCachedOpacity = 1.0;
421 
422 };
423 
432 {
433  public:
434 
443  double size = DEFAULT_SIMPLEMARKER_SIZE,
446 
452  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
453 
454  QString layerType() const override;
455  void startRender( QgsSymbolRenderContext &context ) override;
456  void stopRender( QgsSymbolRenderContext &context ) override;
457  QVariantMap properties() const override;
458  QgsFilledMarkerSymbolLayer *clone() const override SIP_FACTORY;
459  QgsSymbol *subSymbol() override;
460  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
461  double estimateMaxBleed( const QgsRenderContext &context ) const override;
462  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
463  bool hasDataDefinedProperties() const override;
464  void setColor( const QColor &c ) override;
465  QColor color() const override;
466  bool usesMapUnits() const override;
467 
468  private:
469 #ifdef SIP_RUN
471 #endif
472 
473  // cppcheck-suppress unusedPrivateFunction
474  void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
475 
477  std::unique_ptr< QgsFillSymbol > mFill;
478 };
479 
481 
482 #define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE
483 #define DEFAULT_SVGMARKER_ANGLE 0
484 
490 {
491  public:
493  QgsSvgMarkerSymbolLayer( const QString &path,
494  double size = DEFAULT_SVGMARKER_SIZE,
497 
498  // static stuff
499 
501  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
502  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
503 
509  static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
510 
511  // implemented from base classes
512 
513  QString layerType() const override;
514 
515  void startRender( QgsSymbolRenderContext &context ) override;
516 
517  void stopRender( QgsSymbolRenderContext &context ) override;
518 
519  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
520 
521  QVariantMap properties() const override;
522  bool usesMapUnits() const override;
523 
524  QgsSvgMarkerSymbolLayer *clone() const override SIP_FACTORY;
525 
526  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
527 
532  QString path() const { return mPath; }
533 
539  void setPath( const QString &path );
540 
545  double defaultAspectRatio() const { return mDefaultAspectRatio; }
546 
552  double updateDefaultAspectRatio();
553 
558  bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
559 
566  bool setPreservedAspectRatio( bool par );
567 
573  double fixedAspectRatio() const { return mFixedAspectRatio; }
574 
581  void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
582 
583  QColor fillColor() const override { return color(); }
584  void setFillColor( const QColor &color ) override { setColor( color ); }
585 
586  QColor strokeColor() const override { return mStrokeColor; }
587  void setStrokeColor( const QColor &c ) override { mStrokeColor = c; }
588 
589  double strokeWidth() const { return mStrokeWidth; }
590  void setStrokeWidth( double w ) { mStrokeWidth = w; }
591 
596  QMap<QString, QgsProperty> parameters() const { return mParameters; }
597 
602  void setParameters( const QMap<QString, QgsProperty> &parameters );
603 
609  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
610 
615  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
616 
617  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
618  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
619 
620  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
621  QgsUnitTypes::RenderUnit outputUnit() const override;
622 
623  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
624  QgsMapUnitScale mapUnitScale() const override;
625 
626  bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
627 
628  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
629 
630  void prepareExpressions( const QgsSymbolRenderContext &context ) override;
631 
632  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
633 
634  protected:
635 
642  double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
643 
644  QString mPath;
645 
647  double mDefaultAspectRatio = 0.0;
649  double mFixedAspectRatio = 0.0;
650  //param(fill), param(stroke), param(stroke-width) are going
651  //to be replaced in memory
652  bool mHasFillParam = false;
653  QColor mStrokeColor;
654  double mStrokeWidth;
655  QMap<QString, QgsProperty> mParameters;
656 
659 
660  private:
661  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
662  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
663 
664 };
665 
666 
668 
669 #define DEFAULT_RASTERMARKER_SIZE 2*DEFAULT_POINT_SIZE
670 #define DEFAULT_RASTERMARKER_ANGLE 0
671 
679 {
680  public:
682  QgsRasterMarkerSymbolLayer( const QString &path = QString(),
683  double size = DEFAULT_SVGMARKER_SIZE,
686 
687  // static stuff
688 
693  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
694 
700  static void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
701 
702  // implemented from base classes
703 
704  QString layerType() const override;
705 
706  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
707 
708  QVariantMap properties() const override;
709 
710  QgsRasterMarkerSymbolLayer *clone() const override SIP_FACTORY;
711  bool usesMapUnits() const override;
712 
719  double calculateAspectRatio( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedAspectRatio ) const;
720 
725  QString path() const { return mPath; }
726 
732  void setPath( const QString &path );
733 
739  double opacity() const { return mOpacity; }
740 
746  void setOpacity( double opacity ) { mOpacity = opacity; }
747 
752  double defaultAspectRatio() const { return mDefaultAspectRatio; }
753 
759  double updateDefaultAspectRatio();
760 
765  bool preservedAspectRatio() const { return mFixedAspectRatio <= 0.0; }
766 
773  bool setPreservedAspectRatio( bool par );
774 
780  double fixedAspectRatio() const { return mFixedAspectRatio; }
781 
788  void setFixedAspectRatio( double ratio ) { mFixedAspectRatio = ratio; }
789 
790  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
791  QgsMapUnitScale mapUnitScale() const override;
792 
793  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
794 
795  protected:
796 
797  QString mPath;
799  double mOpacity = 1.0;
801  double mDefaultAspectRatio = 0.0;
803  double mFixedAspectRatio = 0.0;
804 
805  private:
806  double calculateSize( QgsSymbolRenderContext &context, bool &hasDataDefinedSize ) const;
807  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledWidth, double scaledHeight, QPointF &offset, double &angle ) const;
808 
809 };
810 
811 
813 
814 #define POINT2MM(x) ( (x) * 25.4 / 72 ) // point is 1/72 of inch
815 #define MM2POINT(x) ( (x) * 72 / 25.4 )
816 
817 #define DEFAULT_FONTMARKER_FONT "Dingbats"
818 #define DEFAULT_FONTMARKER_CHR QChar('A')
819 #define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
820 #define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
821 #define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
822 #define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
823 #define DEFAULT_FONTMARKER_ANGLE 0
824 
830 {
831  public:
832 
834  QgsFontMarkerSymbolLayer( const QString &fontFamily = DEFAULT_FONTMARKER_FONT,
835  QString chr = DEFAULT_FONTMARKER_CHR,
836  double pointSize = DEFAULT_FONTMARKER_SIZE,
837  const QColor &color = DEFAULT_FONTMARKER_COLOR,
838  double angle = DEFAULT_FONTMARKER_ANGLE );
839 
840  // static stuff
841 
845  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
846 
850  static QgsSymbolLayer *createFromSld( QDomElement &element ) SIP_FACTORY;
851 
852  // implemented from base classes
853 
854  QString layerType() const override;
855 
856  void startRender( QgsSymbolRenderContext &context ) override;
857 
858  void stopRender( QgsSymbolRenderContext &context ) override;
859 
860  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
861 
862  QVariantMap properties() const override;
863 
864  QgsFontMarkerSymbolLayer *clone() const override SIP_FACTORY;
865 
866  void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
867  bool usesMapUnits() const override;
868 
869  // new methods
870 
876  QString fontFamily() const { return mFontFamily; }
877 
883  void setFontFamily( const QString &family ) { mFontFamily = family; }
884 
891  QString fontStyle() const { return mFontStyle; }
892 
899  void setFontStyle( const QString &style ) { mFontStyle = style; }
900 
906  QString character() const { return mString; }
907 
913  void setCharacter( QString chr ) { mString = chr; }
914 
915  QColor strokeColor() const override { return mStrokeColor; }
916  void setStrokeColor( const QColor &color ) override { mStrokeColor = color; }
917 
927  double strokeWidth() const { return mStrokeWidth; }
928 
938  void setStrokeWidth( double width ) { mStrokeWidth = width; }
939 
949  QgsUnitTypes::RenderUnit strokeWidthUnit() const { return mStrokeWidthUnit; }
950 
959  void setStrokeWidthUnit( QgsUnitTypes::RenderUnit unit ) { mStrokeWidthUnit = unit; }
960 
970  const QgsMapUnitScale &strokeWidthMapUnitScale() const { return mStrokeWidthMapUnitScale; }
971 
981  void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale ) { mStrokeWidthMapUnitScale = scale; }
982 
990  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
991 
999  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
1000 
1001  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
1002 
1003  private:
1004 
1005  QString mFontFamily;
1006  QString mFontStyle;
1007  QFont mFont;
1008  std::unique_ptr< QFontMetrics >mFontMetrics;
1009 
1010  QString mString;
1011 
1012  double mChrWidth = 0;
1013  QPointF mChrOffset;
1014  double mOrigSize;
1015 
1016  QColor mStrokeColor;
1017  double mStrokeWidth;
1018  QgsUnitTypes::RenderUnit mStrokeWidthUnit;
1019  QgsMapUnitScale mStrokeWidthMapUnitScale;
1020  Qt::PenJoinStyle mPenJoinStyle;
1021 
1022  QPen mPen;
1023  QBrush mBrush;
1024 
1025  bool mUseCachedPath = false;
1026  QPainterPath mCachedPath;
1027 
1028  // If font has a zero (or nearly zero) size, we skip rendering altogether..
1029  bool mNonZeroFontSize = true;
1030 
1031  QString characterToRender( QgsSymbolRenderContext &context, QPointF &charOffset, double &charWidth );
1032  void calculateOffsetAndRotation( QgsSymbolRenderContext &context, double scaledSize, bool &hasDataDefinedRotation, QPointF &offset, double &angle ) const;
1033  double calculateSize( QgsSymbolRenderContext &context );
1034 };
1035 
1036 // clazy:excludeall=qstring-allocations
1037 
1038 #endif
1039 
1040 
#define DEFAULT_SIMPLEMARKER_SIZE
QgsMapUnitScale mapUnitScale() const override
QRectF bounds(QPointF point, QgsSymbolRenderContext &context) override
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const
Writes the symbol layer definition as a SLD XML element.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker&#39;s stroke join style (e.g., miter, bevel, etc).
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
QColor mStrokeColor
Stroke color.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:64
QString fontFamily() const
Returns the font family name for the associated font which will be used to render the point...
virtual QgsSymbol * subSymbol()
Returns the symbol&#39;s sub symbol, if present.
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit u)
Sets the unit for the width of the marker&#39;s stroke.
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker&#39;s stroke style (e.g., solid, dashed, etc)
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke...
Abstract base class for simple marker symbol layers.
virtual void prepareExpressions(const QgsSymbolRenderContext &context)
Prepares all data defined property expressions for evaluation.
Right facing arrow head (unfilled, lines only)
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
QgsMapUnitScale mStrokeWidthMapUnitScale
Stroke width map unit scale.
void setStrokeColor(const QColor &color) override
Sets the marker&#39;s stroke color.
void setStrokeColor(const QColor &c) override
Set stroke color.
void setStrokeWidth(double w)
Sets the width of the marker&#39;s stroke.
#define DEFAULT_FONTMARKER_COLOR
QBrush mSelBrush
QBrush to use as fill of selected symbols.
void setStrokeWidth(double width)
Set&#39;s the marker&#39;s stroke width.
QColor strokeColor() const override
Returns the marker&#39;s stroke color.
#define DEFAULT_SIMPLEMARKER_JOINSTYLE
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
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 renderPoint(QPointF point, QgsSymbolRenderContext &context) override
Renders a marker at the specified point.
QString path() const
Returns the marker SVG path.
#define DEFAULT_FONTMARKER_SIZE
QColor strokeColor() const override
Gets stroke color.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
double strokeWidth() const
Returns the width of the marker&#39;s stroke.
QPainterPath mPath
Painter path representing shape. If mPolygon is empty then the shape is stored in mPath...
Diagonal half square (bottom left half)
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.
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
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
One third circle (top left third)
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the stroke width.
QMap< QString, QgsProperty > mParameters
Raster marker symbol layer class.
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer&#39;s subsymbol. takes ownership of the passed symbol.
void setStrokeColor(const QColor &color) override
Set stroke color.
double opacity() const
Returns the marker opacity.
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
QPen mPen
QPen corresponding to marker&#39;s stroke style.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker&#39;s stroke.
#define DEFAULT_SCALE_METHOD
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0...
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker&#39;s stroke.
QBrush mBrush
QBrush corresponding to marker&#39;s fill style.
QgsMapUnitScale mStrokeWidthMapUnitScale
#define SIP_FORCE
Definition: qgis_sip.h:131
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
virtual QColor color() const
The fill color.
void setFillColor(const QColor &color) override
Set fill color.
QColor fillColor() const override
Gets fill color.
#define DEFAULT_FONTMARKER_ANGLE
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the stroke width unit.
#define SIP_FACTORY
Definition: qgis_sip.h:76
Qt::PenJoinStyle penJoinStyle() const
Returns the marker&#39;s stroke join style (e.g., miter, bevel, etc).
ScaleMethod
Scale method.
Definition: qgssymbol.h:97
QgsSimpleMarkerSymbolLayerBase::Shape shape() const
Returns the shape for the rendered marker symbol.
void setOpacity(double opacity)
Set the marker opacity.
QPen mSelPen
QPen to use as stroke of selected symbols.
QString path() const
Returns the marker raster image path.
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
Qt::PenStyle strokeStyle() const
Returns the marker&#39;s stroke style (e.g., solid, dashed, etc)
QString character() const
Returns the character(s) used when rendering points.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
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.
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker&#39;s stroke.
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR
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.
Abstract base class for marker symbol layers.
void setShape(QgsSimpleMarkerSymbolLayerBase::Shape shape)
Sets the rendered marker shape.
QgsUnitTypes::RenderUnit mStrokeWidthUnit
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0...
QImage mCache
Cached image of marker, if using cached version.
Struct for storing maximum and minimum scales for measurements in map units.
void setMapUnitScale(const QgsMapUnitScale &scale) override
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
#define DEFAULT_SIMPLEMARKER_ANGLE
#define DEFAULT_SIMPLEMARKER_COLOR
Qt::PenJoinStyle mPenJoinStyle
Stroke pen join style.
double strokeWidth() const
Returns the marker&#39;s stroke width.
QColor fillColor() const override
Gets fill color.
QImage mSelCache
Cached image of selected marker, if using cached version.
#define DEFAULT_FONTMARKER_CHR
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsUnitTypes::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setFillColor(const QColor &color) override
Set fill color.
QColor strokeColor() const override
Gets stroke color.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
Resolves relative paths into absolute paths and vice versa.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
#define DEFAULT_SVGMARKER_SIZE
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
#define DEFAULT_SVGMARKER_ANGLE
Rotated cross (lines only), "x" shape.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
QPolygonF mPolygon
Polygon of points in shape. If polygon is empty then shape is using mPath.
#define DEFAULT_FONTMARKER_FONT
QMap< QString, QgsProperty > parameters() const
Returns the dynamic SVG parameters.
virtual bool usesMapUnits() const
Returns true if the symbol layer has any components which use map unit based sizes.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:166
virtual QString layerType() const =0
Returns a string that represents this layer type.