QGIS API Documentation  2.13.0-Master
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
QgsSingleSymbolRendererV2 Class Reference

#include <qgssinglesymbolrendererv2.h>

Inheritance diagram for QgsSingleSymbolRendererV2:
Inheritance graph
[legend]

Public Member Functions

 QgsSingleSymbolRendererV2 (QgsSymbolV2 *symbol)
 
virtual ~QgsSingleSymbolRendererV2 ()
 
virtual int capabilities () override
 returns bitwise OR-ed capabilities of the renderer More...
 
virtual QgsSingleSymbolRendererV2clone () const override
 
virtual QString dump () const override
 for debugging More...
 
virtual QSet< QStringlegendKeysForFeature (QgsFeature &feature, QgsRenderContext &context) override
 Return legend keys matching a specified feature. More...
 
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, const QString &rule=QString()) override
 return a list of item text / symbol More...
 
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const override
 Return a list of symbology items for the legend. More...
 
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize) override
 return a list of symbology items for the legend More...
 
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 
Q_DECL_DEPRECATED QString rotationField () const override
 return rotation field name (or empty string if not set or not supported by renderer) More...
 
virtual QDomElement save (QDomDocument &doc) override
 store renderer info to XML element More...
 
QgsSymbolV2::ScaleMethod scaleMethod () const
 
Q_DECL_DEPRECATED void setRotationField (const QString &fieldOrExpression) override
 sets rotation field of renderer (if supported by the renderer) More...
 
void setScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
 
void setSizeScaleField (const QString &fieldOrExpression)
 
void setSymbol (QgsSymbolV2 *s)
 
QString sizeScaleField () const
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
 Needs to be called when a new render cycle is started. More...
 
virtual void stopRender (QgsRenderContext &context) override
 Needs to be called when a render cycle has finished to clean up. More...
 
QgsSymbolV2symbol () const
 
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 
virtual QgsSymbolV2List symbols (QgsRenderContext &context) override
 
virtual void toSld (QDomDocument &doc, QDomElement &element) const override
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
virtual QList< QStringusedAttributes () override
 Returns a set of attributes required for this renderer. More...
 
- Public Member Functions inherited from QgsFeatureRendererV2
virtual ~QgsFeatureRendererV2 ()
 
virtual void checkLegendSymbolItem (const QString &key, bool state=true)
 item in symbology was checked More...
 
virtual QString filter (const QgsFields &fields=QgsFields())
 If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More...
 
bool forceRasterRender () const
 Returns whether the renderer must render as a raster. More...
 
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend. More...
 
virtual bool legendSymbolItemChecked (const QString &key)
 items of symbology items in legend is checked More...
 
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable More...
 
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering. More...
 
QgsFeatureRequest::OrderBy orderBy () const
 Get the order in which features shall be processed by this renderer. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2originalSymbolForFeature (QgsFeature &feature)
 Return symbol for feature. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the renderer. More...
 
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
 Render a feature using this renderer in the given context. More...
 
void setForceRasterRender (bool forceRaster)
 Sets whether the renderer should be rendered to a raster destination. More...
 
virtual void setLegendSymbolItem (const QString &key, QgsSymbolV2 *symbol)
 Sets the symbol to be used for a legend symbol item. More...
 
void setOrderBy (const QgsFeatureRequest::OrderBy &orderBy)
 Define the order in which features shall be processed by this renderer. More...
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the renderer. More...
 
void setUsingSymbolLevels (bool usingSymbolLevels)
 
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering More...
 
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
 
virtual Q_DECL_DEPRECATED QgsSymbolV2symbolForFeature (QgsFeature &feature)
 To be overridden. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols ()
 For symbol levels. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 Returns list of symbols used for rendering the feature. More...
 
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns list of symbols used for rendering the feature. More...
 
QString type () const
 
bool usingSymbolLevels () const
 
virtual Q_DECL_DEPRECATED bool willRenderFeature (QgsFeature &feat)
 Returns whether the renderer will render a feature or not. More...
 
virtual bool willRenderFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns whether the renderer will render a feature or not. More...
 
virtual Q_DECL_DEPRECATED QDomElement writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 

Static Public Member Functions

static QgsSingleSymbolRendererV2convertFromRenderer (const QgsFeatureRendererV2 *renderer)
 creates a QgsSingleSymbolRendererV2 from an existing renderer. More...
 
static QgsFeatureRendererV2create (QDomElement &element)
 create renderer from XML element More...
 
static QgsFeatureRendererV2createFromSld (QDomElement &element, QGis::GeometryType geomType)
 
- Static Public Member Functions inherited from QgsFeatureRendererV2
static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers More...
 
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element More...
 
static QgsFeatureRendererV2loadSld (const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage)
 Create a new renderer according to the information contained in the UserStyle element of a SLD style document. More...
 

Protected Attributes

double mOrigSize
 
