44 #include <QSvgGenerator> 89 , mClipFeaturesToExtent( true )
91 , mSymbolRenderContext( nullptr )
101 else if ( !
mLayers.
at( i )->isCompatibleWithSymbol(
this ) )
112 wkbPtr >> pt.
rx() >> pt.
ry();
129 unsigned int nPoints;
136 if ( clipToExtent && nPoints > 1 )
139 double cw = e.
width() / 10;
140 double ch = e.
height() / 10;
142 wkbPtr -= 1 + 2 *
sizeof( int );
148 Q_ASSERT( skipZM >= 0 );
150 if ( static_cast<int>( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ) > wkbPtr.
remaining() )
152 QgsDebugMsg(
QString(
"%1 points exceed wkb length (%2>%3)" ).arg( nPoints ).arg( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ).arg( wkbPtr.
remaining() ) );
159 for (
unsigned int i = 0; i < nPoints; ++i, ++ptr )
161 wkbPtr >> ptr->
rx() >> ptr->
ry();
173 for (
int i = 0; i < pts.
size(); ++i, ++ptr )
184 unsigned int numRings;
195 double cw = e.
width() / 10;
196 double ch = e.
height() / 10;
200 Q_ASSERT( skipZM >= 0 );
202 for (
unsigned int idx = 0; idx < numRings; idx++ )
204 unsigned int nPoints;
207 if ( static_cast<int>( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ) > wkbPtr.
remaining() )
209 QgsDebugMsg(
QString(
"%1 points exceed wkb length (%2>%3)" ).arg( nPoints ).arg( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ).arg( wkbPtr.
remaining() ) );
217 for (
unsigned int jdx = 0; jdx < nPoints; ++jdx, ++ptr )
219 wkbPtr >> ptr->
rx() >> ptr->
ry();
240 for (
int i = 0; i < poly.
size(); ++i, ++ptr )
256 delete mSymbolRenderContext;
274 if (( *it )->outputUnit() != unit )
298 if (( *it )->mapUnitScale() != scale )
343 if ( defaultSymbol !=
"" )
370 if ( defaultSymbol ==
"" ||
391 return mType == layerType;
442 if ( oldLayer == layer )
456 delete mSymbolRenderContext;
472 if ( mSymbolRenderContext )
478 delete mSymbolRenderContext;
479 mSymbolRenderContext =
nullptr;
498 if ( !( *it )->isLocked() )
499 return ( *it )->color();
534 if ( format.
toLower() ==
"svg" )
554 QImage image( size, QImage::Format_ARGB32_Premultiplied );
568 QImage preview(
QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
583 if ( expressionContext )
592 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( poly,
nullptr, context );
598 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( polygon,
nullptr,
nullptr, context );
625 Q_ASSERT( 0 &&
"unknown symbol type" );
640 double scaleFactor = 1.0;
646 ( *it )->toSld( doc, element, locProps );
670 if ( effect && effect->
enabled() )
676 generatorLayer->render( context );
683 generatorLayer->render( context );
695 attributes.
unite(( *sIt )->usedAttributes() );
720 bool deleteSegmentizedGeometry =
false;
734 deleteSegmentizedGeometry =
true;
752 QgsDebugMsg(
"point can be drawn only with marker symbol!" );
758 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( pt, &feature, context, layer, selected );
765 context.
painter()->
drawRect( static_cast<QgsMarkerSymbolV2*>(
this )->bounds( pt, context, feature ) );
774 QgsDebugMsg(
"linestring can be drawn only with line symbol!" );
778 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( pts, &feature, context, layer, selected );
787 QgsDebugMsg(
"polygon can be drawn only with fill symbol!" );
791 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( pts, ( !holes.
isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
801 QgsDebugMsg(
"multi-point can be drawn only with marker symbol!" );
813 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( pt, &feature, context, layer, selected );
825 QgsDebugMsg(
"multi-linestring can be drawn only with line symbol!" );
837 for (
unsigned int i = 0; i < num && wkbPtr; ++i )
841 if ( geomCollection )
846 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( pts, &feature, context, layer, selected );
856 QgsDebugMsg(
"multi-polygon can be drawn only with fill symbol!" );
871 for (
unsigned int i = 0; i < num && wkbPtr; ++i )
875 if ( geomCollection )
881 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( pts, ( !holes.
isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
891 wkbPtr >> nGeometries;
893 if ( nGeometries == 0 )
908 if ( drawVertexMarker )
932 currentVertexMarkerSize );
936 if ( deleteSegmentizedGeometry )
938 delete segmentizedGeometry;
947 return mSymbolRenderContext;
954 : mRenderContext( c ),
955 mExpressionContextScope( nullptr ),
957 mMapUnitScale( mapUnitScale ),
959 mSelected( selected ),
968 delete mExpressionContextScope;
998 return mExpressionContextScope;
1003 mExpressionContextScope = contextScope;
1052 double origAngle =
angle();
1053 double angleDiff = ang - origAngle;
1069 return markerLayer->
angle();
1087 const double symbolRotation =
angle();
1115 const double symbolRotation =
angle();
1144 if ( !layerAngleDD || *layerAngleDD != *symbolDD )
1150 if ( !layerAngleDD || *layerAngleDD != *( rotatedDD.
data() ) )
1160 double origSize =
size();
1172 markerLayer->
setSize( markerLayer->
size() * s / origSize );
1177 markerLayer->
offset().
y() * s / origSize ) );
1190 double lsize = markerLayer->
size();
1191 if ( lsize > maxSize )
1224 if ( unit != markerLayer->
sizeUnit() )
1260 const double symbolSize =
size();
1287 markerLayer->
offset().
x() / symbolSize,
1288 markerLayer->
offset().
y() / symbolSize, dd ) );
1296 const double symbolSize =
size();
1328 if ( !layerSizeDD || *layerSizeDD != *symbolDD )
1337 if ( !layerSizeDD || *layerSizeDD != *( scaledDD.
data() ) )
1342 if ( layerOffsetDD && *layerOffsetDD != *( scaledOffsetDD.
data() ) )
1376 static QPointF nullPoint( 0, 0 );
1379 if ( effect && effect->
enabled() )
1401 if ( layerIdx != -1 )
1409 renderPointUsingLayer( markerLayer, point, symbolContext );
1422 renderPointUsingLayer( markerLayer, point, symbolContext );
1439 if ( bound.isNull() )
1440 bound = symbolLayer->
bounds( point, symbolContext );
1442 bound = bound.
united( symbolLayer->
bounds( point, symbolContext ) );
1470 double origWidth =
width();
1496 double maxWidth = 0;
1506 if ( width > maxWidth )
1515 const double symbolWidth =
width();
1550 const double symbolWidth =
width();
1580 if ( !layerWidthDD || *layerWidthDD != *symbolDD )
1589 if ( !layerWidthDD || *layerWidthDD != *( scaledDD.
data() ) )
1594 if ( layerOffsetDD && *layerOffsetDD != *( scaledOffsetDD.
data() ) )
1607 if ( layerIdx != -1 )
1615 renderPolylineUsingLayer( lineLayer, points, symbolContext );
1628 renderPolylineUsingLayer( lineLayer, points, symbolContext );
1642 if ( effect && effect->
enabled() )
1684 if ( layerIdx != -1 )
1690 renderPolygonUsingLayer( symbolLayer, points, rings, symbolContext );
1700 renderPolygonUsingLayer( symbolLayer, points, rings, symbolContext );
1711 if ( effect && effect->
enabled() )
1713 QRectF bounds = polygonBounds( points, rings );
1718 p->translate( bounds.
topLeft() );
1729 delete translatedRings;
1753 for ( ; it != rings->
constEnd(); ++it )
1755 bounds = bounds.
united(( *it ).boundingRect() );
1768 for ( ; it != rings->
constEnd(); ++it )
1770 translatedRings->
append(( *it ).translated( dx, dy ) );
1772 return translatedRings;
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
virtual void renderPoint(QPointF point, QgsSymbolV2RenderContext &context)=0
virtual void setMapUnitScale(const QgsMapUnitScale &scale)
QgsFillSymbolV2(const QgsSymbolLayerV2List &layers=QgsSymbolLayerV2List())
void setForceVectorOutput(bool force)
void setLocked(bool locked)
static int coordDimensions(Type type)
Returns the coordinate dimension of the geometry type as an integer.
bool contains(const QgsRectangle &rect) const
return true when rectangle contains other rectangle
bool deleteSymbolLayer(int index)
delete symbol layer at specified index
Single variable definition for use within a QgsExpressionContextScope.
void setViewBox(const QRect &viewBox)
A rectangle specified with double values.
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
static QgsMarkerSymbolV2 * createSimple(const QgsStringMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent...
int numGeometries() const
Returns the number of geometries within the collection.
double angle() const
Returns the marker angle for the whole symbol.
OutputUnit
The unit of the output.
virtual void setOutputUnit(QgsSymbolV2::OutputUnit unit)
QString readEntry(const QString &scope, const QString &key, const QString &def=QString::null, bool *ok=nullptr) const
QGis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
bool mClipFeaturesToExtent
void setDataDefinedAngle(const QgsDataDefined &dd)
Set data defined angle for whole symbol (including all symbol layers).
A container class for data source field mapping or expression.
void setSize(const QSize &size)
virtual QgsLineSymbolV2 * clone() const override
static QgsConstWkbPtr clippedLineWKB(QgsConstWkbPtr wkb, const QgsRectangle &clipExtent, QPolygonF &line)
Reads a polyline from WKB and clips it to clipExtent.
void setRenderHint(RenderHint hint, bool on)
const QgsVectorLayer * mLayer
virtual QRectF bounds(QPointF point, QgsSymbolV2RenderContext &context)
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
QgsSymbolV2::OutputUnit sizeUnit() const
void setDataDefinedSize(const QgsDataDefined &dd)
Set data defined size for whole symbol (including all symbol layers).
bool save(const QString &fileName, const char *format, int quality) const
static QString encodeColor(const QColor &color)
static QString encodeSldUom(QgsSymbolV2::OutputUnit unit, double *scaleFactor)
void setScaleMethod(QgsSymbolV2::ScaleMethod scaleMethod)
const QgsMapUnitScale & sizeMapUnitScale() const
static QgsFillSymbolV2 * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties. ...
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
const T & at(int i) const
VertexMarkerType
Editing vertex markers.
void setOffset(QPointF offset)
QPolygonF translated(qreal dx, qreal dy) const
Base class for visual effects which can be applied to QPicture drawings.
bool changeSymbolLayer(int index, QgsSymbolLayerV2 *layer)
delete layer at specified index and set a new one
QgsSymbolV2RenderContext(QgsRenderContext &c, QgsSymbolV2::OutputUnit u, qreal alpha=1.0, bool selected=false, int renderHints=0, const QgsFeature *f=nullptr, const QgsFields *fields=nullptr, const QgsMapUnitScale &mapUnitScale=QgsMapUnitScale())
ScaleMethod scaleMethod()
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.
static void _getPoint(QPointF &pt, QgsRenderContext &context, const QgsPointV2 *point)
Creates a point in screen coordinates from a QgsPointV2 in map coordinates.
Abstract base class for all geometries.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
double size() const
Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the s...
QgsSymbolLayerV2List cloneLayers() const
Retrieve a cloned list of all layers that make up this symbol.
Multi point geometry collection.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
double z() const
Returns the point's z-coordinate.
void drawLine(const QLineF &line)
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.
virtual QgsDataDefined * getDataDefinedProperty(const QString &property) const
Returns the data defined property corresponding to the specified property key.
double y() const
Returns the point's y-coordinate.
void setExpressionContextScope(QgsExpressionContextScope *contextScope)
Set an expression scope for this symbol.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
int wkbSize() const
Returns the size of the WKB in asWkb().
virtual void removeDataDefinedProperty(const QString &property)
Removes a data defined property from the layer.
void drawPreviewIcon(QPainter *painter, QSize size, QgsRenderContext *customContext=nullptr)
Draw icon of the symbol that occupyies area given by size using the painter.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
void setSizeUnit(OutputUnit unit)
Sets the size units for the whole symbol (including all symbol layers).
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static double pixelSizeScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns scale factor painter units -> pixel dimensions.
void setWidth(double width)
QgsDataDefined * scaleWholeSymbol(double scaleFactor, const QgsDataDefined &dd)
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the size map unit scale for the whole symbol (including all symbol layers).
void setMapUnitScale(const QgsMapUnitScale &scale)
void setAngle(double angle)
void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const
Writes the SLD element following the SLD v1.1 specs.
virtual void startRender(QgsSymbolV2RenderContext &context)=0
bool useExpression() const
Returns if the field or the expression part is active.
QColor fromHsv(int h, int s, int v, int a)
void transformInPlace(double &x, double &y) const
Transform device coordinates to map coordinates.
void drawRect(const QRectF &rectangle)
Perform transforms between map coordinates and device coordinates.
void setUseExpression(bool use)
Controls if the field or the expression part is active.
void setColor(const QColor &color)
virtual double width() const
QgsDataDefined dataDefinedWidth() const
Returns data defined size for whole symbol (including all symbol layers).
Mixed units in symbol layers.
static QgsRenderContext createRenderContext(QPainter *p)
Creates a render context for a pixel based device.
QString number(int n, int base)
QgsSymbolLayerV2List mLayers
int count(const T &value) const
const QgsAbstractGeometryV2 * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
void append(const T &value)
const QgsFields * fields() const
Returns the field map associated with the feature.
void setOffset(double offset)
bool appendSymbolLayer(QgsSymbolLayerV2 *layer)
Append symbol layer at the end of the list Ownership will be transferred.
QRectF bounds(QPointF point, QgsRenderContext &context, const QgsFeature &feature=QgsFeature()) const
Returns the approximate bounding box of the marker symbol, which includes the bounding box of all sym...
void startRender(QgsRenderContext &context, const QgsFields *fields=nullptr)
const QgsVectorLayer * layer() const
void fill(uint pixelValue)
double outputLineWidth(double width) const
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.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
Utility class for identifying a unique vertex within a geometry.
const QgsRectangle & extent() const
static QgsLineSymbolV2 * createSimple(const QgsStringMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties. ...
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
static bool isCurvedType(Type type)
Returns true if the WKB type is a curved type or can contain curved geometries.
void setPen(const QColor &color)
Q_DECL_DEPRECATED bool isSymbolLayerCompatible(SymbolType layerType)
check whether a symbol layer type can be used within the symbol (marker-marker, line-line, fill-fill/line)
void setRenderingPass(int renderingPass)
#define DEFAULT_SCALE_METHOD
void setLayer(const QgsVectorLayer *layer)
double width() const
Width of the rectangle.
QString expressionString() const
Returns the expression string of this QgsDataDefined.
Point geometry type, with support for z-dimension and m-values.
QString qgsDoubleToString(double a, int precision=17)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual void setWidth(double width)
static QgsStyleV2 * defaultStyle()
return default application-wide style
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
QgsMarkerSymbolV2(const QgsSymbolLayerV2List &layers=QgsSymbolLayerV2List())
void setAngle(double angle)
void setAngle(double angle)
Sets the angle for the whole symbol.
void setSizeUnit(QgsSymbolV2::OutputUnit unit)
const QgsCoordinateTransform * coordinateTransform() const
Draw bounds of symbols (for debugging/testing)
OutputUnit sizeUnit() const
Returns the size units for the whole symbol (including all symbol layers).
void setBrush(const QBrush &brush)
void setPainter(QPainter *p)
void setSize(double size)
Sets the size for the whole symbol.
double x() const
Returns the point's x-coordinate.
const unsigned char * asWkb() const
Returns the buffer containing this geometry in WKB format.
qreal mAlpha
Symbol opacity (in the range 0 - 1)
virtual int partCount() const =0
Returns count of parts contained in the geometry.
QgsSymbolV2RenderContext & operator=(const QgsSymbolV2RenderContext &)
bool enabled() const
Returns whether the effect is enabled.
QRectF united(const QRectF &rectangle) const
virtual void renderPolygonOutline(const QPolygonF &points, QList< QPolygonF > *rings, QgsSymbolV2RenderContext &context)
QgsSymbolV2(SymbolType type, const QgsSymbolLayerV2List &layers)
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const =0
Returns next vertex id and coordinates.
bool hasDataDefinedProperties() const
Returns whether the symbol utilises any data defined properties.
QgsDataDefined * rotateWholeSymbol(double additionalRotation, const QgsDataDefined &dd)
Single scope for storing variables and functions for use within a QgsExpressionContext.
QgsMapUnitScale mapUnitScale() const
static void drawVertexMarker(double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
Draws a vertex symbol at (screen) coordinates x, y.
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
double outputPixelSize(double size) const
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
QgsFeatureId id() const
Get the feature ID for this feature.
virtual void renderPolyline(const QPolygonF &points, QgsSymbolV2RenderContext &context)=0
QgsSymbolV2 * symbol(const QString &name)
return a NEW copy of symbol
virtual QgsFillSymbolV2 * clone() const override
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
QImage bigSymbolPreviewImage(QgsExpressionContext *expressionContext=nullptr)
Returns a large (roughly 100x100 pixel) preview image for the symbol.
void setFileName(const QString &fileName)
void exportImage(const QString &path, const QString &format, QSize size)
export symbol as image format. PNG and SVG supported
QgsExpressionContext & expressionContext()
Gets the expression context.
QString field() const
Get the field which this QgsDataDefined represents.
bool clipFeaturesToExtent() const
Returns whether features drawn by the symbol will be clipped to the render context's extent...
void renderUsingLayer(QgsSymbolLayerV2 *layer, QgsSymbolV2RenderContext &context)
Renders a context using a particular symbol layer without passing in a geometry.
double xMaximum() const
Get the x maximum value (right side of rectangle)
SymbolType
Type of the symbol.
~QgsSymbolV2RenderContext()
QgsSymbolV2::OutputUnit outputUnit() const
void setDataDefinedWidth(const QgsDataDefined &dd)
Set data defined width for whole symbol (including all symbol layers).
QgsExpressionContextScope * expressionContextScope()
This scope is always available when a symbol of this type is being rendered.
Contains information about the context of a rendering operation.
QgsMapUnitScale sizeMapUnitScale() const
Returns the size map unit scale for the whole symbol.
QgsSymbolV2::ScaleMethod scaleMethod() const
QRectF boundingRect() const
QgsAbstractGeometryV2 * geometry() const
Returns the underlying geometry store.
const QgsMapToPixel & mapToPixel() const
void stopRender(QgsRenderContext &context)
static QgsConstWkbPtr _getLineString(QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr wkb, bool clipToExtent=true)
Creates a line string in screen coordinates from a wkb string in map coordinates. ...
bool insertSymbolLayer(int index, QgsSymbolLayerV2 *layer)
Insert symbol layer to specified index Ownership will be transferred.
QSet< T > & unite(const QSet< T > &other)
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
Struct for storing maximum and minimum scales for measurements in map units.
QgsDataDefined dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
void insert(int i, const T &value)
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
static QgsConstWkbPtr _getPolygon(QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr wkb, bool clipToExtent=true)
Creates a polygon in screen coordinates from a wkb string in map coordinates.
QImage asImage(QSize size, QgsRenderContext *customContext=nullptr)
Generate symbol as image.
QgsRenderContext & renderContext()
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static QgsProject * instance()
access to canonical QgsProject instance
virtual QgsAbstractGeometryV2 * segmentize() const
Returns a version of the geometry without curves.
void renderPoint(QPointF point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
void translate(const QPointF &offset)
double xMinimum() const
Get the x minimum value (left side of rectangle)
virtual void setColor(const QColor &color)
The fill color.
static Type flatType(Type type)
Returns the flat type for a WKB type.
double yMaximum() const
Get the y maximum value (top side of rectangle)
QgsSymbolLayerV2 * takeSymbolLayer(int index)
Remove symbol layer from the list and return pointer to it.
QgsWKBTypes::Type readHeader() const
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
QgsExpressionContextScope * popScope()
Removes the last scope from the expression context and return it.
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
const_iterator constEnd() const
virtual void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size)=0
const_iterator constBegin() const
QSet< QString > usedAttributes() const
Return a list of attributes required to render this feature.
static QString displayString(Type type)
Returns a display string type for a WKB type, eg the geometry name used in WKT geometry representatio...
Draw map such that there are no problems between adjacent tiles.
bool hasDefaultValues() const
Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field.
static void trimPolygon(QPolygonF &pts, const QgsRectangle &clipRect)
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
void setSize(double size)
void setAngle(double angle)
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
virtual void end(QgsRenderContext &context)
Ends interception of paint operations to a render context, and draws the result to the render context...
QgsSymbolV2::SymbolType type() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbolV2 *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbolV2 to an expression context.
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
virtual bool isCompatibleWithSymbol(QgsSymbolV2 *symbol) const
Returns if the layer can be used below the specified symbol.
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
void setExpressionString(const QString &expr)
Sets the expression for this QgsDataDefined.
void setOutputUnit(QgsSymbolV2::OutputUnit u)
void setAlpha(qreal alpha)
Set alpha transparency 1 for opaque, 0 for invisible.
void setScaleMethod(QgsSymbolV2::ScaleMethod scaleMethod)
void setGeometry(const QgsAbstractGeometryV2 *geometry)
Sets pointer to original (unsegmentized) geometry.
static QgsSymbolLayerV2 * create(const QgsStringMap &properties=QgsStringMap())
virtual void begin(QgsRenderContext &context)
Begins intercepting paint operations to a render context.
QgsSymbolV2RenderContext * symbolRenderContext()
Returns the symbol render context.
QgsLineSymbolV2(const QgsSymbolLayerV2List &layers=QgsSymbolLayerV2List())
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
virtual QgsMarkerSymbolV2 * clone() const override
double height() const
Height of the rectangle.
virtual Q_DECL_DEPRECATED void setDataDefinedProperty(const QString &property, const QString &expressionString)
Sets a data defined expression for a property.