QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmasksymbollayer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmasksymbollayer.h
3  ---------------------
4  begin : July 2019
5  copyright : (C) 2019 by Hugo Mercier
6  email : hugo dot mercier at oslandia 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 QGSMASKSYMBOLLAYER_H
17 #define QGSMASKSYMBOLLAYER_H
18 
19 #include "qgis_core.h"
20 #include "qgis.h"
21 #include "qgssymbollayer.h"
22 
23 class QgsPaintEffect;
24 class QgsMarkerSymbol;
26 
35 {
36  public:
39 
40  ~QgsMaskMarkerSymbolLayer() override;
41 
49  static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
50 
51  QgsMaskMarkerSymbolLayer *clone() const override SIP_FACTORY;
52  QgsSymbol *subSymbol() override;
53  bool setSubSymbol( QgsSymbol *symbol SIP_TRANSFER ) override;
54  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
55  bool hasDataDefinedProperties() const override;
56 
57  QVariantMap properties() const override;
58 
59  QString layerType() const override;
60  void startRender( QgsSymbolRenderContext &context ) override;
61  void stopRender( QgsSymbolRenderContext &context ) override;
62  void renderPoint( QPointF point, QgsSymbolRenderContext &context ) override;
63  QRectF bounds( QPointF point, QgsSymbolRenderContext &context ) override;
64  bool usesMapUnits() const override;
65  void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
66  QColor color() const override;
67 
68  virtual void drawPreviewIcon( QgsSymbolRenderContext &context, QSize size ) override;
69 
71  bool enabled() const;
72 
78  QList<QgsSymbolLayerReference> masks() const override;
79 
85  void setMasks( const QList<QgsSymbolLayerReference> &maskedLayers );
86 
87  private:
88 #ifdef SIP_RUN
90 #endif
91 
93  std::unique_ptr<QgsMarkerSymbol> mSymbol;
94 
96  QList<QgsSymbolLayerReference> mMaskedSymbolLayers;
97 
98  std::unique_ptr<QgsPaintEffect> mEffect;
99 };
100 
101 #endif
102 
103 
QgsSymbolLayer::enabled
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
Definition: qgssymbollayer.h:242
QgsSymbolLayer::masks
virtual QList< QgsSymbolLayerReference > masks() const
Returns masks defined by this symbol layer.
Definition: qgssymbollayer.cpp:905
QgsUnitTypes::RenderUnit
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:167
QgsSymbolLayer::subSymbol
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
Definition: qgssymbollayer.cpp:154
QgsSymbolLayerReference
Type used to refer to a specific symbol layer in a symbol of a layer.
Definition: qgssymbollayerreference.h:133
QgsSymbolLayer::hasDataDefinedProperties
virtual bool hasDataDefinedProperties() const
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
Definition: qgssymbollayer.cpp:287
QgsMarkerSymbolLayer::startRender
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
Definition: qgssymbollayer.cpp:528
qgis.h
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsMarkerSymbolLayer
Abstract base class for marker symbol layers.
Definition: qgssymbollayer.h:705
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
QgsMarkerSymbolLayer::drawPreviewIcon
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
Definition: qgssymbollayer.cpp:538
QgsSymbolLayer::usesMapUnits
virtual bool usesMapUnits() const
Returns true if the symbol layer has any components which use map unit based sizes.
Definition: qgssymbollayer.cpp:313
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsSymbolRenderContext
Definition: qgssymbolrendercontext.h:35
QgsMarkerSymbolLayer::setOutputUnit
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
Definition: qgssymbollayer.cpp:691
QgsSymbolLayer::clone
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
QgsSymbolLayer
Definition: qgssymbollayer.h:54
QgsSymbolLayer::setSubSymbol
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
Definition: qgssymbollayer.cpp:159
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgsmarkersymbol.h:30
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsSymbolLayer::properties
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
qgssymbollayer.h
QgsSymbolLayer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
Definition: qgssymbollayer.cpp:328
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:52
QgsMarkerSymbolLayer::renderPoint
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QgsMarkerSymbolLayer::bounds
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
QgsSymbolLayer::layerType
virtual QString layerType() const =0
Returns a string that represents this layer type.
QgsSymbolLayer::color
virtual QColor color() const
Returns the "representative" color of the symbol layer.
Definition: qgssymbollayer.cpp:247
QgsMaskMarkerSymbolLayer
Special symbol layer that uses its sub symbol as a selective mask.
Definition: qgsmasksymbollayer.h:34
QgsMarkerSymbolLayer::stopRender
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
Definition: qgssymbollayer.cpp:533