45 #include <QSvgGenerator> 90 , mClipFeaturesToExtent( true )
93 , mSymbolRenderContext( nullptr )
102 else if ( !
mLayers.
at( i )->isCompatibleWithSymbol(
this ) )
113 wkbPtr >> pt.
rx() >> pt.
ry();
130 unsigned int nPoints;
137 if ( clipToExtent && nPoints > 1 )
140 double cw = e.
width() / 10;
141 double ch = e.
height() / 10;
143 wkbPtr -= 1 + 2 *
sizeof( int );
149 Q_ASSERT( skipZM >= 0 );
151 if ( static_cast<int>( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ) > wkbPtr.
remaining() )
153 QgsDebugMsg(
QString(
"%1 points exceed wkb length (%2>%3)" ).arg( nPoints ).arg( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ).arg( wkbPtr.
remaining() ) );
157 wkbPtr -=
sizeof(
unsigned int );
159 nPoints = pts.
size();
169 for (
int i = 0; i < pts.
size(); ++i, ++ptr )
180 unsigned int numRings;
191 double cw = e.
width() / 10;
192 double ch = e.
height() / 10;
196 Q_ASSERT( skipZM >= 0 );
198 for (
unsigned int idx = 0; idx < numRings; idx++ )
200 unsigned int nPoints;
203 if ( static_cast<int>( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ) > wkbPtr.
remaining() )
205 QgsDebugMsg(
QString(
"%1 points exceed wkb length (%2>%3)" ).arg( nPoints ).arg( nPoints * ( 2 *
sizeof(
double ) + skipZM ) ).arg( wkbPtr.
remaining() ) );
210 wkbPtr -=
sizeof(
unsigned int );
212 nPoints = poly.
size();
218 QRectF ptsRect = poly.boundingRect();
231 for (
int i = 0; i < poly.size(); ++i, ++ptr )
247 delete mSymbolRenderContext;
265 if (( *it )->outputUnit() != unit )
289 if (( *it )->mapUnitScale() != scale )
334 if ( defaultSymbol !=
"" )
361 if ( defaultSymbol ==
"" ||
382 return mType == layerType;
433 if ( oldLayer == layer )
447 Q_ASSERT_X( !mStarted,
"startRender",
"Rendering has already been started for this symbol instance!" );
450 delete mSymbolRenderContext;
465 Q_ASSERT_X( mStarted,
"startRender",
"startRender was not called for this symbol instance!" );
469 if ( mSymbolRenderContext )
475 delete mSymbolRenderContext;
476 mSymbolRenderContext =
nullptr;
495 if ( !( *it )->isLocked() )
496 return ( *it )->color();
531 if ( format.
toLower() ==
"svg" )
551 QImage image( size, QImage::Format_ARGB32_Premultiplied );
565 QImage preview(
QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
580 if ( expressionContext )
589 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( poly,
nullptr, context );
595 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( polygon,
nullptr,
nullptr, context );
622 Q_ASSERT( 0 &&
"unknown symbol type" );
637 double scaleFactor = 1.0;
643 ( *it )->toSld( doc, element, locProps );
667 if ( effect && effect->
enabled() )
673 generatorLayer->render( context );
680 generatorLayer->render( context );
692 attributes.
unite(( *sIt )->usedAttributes() );
713 class ExpressionContextScopePopper
717 ExpressionContextScopePopper() : context(
nullptr )
720 ~ExpressionContextScopePopper()
739 bool deleteSegmentizedGeometry =
false;
753 deleteSegmentizedGeometry =
true;
756 ExpressionContextScopePopper scopePopper;
757 if ( mSymbolRenderContext )
759 mSymbolRenderContext->setGeometryPartCount( segmentizedGeometry->
geometry()->
partCount() );
760 mSymbolRenderContext->setGeometryPartNum( 1 );
762 if ( mSymbolRenderContext->expressionContextScope() )
788 QgsDebugMsg(
"point can be drawn only with marker symbol!" );
794 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( pt, &feature, context, layer, selected );
801 context.
painter()->
drawRect( static_cast<QgsMarkerSymbolV2*>(
this )->bounds( pt, context, feature ) );
804 if ( drawVertexMarker && !deleteSegmentizedGeometry )
815 QgsDebugMsg(
"linestring can be drawn only with line symbol!" );
820 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( pts, &feature, context, layer, selected );
822 if ( drawVertexMarker && !deleteSegmentizedGeometry )
834 QgsDebugMsg(
"polygon can be drawn only with fill symbol!" );
839 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( pts, ( !holes.
isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
841 if ( drawVertexMarker && !deleteSegmentizedGeometry )
845 Q_FOREACH (
const QPolygonF& hole, holes )
859 QgsDebugMsg(
"multi-point can be drawn only with marker symbol!" );
865 if ( drawVertexMarker && !deleteSegmentizedGeometry )
872 if ( mSymbolRenderContext )
874 mSymbolRenderContext->setGeometryPartNum( i + 1 );
880 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( pt, &feature, context, layer, selected );
882 if ( drawVertexMarker && !deleteSegmentizedGeometry )
897 QgsDebugMsg(
"multi-linestring can be drawn only with line symbol!" );
909 for (
unsigned int i = 0; i < num && wkbPtr; ++i )
911 if ( mSymbolRenderContext )
913 mSymbolRenderContext->setGeometryPartNum( i + 1 );
917 if ( geomCollection )
925 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( pts, &feature, context, layer, selected );
927 if ( drawVertexMarker && !deleteSegmentizedGeometry )
947 QgsDebugMsg(
"multi-polygon can be drawn only with fill symbol!" );
962 for (
unsigned int i = 0; i < num && wkbPtr; ++i )
964 if ( mSymbolRenderContext )
966 mSymbolRenderContext->setGeometryPartNum( i + 1 );
970 if ( geomCollection )
978 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( pts, ( !holes.
isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
980 if ( drawVertexMarker && !deleteSegmentizedGeometry )
991 Q_FOREACH (
const QPolygonF& hole, holes )
1005 wkbPtr >> nGeometries;
1007 if ( nGeometries == 0 )
1017 .arg( feature.
id() )
1022 if ( drawVertexMarker )
1024 if ( markers.
size() > 0 )
1026 Q_FOREACH (
QPointF marker, markers )
1028 renderVertexMarker( marker, context, currentVertexMarkerType, currentVertexMarkerSize );
1043 x = vertexPoint.
x();
1044 y = vertexPoint.
y();
1053 renderVertexMarker( mapPoint, context, currentVertexMarkerType, currentVertexMarkerSize );
1058 if ( deleteSegmentizedGeometry )
1060 delete segmentizedGeometry;
1066 return mSymbolRenderContext;
1078 : mRenderContext( c )
1079 , mExpressionContextScope( nullptr )
1081 , mMapUnitScale( mapUnitScale )
1083 , mSelected( selected )
1087 , mGeometryPartCount( 0 )
1088 , mGeometryPartNum( 0 )
1094 delete mExpressionContextScope;
1124 return mExpressionContextScope;
1129 mExpressionContextScope = contextScope;
1178 double origAngle =
angle();
1179 double angleDiff = angle0 - origAngle;
1195 return markerLayer->
angle();
1213 const double symbolRotation =
angle();
1241 const double symbolRotation =
angle();
1270 if ( !layerAngleDD || *layerAngleDD != *symbolDD )
1276 if ( !layerAngleDD || *layerAngleDD != *( rotatedDD.
data() ) )
1286 double origSize =
size();
1298 markerLayer->
setSize( markerLayer->
size() * s / origSize );
1303 markerLayer->
offset().
y() * s / origSize ) );
1316 double lsize = markerLayer->
size();
1317 if ( lsize > maxSize )
1350 if ( unit != markerLayer->
sizeUnit() )
1386 const double symbolSize =
size();
1413 markerLayer->
offset().
x() / symbolSize,
1414 markerLayer->
offset().
y() / symbolSize, dd ) );
1422 const double symbolSize =
size();
1454 if ( !layerSizeDD || *layerSizeDD != *symbolDD )
1463 if ( !layerSizeDD || *layerSizeDD != *( scaledDD.
data() ) )
1468 if ( layerOffsetDD && *layerOffsetDD != *( scaledOffsetDD.
data() ) )
1502 static QPointF nullPoint( 0, 0 );
1505 if ( effect && effect->
enabled() )
1529 if ( layerIdx != -1 )
1537 renderPointUsingLayer( markerLayer, point, symbolContext );
1550 renderPointUsingLayer( markerLayer, point, symbolContext );
1567 if ( bound.isNull() )
1568 bound = symbolLayer->
bounds( point, symbolContext );
1570 bound = bound.
united( symbolLayer->
bounds( point, symbolContext ) );
1598 double origWidth =
width();
1624 double maxWidth = 0;
1634 if ( width > maxWidth )
1643 const double symbolWidth =
width();
1678 const double symbolWidth =
width();
1708 if ( !layerWidthDD || *layerWidthDD != *symbolDD )
1717 if ( !layerWidthDD || *layerWidthDD != *( scaledDD.
data() ) )
1722 if ( layerOffsetDD && *layerOffsetDD != *( scaledOffsetDD.
data() ) )
1737 if ( layerIdx != -1 )
1745 renderPolylineUsingLayer( lineLayer, points, symbolContext );
1758 renderPolylineUsingLayer( lineLayer, points, symbolContext );
1772 if ( effect && effect->
enabled() )
1816 if ( layerIdx != -1 )
1822 renderPolygonUsingLayer( symbolLayer, points, rings, symbolContext );
1832 renderPolygonUsingLayer( symbolLayer, points, rings, symbolContext );
1843 if ( effect && effect->
enabled() )
1845 QRectF bounds = polygonBounds( points, rings );
1850 p->translate( bounds.
topLeft() );
1861 delete translatedRings;
1885 for ( ; it != rings->
constEnd(); ++it )
1887 bounds = bounds.
united(( *it ).boundingRect() );
1900 for ( ; it != rings->
constEnd(); ++it )
1902 translatedRings->
append(( *it ).translated( dx, dy ) );
1904 return translatedRings;
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
virtual void renderPoint(QPointF point, QgsSymbolV2RenderContext &context)=0
Renders a marker at the specified point.
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.
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
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.
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Added in QGIS v2.4.
void setSize(const QSize &size)
void setGeometryPartCount(int count)
Sets the part count of current geometry.
virtual QgsLineSymbolV2 * clone() const override
void setRenderHint(RenderHint hint, bool on)
const QgsVectorLayer * mLayer
void append(const T &value)
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
Returns the units for the symbol's size.
double size() const
Returns the symbol size.
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)
Sets the method to use for scaling the marker's size.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
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)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
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.
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.
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...
void drawLine(const QLineF &line)
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())
Creates a new QgsSimpleMarkerSymbolLayerV2.
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)
Compare two doubles (but allow some difference)
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)
static QgsConstWkbPtr clippedLineWKB(QgsConstWkbPtr &wkb, const QgsRectangle &clipExtent, QPolygonF &line)
Reads a polyline from WKB and clips it to clipExtent.
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)
Returns a string representation of a double.
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)
virtual QgsAbstractGeometryV2 * segmentize(double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a version of the geometry without curves.
void setAngle(double angle)
Sets the angle for the whole symbol.
void setSizeUnit(QgsSymbolV2::OutputUnit unit)
Sets the units for the symbol's size.
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.
double segmentationTolerance() const
Gets the segmentation tolerance applied when rendering curved geometries.
QgsSymbolV2::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
QRectF boundingRect() const
QgsAbstractGeometryV2 * geometry() const
Returns the underlying geometry store.
const QgsMapToPixel & mapToPixel() const
void stopRender(QgsRenderContext &context)
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.
QImage asImage(QSize size, QgsRenderContext *customContext=nullptr)
Generate symbol as image.
QgsAbstractGeometryV2::SegmentationToleranceType segmentationToleranceType() const
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation...
QgsRenderContext & renderContext()
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static QgsProject * instance()
Returns the QgsProject singleton instance.
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.
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)
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
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)
void setGeometryPartNum(int num)
Sets the part number of current geometry.
Abstract base class for marker symbol layers.
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.
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)
Sets the symbol size.
void setAngle(double angle)
Sets the rotation angle for the marker.
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)
Sets the map unit scale for the symbol's size.
void renderVertexMarker(QPointF pt, QgsRenderContext &context, int currentVertexMarkerType, int currentVertexMarkerSize)
Render editing vertex marker at specified point.
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.
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an outline...
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
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. ...
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.