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();
128 props.
insert(
"geometryModifier" , mExpression->expression() );
129 switch ( mSymbolType )
132 props.
insert(
"SymbolType",
"Marker" );
135 props.
insert(
"SymbolType",
"Line" );
138 props.
insert(
"SymbolType",
"Fill" );
158 switch ( symbol->
type() )
183 return mSymbol->
usedAttributes() + mExpression->referencedColumns().toSet();
203 subSymbolExpressionContextScope->
setFeature( f );
Class for parsing and evaluation of expressions (formerly called "search strings").
QgsSymbolV2::SymbolType symbolType() const
Access the symbol type.
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
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
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.
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)
const QgsFeature * feature() const
Current feature being rendered - may be null.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
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.
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
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
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 QColor color() const
The fill color.
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.
void copyPaintEffect(QgsSymbolLayerV2 *destLayer) const
Copies paint effect of this layer to another symbol layer.
QgsExpressionContextScope * expressionContextScope()
This scope is always available when a symbol of this type is being rendered.
void stopRender(QgsRenderContext &context)
QgsRenderContext & renderContext()
~QgsGeometryGeneratorSymbolLayerV2()
QgsFeature feature() const
Convenience function for retrieving the feature for the context, if set.
virtual Q_DECL_DEPRECATED QgsExpression * expression(const QString &property) const
Returns the data defined expression associated with a property.
iterator insert(const Key &key, const T &value)
QSet< QString > usedAttributes() const
Return a list of attributes required to render this feature.
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