QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgssymbollayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbollayer.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 #ifndef QGSSYMBOLLAYER_H
16 #define QGSSYMBOLLAYER_H
17 
18 #define DEG2RAD(x) ((x)*M_PI/180)
19 #define DEFAULT_SCALE_METHOD QgsSymbol::ScaleDiameter
20 
21 #include "qgis_core.h"
22 // #include "qgis.h"
23 #include <QColor>
24 #include <QMap>
25 #include <QPointF>
26 #include <QSet>
27 #include <QDomDocument>
28 #include <QDomElement>
29 
30 #include "qgssymbol.h"
31 #include "qgsfields.h"
32 #include "qgspropertycollection.h"
33 
34 class QPainter;
35 class QSize;
36 class QPolygonF;
37 
38 class QgsDxfExport;
39 class QgsExpression;
40 class QgsRenderContext;
42 
43 #ifndef SIP_RUN
44 typedef QMap<QString, QString> QgsStringMap;
45 #endif
46 
51 class CORE_EXPORT QgsSymbolLayer
52 {
53 #ifdef SIP_RUN
54 #include <qgslinesymbollayer.h>
55 #endif
56 
57 
58 #ifdef SIP_RUN
60  switch ( sipCpp->type() )
61  {
62  case QgsSymbol::Marker:
63  if ( sipCpp->layerType() == "EllipseMarker" )
64  sipType = sipType_QgsEllipseSymbolLayer;
65  else if ( sipCpp->layerType() == "FontMarker" )
66  sipType = sipType_QgsFontMarkerSymbolLayer;
67  else if ( sipCpp->layerType() == "SimpleMarker" )
68  sipType = sipType_QgsSimpleMarkerSymbolLayer;
69  else if ( sipCpp->layerType() == "FilledMarker" )
70  sipType = sipType_QgsFilledMarkerSymbolLayer;
71  else if ( sipCpp->layerType() == "SvgMarker" )
72  sipType = sipType_QgsSvgMarkerSymbolLayer;
73  else if ( sipCpp->layerType() == "RasterMarker" )
74  sipType = sipType_QgsRasterMarkerSymbolLayer;
75  else if ( sipCpp->layerType() == "VectorField" )
76  sipType = sipType_QgsVectorFieldSymbolLayer;
77  else
78  sipType = sipType_QgsMarkerSymbolLayer;
79  break;
80 
81  case QgsSymbol::Line:
82  if ( sipCpp->layerType() == "MarkerLine" )
83  sipType = sipType_QgsMarkerLineSymbolLayer;
84  else if ( sipCpp->layerType() == "SimpleLine" )
85  sipType = sipType_QgsSimpleLineSymbolLayer;
86  else if ( sipCpp->layerType() == "ArrowLine" )
87  sipType = sipType_QgsArrowSymbolLayer;
88  else
89  sipType = sipType_QgsLineSymbolLayer;
90  break;
91 
92  case QgsSymbol::Fill:
93  if ( sipCpp->layerType() == "SimpleFill" )
94  sipType = sipType_QgsSimpleFillSymbolLayer;
95  else if ( sipCpp->layerType() == "LinePatternFill" )
96  sipType = sipType_QgsLinePatternFillSymbolLayer;
97  else if ( sipCpp->layerType() == "PointPatternFill" )
98  sipType = sipType_QgsPointPatternFillSymbolLayer;
99  else if ( sipCpp->layerType() == "SVGFill" )
100  sipType = sipType_QgsSVGFillSymbolLayer;
101  else if ( sipCpp->layerType() == "RasterFill" )
102  sipType = sipType_QgsRasterFillSymbolLayer;
103  else if ( sipCpp->layerType() == "CentroidFill" )
104  sipType = sipType_QgsCentroidFillSymbolLayer;
105  else if ( sipCpp->layerType() == "GradientFill" )
106  sipType = sipType_QgsGradientFillSymbolLayer;
107  else if ( sipCpp->layerType() == "ShapeburstFill" )
108  sipType = sipType_QgsShapeburstFillSymbolLayer;
109  else
110  sipType = sipType_QgsFillSymbolLayer;
111  break;
112 
113  case QgsSymbol::Hybrid:
114  sipType = sipType_QgsGeometryGeneratorSymbolLayer;
115  break;
116  }
117  SIP_END
118 #endif
119  public:
120 
125  enum Property
126  {
127  PropertySize = 0,
180  };
181 
186  static const QgsPropertiesDefinition &propertyDefinitions();
187 
188  virtual ~QgsSymbolLayer();
189 
195  bool enabled() const { return mEnabled; }
196 
204  void setEnabled( bool enabled ) { mEnabled = enabled; }
205 
209  virtual QColor color() const { return mColor; }
210 
214  virtual void setColor( const QColor &color ) { mColor = color; }
215 
219  virtual void setStrokeColor( const QColor &color ) { Q_UNUSED( color ) }
220 
224  virtual QColor strokeColor() const { return QColor(); }
225 
229  virtual void setFillColor( const QColor &color ) { Q_UNUSED( color ) }
230 
234  virtual QColor fillColor() const { return QColor(); }
235 
240  virtual QString layerType() const = 0;
241 
242  virtual void startRender( QgsSymbolRenderContext &context ) = 0;
243  virtual void stopRender( QgsSymbolRenderContext &context ) = 0;
244 
248  virtual QgsSymbolLayer *clone() const = 0 SIP_FACTORY;
249 
250  virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const
251  { Q_UNUSED( props ) element.appendChild( doc.createComment( QStringLiteral( "SymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); }
252 
253  virtual QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const { Q_UNUSED( mmScaleFactor ) Q_UNUSED( mapUnitScaleFactor ); return QString(); }
254 
260  virtual QgsStringMap properties() const = 0;
261 
262  virtual void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) = 0;
263 
267  virtual QgsSymbol *subSymbol() { return nullptr; }
268 
270  virtual bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) { delete symbol; return false; }
271 
272  QgsSymbol::SymbolType type() const { return mType; }
273 
275  virtual bool isCompatibleWithSymbol( QgsSymbol *symbol ) const;
276 
277  void setLocked( bool locked ) { mLocked = locked; }
278  bool isLocked() const { return mLocked; }
279 
286  virtual double estimateMaxBleed( const QgsRenderContext &context ) const { Q_UNUSED( context ) return 0; }
287 
296  virtual void setOutputUnit( QgsUnitTypes::RenderUnit unit ) { Q_UNUSED( unit ) }
297 
307 
308  virtual void setMapUnitScale( const QgsMapUnitScale &scale ) { Q_UNUSED( scale ) }
309  virtual QgsMapUnitScale mapUnitScale() const { return QgsMapUnitScale(); }
310 
317  void setRenderingPass( int renderingPass );
318 
325  int renderingPass() const;
326 
331  virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
332 
340  virtual void setDataDefinedProperty( Property key, const QgsProperty &property );
341 
343  virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
344 
346  virtual double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
347 
349  virtual double dxfOffset( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const;
350 
352  virtual QColor dxfColor( QgsSymbolRenderContext &context ) const;
353 
355  virtual double dxfAngle( QgsSymbolRenderContext &context ) const;
356 
358  virtual QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit &unit ) const;
359 
361  virtual Qt::PenStyle dxfPenStyle() const;
362 
364  virtual QColor dxfBrushColor( QgsSymbolRenderContext &context ) const;
365 
367  virtual Qt::BrushStyle dxfBrushStyle() const;
368 
375  QgsPaintEffect *paintEffect() const;
376 
383  void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
384 
391  virtual void prepareExpressions( const QgsSymbolRenderContext &context );
392 
399  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
400 
406  const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } SIP_SKIP
407 
414  void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
415 
421  virtual bool hasDataDefinedProperties() const;
422 
423  protected:
424 
425  QgsSymbolLayer( QgsSymbol::SymbolType type, bool locked = false );
426 
428 
430  bool mEnabled;
431 
432  bool mLocked;
433  QColor mColor;
434  int mRenderingPass = 0;
435 
437 
438  QgsPaintEffect *mPaintEffect = nullptr;
440 
441  // Configuration of selected symbology implementation
443  static const bool SELECTION_IS_OPAQUE = true;
445  static const bool SELECT_FILL_BORDER = false;
447  static const bool SELECT_FILL_STYLE = false;
448 
453  void restoreOldDataDefinedProperties( const QgsStringMap &stringMap );
454 
459  void copyDataDefinedProperties( QgsSymbolLayer *destLayer ) const;
460 
466  void copyPaintEffect( QgsSymbolLayer *destLayer ) const;
467 
468  private:
469  static void initPropertyDefinitions();
470 
472  static QgsPropertiesDefinition sPropertyDefinitions;
473 
474 };
475 
477 
483 class CORE_EXPORT QgsMarkerSymbolLayer : public QgsSymbolLayer
484 {
485  public:
486 
489  {
493  };
494 
497  {
498  Top,
501  };
502 
503  void startRender( QgsSymbolRenderContext &context ) override;
504 
505  void stopRender( QgsSymbolRenderContext &context ) override;
506 
513  virtual void renderPoint( QPointF point, QgsSymbolRenderContext &context ) = 0;
514 
515  void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
516 
523  void setAngle( double angle ) { mAngle = angle; }
524 
529  double angle() const { return mAngle; }
530 
540  void setLineAngle( double lineAngle ) { mLineAngle = lineAngle; }
541 
549  virtual void setSize( double size ) { mSize = size; }
550 
557  double size() const { return mSize; }
558 
566  void setSizeUnit( QgsUnitTypes::RenderUnit unit ) { mSizeUnit = unit; }
567 
574  QgsUnitTypes::RenderUnit sizeUnit() const { return mSizeUnit; }
575 
583  void setSizeMapUnitScale( const QgsMapUnitScale &scale ) { mSizeMapUnitScale = scale; }
584 
591  const QgsMapUnitScale &sizeMapUnitScale() const { return mSizeMapUnitScale; }
592 
598  void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod ) { mScaleMethod = scaleMethod; }
599 
604  QgsSymbol::ScaleMethod scaleMethod() const { return mScaleMethod; }
605 
614  void setOffset( QPointF offset ) { mOffset = offset; }
615 
623  QPointF offset() const { return mOffset; }
624 
632  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
633 
640  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
641 
649  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
650 
657  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
658 
666  void setHorizontalAnchorPoint( HorizontalAnchorPoint h ) { mHorizontalAnchorPoint = h; }
667 
674  HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizontalAnchorPoint; }
675 
683  void setVerticalAnchorPoint( VerticalAnchorPoint v ) { mVerticalAnchorPoint = v; }
684 
691  VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAnchorPoint; }
692 
693  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const override;
694 
701  virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const
702  { Q_UNUSED( props ) element.appendChild( doc.createComment( QStringLiteral( "QgsMarkerSymbolLayer %1 not implemented yet" ).arg( layerType() ) ) ); }
703 
704  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
705  QgsUnitTypes::RenderUnit outputUnit() const override;
706  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
707  QgsMapUnitScale mapUnitScale() const override;
708 
715  virtual QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) = 0;
716 
717  protected:
718 
723  QgsMarkerSymbolLayer( bool locked = false );
724 
732  void markerOffset( QgsSymbolRenderContext &context, double &offsetX, double &offsetY ) const;
733 
744  void markerOffset( QgsSymbolRenderContext &context, double width, double height, double &offsetX, double &offsetY ) const SIP_PYNAME( markerOffsetWithWidthAndHeight );
745 
747  void markerOffset( QgsSymbolRenderContext &context, double width, double height,
749  double &offsetX, double &offsetY,
750  const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const SIP_PYNAME( markerOffset2 );
751 
758  static QPointF _rotatedOffset( QPointF offset, double angle );
759 
761  double mAngle = 0;
763  double mLineAngle = 0;
765  double mSize = 2.0;
771  QPointF mOffset;
779  HorizontalAnchorPoint mHorizontalAnchorPoint = HCenter;
781  VerticalAnchorPoint mVerticalAnchorPoint = VCenter;
782 
783  private:
784  static QgsMarkerSymbolLayer::HorizontalAnchorPoint decodeHorizontalAnchorPoint( const QString &str );
785  static QgsMarkerSymbolLayer::VerticalAnchorPoint decodeVerticalAnchorPoint( const QString &str );
786 };
787 
792 class CORE_EXPORT QgsLineSymbolLayer : public QgsSymbolLayer
793 {
794  public:
795 
798  {
802  };
803 
804  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
805  QgsUnitTypes::RenderUnit outputUnit() const override;
806  void setMapUnitScale( const QgsMapUnitScale &scale ) override;
807  QgsMapUnitScale mapUnitScale() const override;
808  void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
809  double dxfWidth( const QgsDxfExport &e, QgsSymbolRenderContext &context ) const override;
810 
815  virtual void renderPolyline( const QPolygonF &points, QgsSymbolRenderContext &context ) = 0;
816 
825  virtual void renderPolygonStroke( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
826 
840  virtual void setWidth( double width ) { mWidth = width; }
841 
851  virtual double width() const { return mWidth; }
852 
863  virtual double width( const QgsRenderContext &context ) const;
864 
874  double offset() const { return mOffset; }
875 
885  void setOffset( double offset ) { mOffset = offset; }
886 
893  void setOffsetUnit( QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
894 
901  QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
902 
909  void setOffsetMapUnitScale( const QgsMapUnitScale &scale ) { mOffsetMapUnitScale = scale; }
910 
917  const QgsMapUnitScale &offsetMapUnitScale() const { return mOffsetMapUnitScale; }
918 
919  // TODO QGIS 4.0 - setWidthUnit(), widthUnit(), setWidthUnitScale(), widthUnitScale()
920  // only apply to simple line symbol layers and do not belong here.
921 
927  void setWidthUnit( QgsUnitTypes::RenderUnit unit ) { mWidthUnit = unit; }
928 
933  QgsUnitTypes::RenderUnit widthUnit() const { return mWidthUnit; }
934 
935  void setWidthMapUnitScale( const QgsMapUnitScale &scale ) { mWidthMapUnitScale = scale; }
936  const QgsMapUnitScale &widthMapUnitScale() const { return mWidthMapUnitScale; }
937 
948  RenderRingFilter ringFilter() const;
949 
960  void setRingFilter( QgsLineSymbolLayer::RenderRingFilter filter );
961 
962  protected:
963  QgsLineSymbolLayer( bool locked = false );
964 
965  double mWidth = 0;
968  double mOffset = 0;
971 
972  RenderRingFilter mRingFilter = AllRings;
973 };
974 
979 class CORE_EXPORT QgsFillSymbolLayer : public QgsSymbolLayer
980 {
981  public:
982  virtual void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, QgsSymbolRenderContext &context ) = 0;
983 
984  void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
985 
986  void setAngle( double angle ) { mAngle = angle; }
987  double angle() const { return mAngle; }
988 
989  protected:
990  QgsFillSymbolLayer( bool locked = false );
992  void _renderPolygon( QPainter *p, const QPolygonF &points, const QList<QPolygonF> *rings, QgsSymbolRenderContext &context );
993 
994  double mAngle = 0.0;
995 };
996 
997 class QgsSymbolLayerWidget; // why does SIP fail, when this isn't here
998 
999 #endif
1000 
1001 
void setOffset(QPointF offset)
Sets the marker&#39;s offset, which is the horizontal and vertical displacement which the rendered marker...
Class for parsing and evaluation of expressions (formerly called "search strings").
Gradient reference point 1 is centroid.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol&#39;s offset.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol&#39;s angle.
virtual QString ogrFeatureStyle(double mmScaleFactor, double mapUnitScaleFactor) const
void setLocked(bool locked)
Gradient reference point 1 x.
Calculate scale by the diameter.
Definition: qgssymbol.h:97
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:61
virtual QgsSymbol * subSymbol()
Returns the symbol&#39;s sub symbol, if present.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the line&#39;s offset.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol&#39;s size.
Align to right side of symbol.
double angle() const
Render both exterior and interior rings.
void setAngle(double angle)
virtual QColor strokeColor() const
Gets stroke color.
Base class for visual effects which can be applied to QPicture drawings.
Container of fields for a vector layer.
Definition: qgsfields.h:42
Mixed or unknown units.
Definition: qgsunittypes.h:119
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol&#39;s offset.
VerticalAnchorPoint verticalAnchorPoint() const
Returns the vertical anchor point for positioning the symbol.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the symbol&#39;s offset.
QPointF mOffset
Marker offset.
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units for the line&#39;s offset.
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolRenderContext &context) const
Gets line width.
bool isLocked() const
Line symbol.
Definition: qgssymbol.h:86
void setScaleMethod(QgsSymbol::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker&#39;s size.
Align to horizontal center of symbol.
QMap< QString, QString > QgsStringMap
Definition: qgis.h:587
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
virtual double width() const
Returns the estimated width for the line symbol layer.
Name, eg shape name for simple markers.
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line&#39;s width.
Gradient reference point 2 y.
virtual void setColor(const QColor &color)
The fill color.
SymbolType
Type of the symbol.
Definition: qgssymbol.h:83
HorizontalAnchorPoint horizontalAnchorPoint() const
Returns the horizontal anchor point for positioning the symbol.
virtual QgsUnitTypes::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol layer.
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
Writes the symbol layer definition as a SLD XML element.
Align to bottom of symbol.
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer&#39;s subsymbol. takes ownership of the passed symbol.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
virtual void setOutputUnit(QgsUnitTypes::RenderUnit unit)
Sets the units to use for sizes and widths within the symbol layer.
QgsUnitTypes::RenderUnit widthUnit() const
Returns the units for the line&#39;s width.
#define SIP_SKIP
Definition: qgis_sip.h:119
double size() const
Returns the symbol size.
Render the interior rings only.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer&#39;s property collection, used for data defined overrides...
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol&#39;s size.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMapUnitScale mOffsetMapUnitScale
virtual QColor color() const
The fill color.
Filename, eg for svg files.
#define SIP_END
Definition: qgis_sip.h:182
Align to left side of symbol.
virtual void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size)=0
Shapeburst fill from edge distance.
QgsSymbol::SymbolType type() const
#define SIP_FACTORY
Definition: qgis_sip.h:69
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
Character, eg for font marker symbol layers.
double offset() const
Returns the line&#39;s offset.
ScaleMethod
Scale method.
Definition: qgssymbol.h:94
QMap< QString, QString > QgsStringMap
Align to top of symbol.
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
A store for object properties.
Definition: qgsproperty.h:229
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the symbol layer&#39;s property collection, used for data defined overrides...
QgsMapUnitScale mWidthMapUnitScale
RenderRingFilter
Options for filtering rings when the line symbol layer is being used to render a polygon&#39;s rings...
virtual double estimateMaxBleed(const QgsRenderContext &context) const
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when ...
HorizontalAnchorPoint
Symbol horizontal anchor points.
virtual void setStrokeColor(const QColor &color)
Set stroke color.
Gradient reference point 1 y.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
VerticalAnchorPoint
Symbol vertical anchor points.
QgsSymbol::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker&#39;s size.
Line angle, or angle of hash lines for hash line symbols.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol&#39;s size.
Marker symbol.
Definition: qgssymbol.h:85
virtual QgsMapUnitScale mapUnitScale() const
Stroke style (eg solid, dashed)
Preserve aspect ratio between width and height.
Fill symbol.
Definition: qgssymbol.h:87
Contains information about the context of a rendering operation.
Abstract base class for marker symbol layers.
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
virtual void setFillColor(const QColor &color)
Set fill color.
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
virtual void stopRender(QgsSymbolRenderContext &context)=0
Struct for storing maximum and minimum scales for measurements in map units.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol&#39;s size.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Distance between lines, or length of lines for hash line symbols.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the line&#39;s offset.
virtual void setSize(double size)
Sets the symbol size.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:165
Align to vertical center of symbol.
Secondary color (eg for gradient fills)
bool mEnabled
True if layer is enabled and should be drawn.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
void setAngle(double angle)
Sets the rotation angle for the marker.
const QgsMapUnitScale & widthMapUnitScale() const
Length to average symbol angles over.
Render the exterior ring only.
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
Shapeburst blur radius.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the line&#39;s offset.
QPointF offset() const
Returns the marker&#39;s offset, which is the horizontal and vertical displacement which the rendered mar...
Fill style (eg solid, dots)
virtual QColor fillColor() const
Gets fill color.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the symbol&#39;s offset.
QgsFields mFields
Whether symbol layer is enabled.
Hybrid symbol.
Definition: qgssymbol.h:88
Gradient reference point 2 is centroid.
QgsSymbol::SymbolType mType
Gradient reference point 2 x.
QgsPropertyCollection mDataDefinedProperties
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol layer&#39;s property collection, used for data defined overrides.
Property
Data definable properties.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:111
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74
void setOffset(double offset)
Sets the line&#39;s offset.
virtual void startRender(QgsSymbolRenderContext &context)=0
Horizontal distance between points.
virtual QString layerType() const =0
Returns a string that represents this layer type.
Vertical distance between points.