28 QString expression = properties.value( QStringLiteral(
"geometryModifier" ) );
29 if ( expression.isEmpty() )
31 expression = QStringLiteral(
"$geometry" );
35 if ( properties.value( QStringLiteral(
"SymbolType" ) ) == QLatin1String(
"Marker" ) )
39 else if ( properties.value( QStringLiteral(
"SymbolType" ) ) == QLatin1String(
"Line" ) )
52 QgsGeometryGeneratorSymbolLayer::QgsGeometryGeneratorSymbolLayer(
const QString &expression )
62 return QStringLiteral(
"GeometryGenerator" );
71 mSymbol = mFillSymbol;
77 mSymbol = mLineSymbol;
83 mSymbol = mMarkerSymbol;
109 clone->mFillSymbol = mFillSymbol->
clone();
111 clone->mLineSymbol = mLineSymbol->
clone();
113 clone->mMarkerSymbol = mMarkerSymbol->
clone();
126 props.insert( QStringLiteral(
"geometryModifier" ), mExpression->expression() );
127 switch ( mSymbolType )
130 props.insert( QStringLiteral(
"SymbolType" ), QStringLiteral(
"Marker" ) );
133 props.insert( QStringLiteral(
"SymbolType" ), QStringLiteral(
"Line" ) );
136 props.insert( QStringLiteral(
"SymbolType" ), QStringLiteral(
"Fill" ) );
155 switch ( symbol->
type() )
182 + mExpression->referencedColumns();
210 subSymbolExpressionContextScope->
setFeature( f );
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
Class for parsing and evaluation of expressions (formerly called "search strings").
void drawPreviewIcon(QgsSymbolRenderContext &context, QSize size) override
Abstract base class for all rendered symbols.
static QgsLineSymbol * createSimple(const QgsStringMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties. ...
static QgsFillSymbol * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties. ...
void startRender(QgsSymbolRenderContext &context) override
~QgsGeometryGeneratorSymbolLayer() override
void stopRender(QgsSymbolRenderContext &context) override
A geometry is the spatial representation of a feature.
virtual void render(QgsSymbolRenderContext &context)
Will render this symbol layer using the context.
void restoreOldDataDefinedProperties(const QgsStringMap &stringMap)
Restores older data defined properties from string map.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QMap< QString, QString > QgsStringMap
A marker symbol type, for rendering Point and MultiPoint geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
void startRender(QgsRenderContext &context, const QgsFields &fields=QgsFields())
Begins the rendering process for the symbol.
QgsSymbol::SymbolType symbolType() const
Access the symbol type.
QgsSymbolLayer(QgsSymbol::SymbolType type, bool locked=false)
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns the set of attributes referenced by the layer.
SymbolType
Type of the symbol.
QString layerType() const override
Returns a string that represents this layer type.
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool setSubSymbol(QgsSymbol *symbol) override
Sets layer's subsymbol. takes ownership of the passed symbol.
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void drawPreviewIcon(QPainter *painter, QSize size, QgsRenderContext *customContext=nullptr)
Draws an icon of the symbol that occupies an area given by size using the specified painter...
QgsFeature feature() const
Convenience function for retrieving the feature for the context, if set.
void setSymbolType(QgsSymbol::SymbolType symbolType)
Set the type of symbol which should be created.
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the scope.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
QgsExpressionContext & expressionContext()
Gets the expression context.
bool hasDataDefinedProperties() const override
Returns true if the symbol layer (or any of its sub-symbols) contains data defined properties...
Contains information about the context of a rendering operation.
QPainter * painter()
Returns the destination QPainter for the render operation.
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
void setColor(const QColor &color) override
The fill color.
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.
static QgsSymbolLayer * create(const QgsStringMap &properties)
bool isCompatibleWithSymbol(QgsSymbol *symbol) const override
Will always return true.
QgsSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
const QgsFeature * feature() const
Current feature being rendered - may be null.
SymbolType type() const
Returns the symbol's type.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
static QgsMarkerSymbol * createSimple(const QgsStringMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns a list of attributes required to render this feature.
virtual QColor color() const
The fill color.
void stopRender(QgsRenderContext &context)
Ends the rendering process.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
void setColor(const QColor &color)
Sets the color for the symbol.
QgsExpressionContextScope * expressionContextScope()
This scope is always available when a symbol of this type is being rendered.