| 
    QGIS API Documentation
    3.14.0-Pi (9f7028fd23)
    
   | 
 
 
 
 
Go to the documentation of this file.
   23   QString expression = 
properties.value( QStringLiteral( 
"geometryModifier" ) );
 
   24   if ( expression.isEmpty() )
 
   26     expression = QStringLiteral( 
"$geometry" );
 
   30   if ( 
properties.value( QStringLiteral( 
"SymbolType" ) ) == QLatin1String( 
"Marker" ) )
 
   34   else if ( 
properties.value( QStringLiteral( 
"SymbolType" ) ) == QLatin1String( 
"Line" ) )
 
   47 QgsGeometryGeneratorSymbolLayer::QgsGeometryGeneratorSymbolLayer( 
const QString &expression )
 
   57   return QStringLiteral( 
"GeometryGenerator" );
 
   66     mSymbol = mFillSymbol.get();
 
   72     mSymbol = mLineSymbol.get();
 
   78     mSymbol = mMarkerSymbol.get();
 
  101   mRenderingFeature = 
true;
 
  102   mHasRenderedFeature = 
false;
 
  107   mRenderingFeature = 
false;
 
  115     clone->mFillSymbol.reset( mFillSymbol->clone() );
 
  117     clone->mLineSymbol.reset( mLineSymbol->clone() );
 
  119     clone->mMarkerSymbol.reset( mMarkerSymbol->clone() );
 
  121   clone->setSymbolType( mSymbolType );
 
  132   props.insert( QStringLiteral( 
"geometryModifier" ), mExpression->expression() );
 
  133   switch ( mSymbolType )
 
  136       props.insert( QStringLiteral( 
"SymbolType" ), QStringLiteral( 
"Marker" ) );
 
  139       props.insert( QStringLiteral( 
"SymbolType" ), QStringLiteral( 
"Line" ) );
 
  142       props.insert( QStringLiteral( 
"SymbolType" ), QStringLiteral( 
"Fill" ) );
 
  161   switch ( symbol->
type() )
 
  188          + mExpression->referencedColumns();
 
  206   if ( mRenderingFeature && mHasRenderedFeature )
 
  219     subSymbolExpressionContextScope->
setFeature( f );
 
  223     if ( mRenderingFeature )
 
  224       mHasRenderedFeature = 
true;
 
  
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the scope.
 
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
 
QString layerType() const override
Returns a string that represents this layer type.
 
QgsExpressionContext & expressionContext()
Gets the expression context.
 
const QgsFeature * feature() const
Returns the current feature being rendered.
 
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
 
virtual QColor color() const
The fill color.
 
static QgsMarkerSymbol * createSimple(const QgsStringMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
 
void setSymbolType(QgsSymbol::SymbolType symbolType)
Set the type of symbol which should be created.
 
void setColor(const QColor &color) override
The fill color.
 
const QgsLegendPatchShape * patchShape() const
Returns the symbol patch shape, to use if rendering symbol preview icons.
 
void startFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called before the layer will be rendered for a particular feature.
 
bool selected() const
Returns true if symbols should be rendered using the selected symbol coloring and style.
 
QgsExpressionContextScope * expressionContextScope()
This scope is always available when a symbol of this type is being rendered.
 
void stopRender(QgsRenderContext &context)
Ends the rendering process.
 
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
 
QgsSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
 
void renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false, int currentVertexMarkerType=0, double currentVertexMarkerSize=0.0) SIP_THROW(QgsCsException)
Render a feature.
 
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
 
~QgsGeometryGeneratorSymbolLayer() override
 
void startRender(QgsRenderContext &context, const QgsFields &fields=QgsFields())
Begins the rendering process for the symbol.
 
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties.
 
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
 
bool isCompatibleWithSymbol(QgsSymbol *symbol) const override
Will always return true.
 
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
 
Single scope for storing variables and functions for use within a QgsExpressionContext....
 
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
 
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
 
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
 
void stopFeatureRender(const QgsFeature &feature, QgsRenderContext &context) override
Called after the layer has been rendered for a particular feature.
 
QMap< QString, QString > QgsStringMap
 
void setColor(const QColor &color)
Sets the color for the symbol.
 
virtual void render(QgsSymbolRenderContext &context)
Will render this symbol layer using the context.
 
void drawPreviewIcon(QPainter *painter, QSize size, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr, const QgsLegendPatchShape *patchShape=nullptr)
Draws an icon of the symbol that occupies an area given by size using the specified painter.
 
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
 
static QgsLineSymbol * createSimple(const QgsStringMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties.
 
QgsFeature feature() const
Convenience function for retrieving the feature for the context, if set.
 
QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns a list of attributes required to render this feature.
 
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
 
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
 
SymbolType type() const
Returns the symbol's type.
 
void restoreOldDataDefinedProperties(const QgsStringMap &stringMap)
Restores older data defined properties from string map.
 
static QgsFillSymbol * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
 
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
 
SymbolType
Type of the symbol.
 
static QgsSymbolLayer * create(const QgsStringMap &properties)
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
QgsSymbol::SymbolType symbolType() const
Access the symbol type.
 
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.