QScopedPointer< QgsExpressionmRotation
 
QgsSymbolV2::ScaleMethod mScaleMethod
 
QScopedPointer< QgsExpressionmSizeScale
 
QScopedPointer< QgsSymbolV2mSymbol
 
QScopedPointer< QgsSymbolV2mTempSymbol
 
- Protected Attributes inherited from QgsFeatureRendererV2
int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 
int mCurrentVertexMarkerType
 The current type of editing marker. More...
 
bool mForceRaster
 
QgsFeatureRequest::OrderBy mOrderBy
 
QgsPaintEffectmPaintEffect
 
QString mType
 
bool mUsingSymbolLevels
 

Additional Inherited Members

- Public Types inherited from QgsFeatureRendererV2
enum  Capabilities {
  SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3,
  ScaleDependent = 1 << 4
}
 
- Protected Member Functions inherited from QgsFeatureRendererV2
 QgsFeatureRendererV2 (const QString &type)
 
Q_DECL_DEPRECATED void copyPaintEffect (QgsFeatureRendererV2 *destRenderer) const
 Copies paint effect of this renderer to another renderer. More...
 
void copyRendererData (QgsFeatureRendererV2 *destRenderer) const
 Clones generic renderer data to another renderer. More...
 
void renderFeatureWithSymbol (QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
 
void renderVertexMarker (QPointF pt, QgsRenderContext &context)
 render editing vertex marker at specified point More...
 
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon More...
 
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline More...
 
void setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod)
 
- Static Protected Member Functions inherited from QgsFeatureRendererV2
static QgsConstWkbPtr _getLineString (QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr wkb, bool clipToExtent=true)
 
static QgsConstWkbPtr _getPoint (QPointF &pt, QgsRenderContext &context, QgsConstWkbPtr wkb)
 
static QgsConstWkbPtr _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr wkb, bool clipToExtent=true)
 
static void convertSymbolRotation (QgsSymbolV2 *symbol, const QString &field)
 
static void convertSymbolSizeScale (QgsSymbolV2 *symbol, QgsSymbolV2::ScaleMethod method, const QString &field)
 

Detailed Description

Definition at line 25 of file qgssinglesymbolrendererv2.h.

Constructor & Destructor Documentation

QgsSingleSymbolRendererV2::QgsSingleSymbolRendererV2 ( QgsSymbolV2 symbol)

Definition at line 36 of file qgssinglesymbolrendererv2.cpp.

QgsSingleSymbolRendererV2::~QgsSingleSymbolRendererV2 ( )
virtual

Definition at line 45 of file qgssinglesymbolrendererv2.cpp.

Member Function Documentation

virtual int QgsSingleSymbolRendererV2::capabilities ( )
inlineoverridevirtual

returns bitwise OR-ed capabilities of the renderer

Reimplemented from QgsFeatureRendererV2.

Definition at line 65 of file qgssinglesymbolrendererv2.h.

QgsSingleSymbolRendererV2 * QgsSingleSymbolRendererV2::clone ( ) const
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 199 of file qgssinglesymbolrendererv2.cpp.

QgsSingleSymbolRendererV2 * QgsSingleSymbolRendererV2::convertFromRenderer ( const QgsFeatureRendererV2 renderer)
static

creates a QgsSingleSymbolRendererV2 from an existing renderer.

Note
added in 2.5
Returns
a new renderer if the conversion was possible, otherwise 0.

Definition at line 451 of file qgssinglesymbolrendererv2.cpp.

QgsFeatureRendererV2 * QgsSingleSymbolRendererV2::create ( QDomElement element)
static

create renderer from XML element

Definition at line 236 of file qgssinglesymbolrendererv2.cpp.

QgsFeatureRendererV2 * QgsSingleSymbolRendererV2::createFromSld ( QDomElement element,
QGis::GeometryType  geomType 
)
static

Definition at line 270 of file qgssinglesymbolrendererv2.cpp.

QString QgsSingleSymbolRendererV2::dump ( void  ) const
overridevirtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 194 of file qgssinglesymbolrendererv2.cpp.

QSet< QString > QgsSingleSymbolRendererV2::legendKeysForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual

Return legend keys matching a specified feature.

Note
added in 2.14

Reimplemented from QgsFeatureRendererV2.

Definition at line 444 of file qgssinglesymbolrendererv2.cpp.

QgsLegendSymbolList QgsSingleSymbolRendererV2::legendSymbolItems ( double  scaleDenominator = -1,
const QString rule = QString() 
)
overridevirtual

return a list of item text / symbol

Note
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 404 of file qgssinglesymbolrendererv2.cpp.

QgsLegendSymbolListV2 QgsSingleSymbolRendererV2::legendSymbolItemsV2 ( ) const
overridevirtual

Return a list of symbology items for the legend.

Better choice than legendSymbolItems().

Note
added in 2.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 413 of file qgssinglesymbolrendererv2.cpp.

