141 delete( it.
value() );
208 if ( attributeIndex >= 0 )
212 return feature->
attribute( attributeIndex );
249 if ( attributeIndex >= 0 )
262 Q_UNUSED( mmMapUnitScaleFactor );
263 Q_UNUSED( layerName );
303 return Qt::SolidLine;
348 params.
insert(
"scale", scale );
350 it.
value()->setExpressionParams( params );
358 it.
value()->prepareExpression();
382 it.
value()->setExpressionParams( params );
415 if ( ddIt.
value() && ddIt.
value()->isActive() )
417 columns.
append( ddIt.
value()->referencedColumns() );
421 return columns.
toSet();
439 for ( ; propIt != stringMap.
constEnd(); ++propIt )
441 if ( propIt.
key().endsWith(
"_dd_expression" ) )
446 QString propertyName = propIt.
key().left( propIt.
key().length() - 14 );
452 else if ( propIt.
key().endsWith(
"_expression" ) )
457 QString propertyName = propIt.
key().left( propIt.
key().length() - 11 );
497 , mHorizontalAnchorPoint( HCenter )
498 , mVerticalAnchorPoint( VCenter )
532 markerOffset( context, mSize, mSize, mSizeUnit, mSizeUnit, offsetX, offsetY, mSizeMapUnitScale, mSizeMapUnitScale );
537 markerOffset( context, width, height, mSizeUnit, mSizeUnit, offsetX, offsetY, mSizeMapUnitScale, mSizeMapUnitScale );
544 offsetX = mOffset.x();
545 offsetY = mOffset.y();
551 offsetX = offset.
x();
552 offsetY = offset.
y();
570 if ( horizontalAnchorPoint == HCenter && verticalAnchorPoint == VCenter )
577 if ( horizontalAnchorPoint == Left )
579 offsetX += anchorPointCorrectionX;
581 else if ( horizontalAnchorPoint == Right )
583 offsetX -= anchorPointCorrectionX;
587 if ( verticalAnchorPoint == Top )
589 offsetY += anchorPointCorrectionY;
591 else if ( verticalAnchorPoint == Bottom )
593 offsetY -= anchorPointCorrectionY;
600 double c = cos( angle ), s = sin( angle );
601 return QPointF( offset.
x() * c - offset.
y() * s, offset.
x() * s + offset.
y() * c );
606 if ( str.
compare(
"left", Qt::CaseInsensitive ) == 0 )
610 else if ( str.
compare(
"right", Qt::CaseInsensitive ) == 0 )
622 if ( str.
compare(
"top", Qt::CaseInsensitive ) == 0 )
626 else if ( str.
compare(
"bottom", Qt::CaseInsensitive ) == 0 )
644 if ( mOffsetUnit != mSizeUnit )
653 mSizeMapUnitScale = scale;
654 mOffsetMapUnitScale = scale;
659 if ( mSizeMapUnitScale == mOffsetMapUnitScale )
661 return mSizeMapUnitScale;
678 mWidthMapUnitScale = scale;
683 return mWidthMapUnitScale;
695 renderPolyline( points, context );
701 renderPolyline( points, context );
704 Q_FOREACH (
const QPolygonF& ring, *rings )
705 renderPolyline( ring, context );
732 if ( points.
size() <= 5 &&
745 if ( !rings && p->
pen().
style() == Qt::NoPen )
760 for ( ; it != rings->
constEnd(); ++it )
774 if ( !props.
value(
"uom",
"" ).isEmpty() )
781 writeSldMarker( doc, symbolizerElem, props );
QgsSymbolV2::SymbolType mType
static double mapUnitScaleFactor(double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits, double mapUnitsPerPixel=1.0)
Returns scale factor for conversion to map units.
static const QString EXPR_DISTANCE_Y
Class for parsing and evaluation of expressions (formerly called "search strings").
static const QString EXPR_CHAR
static const QString EXPR_OUTLINE_COLOR
void markerOffset(QgsSymbolV2RenderContext &context, double &offsetX, double &offsetY) const
Calculates the required marker offset, including both the symbol offset and any displacement required...
static const QString EXPR_DISPLACEMENT_Y
virtual Qt::BrushStyle dxfBrushStyle() const
get brush/fill style
virtual void removeDataDefinedProperties()
Removes all data defined properties from the layer and deletes associated objects.
static const QString EXPR_JOINSTYLE
double rendererScale() const
Qt::PenStyle style() const
QgsSymbolV2::OutputUnit outputUnit() const override
const QgsFields * fields() const
Fields of the layer.
static QPointF _rotatedOffset(QPointF offset, double angle)
Adjusts a marker offset to account for rotation.
void setEnabled(const bool enabled)
Sets whether the effect is enabled.
OutputUnit
The unit of the output.
iterator erase(iterator pos)
A container class for data source field mapping or expression.
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Added in QGIS v2.4.
Q_DECL_DEPRECATED QVariant evaluate(const QgsFeature *f)
Evaluate the feature and return the result.
static const QString EXPR_BORDER_COLOR
virtual Qt::PenStyle dxfPenStyle() const
get pen style
void setRenderHint(RenderHint hint, bool on)
QDomNode appendChild(const QDomNode &newChild)
virtual QColor dxfColor(QgsSymbolV2RenderContext &context) const
get color
static const QString EXPR_USE_WHOLE_SHAPE
RenderHints renderHints() const
static const QString EXPR_REFERENCE2_Y
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
QMap< Key, T > & unite(const QMap< Key, T > &other)
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
static QgsExpressionContext createFeatureBasedContext(const QgsFeature &feature, const QgsFields &fields)
Helper function for creating an expression context which contains just a feature and fields collectio...
static const QString EXPR_DISPLACEMENT_X
QMap< QString, QgsDataDefined *> mDataDefinedProperties
static const QString EXPR_WIDTH
static const QString EXPR_CUSTOMDASH
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
const_iterator constBegin() const
virtual QColor dxfBrushColor(QgsSymbolV2RenderContext &context) const
get brush/fill color
#define Q_NOWARN_DEPRECATED_PUSH
Base class for visual effects which can be applied to QPicture drawings.
QgsSymbolV2::OutputUnit outputUnit() const override
virtual bool hasDataDefinedProperties() const
Checks whether the layer has any associated data defined properties.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
QgsPaintEffect * mPaintEffect
QgsExpression * expression()
virtual Q_DECL_DEPRECATED const QgsExpression * dataDefinedProperty(const QString &property) const
Returns a data defined expression for a property, if set.
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
Container of fields for a vector layer.
static const QString EXPR_BLUR_RADIUS
static const QString EXPR_COORDINATE_MODE
virtual void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)=0
static QPointF decodePoint(const QString &str)
static const QString EXPR_COLOR2
static QgsDataDefined * fromMap(const QgsStringMap &map, const QString &baseName=QString())
Creates a QgsDataDefined from a decoded QgsStringMap.
QgsSymbolLayerV2(QgsSymbolV2::SymbolType type, bool locked=false)
static const QString EXPR_VERTICAL_ANCHOR_POINT
const QgsFeature * feature() const
Current feature being rendered - may be null.
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
QGis::UnitType mapUnits() const
Retrieve map units.
static const QString EXPR_OFFSET_ALONG_LINE
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
virtual QgsDataDefined * getDataDefinedProperty(const QString &property) const
Returns the data defined property corresponding to the specified property key.
virtual void removeDataDefinedProperty(const QString &property)
Removes a data defined property from the layer.
static const QString EXPR_OFFSET
void setMapUnitScale(const QgsMapUnitScale &scale) override
virtual Q_DECL_DEPRECATED QVariant evaluateDataDefinedProperty(const QString &property, const QgsFeature *feature, const QVariant &defaultVal=QVariant(), bool *ok=nullptr) const
Evaluates the matching data defined property and returns the calculated value.
static const QString EXPR_SIZE
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
virtual void startRender(QgsSymbolV2RenderContext &context)=0
bool useExpression() const
Returns if the field or the expression part is active.
double symbologyScaleDenominator() const
Retrieve reference scale for output.
static const QString EXPR_JOIN_STYLE
static const QString EXPR_FILL_STYLE
static const QString EXPR_REFERENCE1_Y
void drawRect(const QRectF &rectangle)
static const QString EXPR_BORDER_STYLE
static const QString EXPR_REFERENCE2_X
static const QString EXPR_REFERENCE2_ISCENTROID
Mixed units in symbol layers.
static const QString EXPR_LINEWIDTH
static const QString EXPR_PLACEMENT
static const QString EXPR_FILL_COLOR
void append(const T &value)
static const QString EXPR_SPREAD
void addPolygon(const QPolygonF &polygon)
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects. ...
static const QString EXPR_LINEANGLE
static QString encodePoint(QPointF point)
static double convertToPainterUnits(const QgsRenderContext &c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale())
Converts a size from the specied units to painter units.
static const QString EXPR_ALPHA
The geometries can be rendered with 'AntiAliasing' disabled because of it is '1-pixel size'...
QgsMarkerSymbolLayerV2(bool locked=false)
Constructor for QgsMarkerSymbolLayerV2.
void setAttribute(const QString &name, const QString &value)
QString expressionString() const
Returns the expression string of this QgsDataDefined.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
const_iterator constEnd() const
float threshold() const
Gets the simplification threshold of the vector layer managed.
static const QString EXPR_FILL
virtual QVector< qreal > dxfCustomDashPattern(QgsSymbolV2::OutputUnit &unit) const
get dash pattern
virtual void renderPolygonOutline(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
virtual Q_DECL_DEPRECATED void prepareExpressions(const QgsFields *fields, double scale=-1.0)
Prepares all data defined property expressions for evaluation.
double mapUnitsPerPixel() const
Return current map units per pixel.
virtual QColor color() const
The fill color.
static const QString EXPR_FILE
static const QString EXPR_CAPSTYLE
static const QString EXPR_OUTLINE_STYLE
static const QString EXPR_DISTANCE
void copyDataDefinedProperties(QgsSymbolLayerV2 *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
void saveDataDefinedProperties(QgsStringMap &stringMap) const
Saves all data defined properties to a string map.
static const QString EXPR_COLOR
static const QString EXPR_WIDTH_BORDER
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name also looks up case-insensitive if there is no match otherwise...
static const QString EXPR_SVG_FILE
static const QString EXPR_ANGLE
virtual double dxfOffset(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const
get offset
virtual Q_DECL_DEPRECATED QString dataDefinedPropertyString(const QString &property) const
Returns a data defined expression for a property, if set.
QgsExpressionContext & expressionContext()
Gets the expression context.
QString field() const
Get the field which this QgsDataDefined represents.
static const QString EXPR_DISTANCE_X
static const QString EXPR_REFERENCE1_X
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size) override
QgsFillSymbolLayerV2(bool locked=false)
SymbolType
Type of the symbol.
static const QString EXPR_GRADIENT_TYPE
#define Q_NOWARN_DEPRECATED_POP
void startRender(QgsSymbolV2RenderContext &context) override
static const QString EXPR_OUTLINE_WIDTH
void copyPaintEffect(QgsSymbolLayerV2 *destLayer) const
Copies paint effect of this layer to another symbol layer.
QgsMapUnitScale mapUnitScale() const override
VerticalAnchorPoint
Symbol vertical anchor points.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
Writes the SLD element following the SLD v1.1 specs.
static const QString EXPR_SVG_FILL_COLOR
QRectF boundingRect() const
const QgsMapToPixel & mapToPixel() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
void drawPath(const QPainterPath &path)
QgsLineSymbolLayerV2(bool locked=false)
Struct for storing maximum and minimum scales for measurements in map units.
QgsMapUnitScale mapUnitScale() const override
virtual bool hasDataDefinedProperty(const QString &property) const
Checks whether the layer has a matching data defined property and if that property is currently activ...
static const QString EXPR_SVG_OUTLINE_COLOR
static const QString EXPR_NAME
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const
get line width
QgsRenderContext & renderContext()
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size) override
static const QString EXPR_IGNORE_RINGS
static const QString EXPR_COLOR_BORDER
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
bool isEmpty() const
Check whether the container is empty.
static const QString EXPR_REFERENCE1_ISCENTROID
static const QString EXPR_ROTATION
QgsSymbolV2::OutputUnit mOffsetUnit
Offset units.
virtual double dxfAngle(QgsSymbolV2RenderContext &context) const
get angle
virtual Q_DECL_DEPRECATED QgsExpression * expression(const QString &property) const
Returns the data defined expression associated with a property.
virtual ~QgsSymbolLayerV2()
iterator insert(const Key &key, const T &value)
static const QString EXPR_OUTLINE
HorizontalAnchorPoint
Symbol horizontal anchor points.
static const QString EXPR_SVG_OUTLINE_WIDTH
void restoreDataDefinedProperties(const QgsStringMap &stringMap)
Restores all data defined properties from string map.
const_iterator constEnd() const
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size) override
static const QString EXPR_SYMBOL_NAME
virtual double dxfWidth(const QgsDxfExport &e, QgsSymbolV2RenderContext &context) const override
get line width
void _renderPolygon(QPainter *p, const QPolygonF &points, const QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
Default method to render polygon.
static bool isGeneralizableByDeviceBoundingBox(const QgsRectangle &envelope, float mapToPixelTol=1.0f)
Returns whether the device-envelope can be replaced by its BBOX when is applied the specified toleran...
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
int compare(const QString &other) const
static const QString EXPR_MAX_DISTANCE
QgsSymbolV2::SymbolType type() const
static const QString EXPR_LINE_STYLE
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
virtual bool isCompatibleWithSymbol(QgsSymbolV2 *symbol) const
Returns if the layer can be used below the specified symbol.
QPointF mOffset
Marker offset.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
void setOutputUnit(QgsSymbolV2::OutputUnit unit) override
static const QString EXPR_INTERVAL
iterator find(const Key &key)
static const QString EXPR_HEIGHT
const T value(const Key &key) const
virtual Q_DECL_DEPRECATED void setDataDefinedProperty(const QString &property, const QString &expressionString)
Sets a data defined expression for a property.
static const QString EXPR_HORIZONTAL_ANCHOR_POINT