31 expression =
"$geometry";
35 if ( properties.
value(
"SymbolType" ) ==
"Marker" )
39 else if ( properties.
value(
"SymbolType" ) ==
"Line" )
51 QgsGeometryGeneratorSymbolLayerV2::QgsGeometryGeneratorSymbolLayerV2(
const QString&
expression )
54 , mFillSymbol(
nullptr )
55 , mLineSymbol(
nullptr )
56 , mMarkerSymbol(
nullptr )
65 return "GeometryGenerator";
74 mSymbol = mFillSymbol;
80 mSymbol = mLineSymbol;
86 mSymbol = mMarkerSymbol;
112 clone->mFillSymbol = mFillSymbol->
clone();
114 clone->mLineSymbol = mLineSymbol->
clone();
116 clone->mMarkerSymbol = mMarkerSymbol->
clone();
126 props.
insert(
"geometryModifier" , mExpression->expression() );
127 switch ( mSymbolType )
130 props.
insert(
"SymbolType",
"Marker" );
133 props.
insert(
"SymbolType",
"Line" );
136 props.
insert(
"SymbolType",
"Fill" );
156 switch ( symbol->
type() )
181 return mSymbol->
usedAttributes() + mExpression->referencedColumns().toSet();
201 subSymbolExpressionContextScope->
setFeature( f );
Class for parsing and evaluation of expressions (formerly called "search strings").
bool isCompatibleWithSymbol(QgsSymbolV2 *symbol) const override
Will always return true.
static QgsMarkerSymbolV2 * createSimple(const QgsStringMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
QgsSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties)
void setSymbolType(QgsSymbolV2::SymbolType symbolType)
Set the type of symbol which should be created.
virtual QgsLineSymbolV2 * clone() const override
QSet< QString > usedAttributes() const
Return a list of attributes required to render this feature.
QgsSymbolV2::SymbolType symbolType() const
Access the symbol type.
static QgsFillSymbolV2 * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties. ...
virtual bool setSubSymbol(QgsSymbolV2 *symbol) override
set layer's subsymbol. takes ownership of the passed symbol
A geometry is the spatial representation of a feature.
virtual QgsSymbolV2 * subSymbol() override
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
QgsSymbolLayerV2(QgsSymbolV2::SymbolType type, bool locked=false)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false, int currentVertexMarkerType=0, int currentVertexMarkerSize=0)
Render a feature.
QMap< QString, QString > QgsStringMap
void drawPreviewIcon(QPainter *painter, QSize size, QgsRenderContext *customContext=nullptr)
Draw icon of the symbol that occupyies area given by size using the painter.
virtual Q_DECL_DEPRECATED QgsExpression * expression(const QString &property) const
Returns the data defined expression associated with a property.
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size) override
virtual void render(QgsSymbolV2RenderContext &context)
Will render this symbol layer using the context.
void setColor(const QColor &color)
void setGeometry(const QgsGeometry &geom)
Set this feature's geometry from another QgsGeometry object.
void startRender(QgsSymbolV2RenderContext &context) override
const QgsFeature * feature() const
Current feature being rendered - may be null.
void startRender(QgsRenderContext &context, const QgsFields *fields=nullptr)
static QgsLineSymbolV2 * createSimple(const QgsStringMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties. ...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
void stopRender(QgsSymbolV2RenderContext &context) override
QgsFeature feature() const
Convenience function for retrieving the feature for the context, if set.
virtual QColor color() const
The fill color.
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.
virtual QSet< QString > usedAttributes() const override
Returns the set of attributes referenced by the layer.
virtual QgsFillSymbolV2 * clone() const override
QgsExpressionContext & expressionContext()
Gets the expression context.
void setColor(const QColor &color) override
The fill color.
SymbolType
Type of the symbol.
QgsExpressionContextScope * expressionContextScope()
This scope is always available when a symbol of this type is being rendered.
void stopRender(QgsRenderContext &context)
QgsRenderContext & renderContext()
~QgsGeometryGeneratorSymbolLayerV2()
iterator insert(const Key &key, const T &value)
QgsSymbolV2RenderContext * symbolRenderContext()
Returns the symbol render context.
virtual QgsMarkerSymbolV2 * clone() const override
QString layerType() const override
Returns a string that represents this layer type.
const T value(const Key &key) const