QgsLegendSymbologyList QgsSingleSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
overridevirtual

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 393 of file qgssinglesymbolrendererv2.cpp.

QgsSymbolV2 * QgsSingleSymbolRendererV2::originalSymbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual
Note
available in python as originalSymbolForFeature2

Reimplemented from QgsFeatureRendererV2.

Definition at line 78 of file qgssinglesymbolrendererv2.cpp.

QString QgsSingleSymbolRendererV2::rotationField ( ) const
overridevirtual

return rotation field name (or empty string if not set or not supported by renderer)

Deprecated:
use the symbol's methods instead

Reimplemented from QgsFeatureRendererV2.

Definition at line 166 of file qgssinglesymbolrendererv2.cpp.

QDomElement QgsSingleSymbolRendererV2::save ( QDomDocument doc)
overridevirtual

store renderer info to XML element

Reimplemented from QgsFeatureRendererV2.

Definition at line 358 of file qgssinglesymbolrendererv2.cpp.

QgsSymbolV2::ScaleMethod QgsSingleSymbolRendererV2::scaleMethod ( ) const
inline

Definition at line 55 of file qgssinglesymbolrendererv2.h.

void QgsSingleSymbolRendererV2::setRotationField ( const QString fieldName)
overridevirtual

sets rotation field of renderer (if supported by the renderer)

Deprecated:
use the symbol's methods instead

Reimplemented from QgsFeatureRendererV2.

Definition at line 157 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::setScaleMethod ( QgsSymbolV2::ScaleMethod  scaleMethod)

Definition at line 188 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::setSizeScaleField ( const QString fieldOrExpression)

Definition at line 178 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::setSymbol ( QgsSymbolV2 s)

Definition at line 151 of file qgssinglesymbolrendererv2.cpp.

QString QgsSingleSymbolRendererV2::sizeScaleField ( ) const

Definition at line 183 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::startRender ( QgsRenderContext context,
const QgsFields fields 
)
overridevirtual

Needs to be called when a new render cycle is started.

Parameters
contextAdditional information passed to the renderer about the job which will be rendered
fieldsThe fields available for rendering
Returns
Information passed back from the renderer that can e.g. be used to reduce the amount of requested features

Implements QgsFeatureRendererV2.

Definition at line 85 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::stopRender ( QgsRenderContext context)
overridevirtual

Needs to be called when a render cycle has finished to clean up.

Implements QgsFeatureRendererV2.

Definition at line 123 of file qgssinglesymbolrendererv2.cpp.

QgsSymbolV2 * QgsSingleSymbolRendererV2::symbol ( ) const

Definition at line 146 of file qgssinglesymbolrendererv2.cpp.

QgsSymbolV2 * QgsSingleSymbolRendererV2::symbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual
Note
available in python as symbolForFeature2

Reimplemented from QgsFeatureRendererV2.

Definition at line 49 of file qgssinglesymbolrendererv2.cpp.

QgsSymbolV2List QgsSingleSymbolRendererV2::symbols ( QgsRenderContext context)
overridevirtual
Note
available in python as symbol2

Reimplemented from QgsFeatureRendererV2.

Definition at line 227 of file qgssinglesymbolrendererv2.cpp.

void QgsSingleSymbolRendererV2::toSld ( QDomDocument doc,
QDomElement element 
) const
overridevirtual

used from subclasses to create SLD Rule elements following SLD v1.1 specs

Reimplemented from QgsFeatureRendererV2.

Definition at line 208 of file qgssinglesymbolrendererv2.cpp.

QList< QString > QgsSingleSymbolRendererV2::usedAttributes ( )
overridevirtual

Returns a set of attributes required for this renderer.

TODO QGIS3: Change QList to QSet

Implements QgsFeatureRendererV2.

Definition at line 137 of file qgssinglesymbolrendererv2.cpp.

Member Data Documentation

double QgsSingleSymbolRendererV2::mOrigSize
protected

Definition at line 102 of file qgssinglesymbolrendererv2.h.

QScopedPointer<QgsExpression> QgsSingleSymbolRendererV2::mRotation
protected

Definition at line 96 of file qgssinglesymbolrendererv2.h.

QgsSymbolV2::ScaleMethod QgsSingleSymbolRendererV2::mScaleMethod
protected

Definition at line 98 of file qgssinglesymbolrendererv2.h.

QScopedPointer<QgsExpression> QgsSingleSymbolRendererV2::mSizeScale
protected

Definition at line 97 of file qgssinglesymbolrendererv2.h.

QScopedPointer<QgsSymbolV2> QgsSingleSymbolRendererV2::mSymbol
protected

Definition at line 95 of file qgssinglesymbolrendererv2.h.

QScopedPointer<QgsSymbolV2> QgsSingleSymbolRendererV2::mTempSymbol
protected

Definition at line 101 of file qgssinglesymbolrendererv2.h.


The documentation for this class was generated from the following files: