QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
QgsHeatmapRenderer Class Reference

A renderer which draws points as a live heatmap. More...

#include <qgsheatmaprenderer.h>

Inheritance diagram for QgsHeatmapRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsHeatmapRenderer ()
virtual ~QgsHeatmapRenderer ()
virtual QgsFeatureRendererV2clone () const override
QgsVectorColorRampV2colorRamp () const
 Returns the color ramp used for shading the heatmap.
virtual QString dump () const override
 for debugging
double invertRamp () const
 Returns whether the ramp is inverted.
double maximumValue () const
 Returns the maximum value used for shading the heatmap.
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context) override
 Allows for a renderer to modify the extent of a feature request prior to rendering.
double radius () const
 Returns the radius for the heatmap.
const QgsMapUnitScaleradiusMapUnitScale () const
 Returns the map unit scale used for the heatmap's radius.
QgsSymbolV2::OutputUnit radiusUnit () const
 Returns the units used for the heatmap's radius.
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) override
double renderQuality () const
 Returns the render quality used for drawing the heatmap.
virtual QDomElement save (QDomDocument &doc) override
 store renderer info to XML element
void setColorRamp (QgsVectorColorRampV2 *ramp)
 Sets the color ramp to use for shading the heatmap.
void setInvertRamp (const bool invert)
 Sets whether the ramp is inverted.
void setMaximumValue (const double value)
 Sets the maximum value used for shading the heatmap.
void setRadius (const double radius)
 Sets the radius for the heatmap.
void setRadiusMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale used for the heatmap's radius.
void setRadiusUnit (const QgsSymbolV2::OutputUnit unit)
 Sets the units used for the heatmap's radius.
void setRenderQuality (const int quality)
 Sets the render quality used for drawing the heatmap.
void setWeightExpression (const QString &expression)
 Sets the expression used for weighting points when generating the heatmap.
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
virtual void stopRender (QgsRenderContext &context) override
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature) override
 to be overridden
virtual QgsSymbolV2List symbols () override
 for symbol levels
virtual QList< QString > usedAttributes () override
QString weightExpression () const
 Returns the expression used for weighting points when generating the heatmap.
- Public Member Functions inherited from QgsFeatureRendererV2
virtual ~QgsFeatureRendererV2 ()
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer
virtual void checkLegendSymbolItem (QString key, bool state=true)
 item in symbology was checked
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend.
virtual bool legendSymbolItemChecked (QString key)
 items of symbology items in legend is checked
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, QString rule="")
 return a list of item text / symbol
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend.
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature)
 Return symbol for feature.
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
virtual QString rotationField () const
 return rotation field name (or empty string if not set or not supported by renderer)
virtual void setRotationField (QString fieldName)
 sets rotation field of renderer (if supported by the renderer)
void setUsingSymbolLevels (bool usingSymbolLevels)
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 return list of symbols used for rendering the feature.
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs
QString type () const
bool usingSymbolLevels () const
virtual bool willRenderFeature (QgsFeature &feat)
 return whether the renderer will render a feature or not.
virtual Q_DECL_DEPRECATED
QDomElement 
writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name

Static Public Member Functions

static QgsHeatmapRendererconvertFromRenderer (const QgsFeatureRendererV2 *renderer)
static QgsFeatureRendererV2create (QDomElement &element)
- Static Public Member Functions inherited from QgsFeatureRendererV2
static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element
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

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 (QString type)
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
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline
void setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod)
- Static Protected Member Functions inherited from QgsFeatureRendererV2
static const unsigned char * _getLineString (QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb)
static const unsigned char * _getPoint (QPointF &pt, QgsRenderContext &context, const unsigned char *wkb)
static const unsigned char * _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, const unsigned char *wkb)
- Protected Attributes inherited from QgsFeatureRendererV2
int mCurrentVertexMarkerSize
 The current size of editing marker.
int mCurrentVertexMarkerType
 The current type of editing marker.
QString mType
bool mUsingSymbolLevels

Detailed Description

A renderer which draws points as a live heatmap.

Note
Added in version 2.7

Definition at line 33 of file qgsheatmaprenderer.h.

Constructor & Destructor Documentation

QgsHeatmapRenderer::QgsHeatmapRenderer ( )

Definition at line 32 of file qgsheatmaprenderer.cpp.

QgsHeatmapRenderer::~QgsHeatmapRenderer ( )
virtual

Definition at line 50 of file qgsheatmaprenderer.cpp.

Member Function Documentation

QgsFeatureRendererV2 * QgsHeatmapRenderer::clone ( ) const
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 291 of file qgsheatmaprenderer.cpp.

QgsVectorColorRampV2* QgsHeatmapRenderer::colorRamp ( ) const
inline

Returns the color ramp used for shading the heatmap.

Returns
color ramp for heatmap
See Also
setColorRamp

Definition at line 63 of file qgsheatmaprenderer.h.

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

Definition at line 400 of file qgsheatmaprenderer.cpp.

QgsFeatureRendererV2 * QgsHeatmapRenderer::create ( QDomElement &  element)
static

Definition at line 333 of file qgsheatmaprenderer.cpp.

QString QgsHeatmapRenderer::dump ( ) const
overridevirtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 286 of file qgsheatmaprenderer.cpp.

double QgsHeatmapRenderer::invertRamp ( ) const
inline

Returns whether the ramp is inverted.

Returns
true if color ramp is inverted
See Also
setInvertRamp
colorRamp

Definition at line 75 of file qgsheatmaprenderer.h.

double QgsHeatmapRenderer::maximumValue ( ) const
inline

Returns the maximum value used for shading the heatmap.

Returns
maximum value for heatmap shading. If 0, then maximum value will be automatically calculated.
See Also
setMaximumValue

Definition at line 133 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::modifyRequestExtent ( QgsRectangle extent,
QgsRenderContext context 
)
overridevirtual

Allows for a renderer to modify the extent of a feature request prior to rendering.

Parameters
extentreference to request's filter extent. Modify extent to change the extent of feature request
contextrender context
Note
added in QGIS 2.7

Reimplemented from QgsFeatureRendererV2.

Definition at line 309 of file qgsheatmaprenderer.cpp.

double QgsHeatmapRenderer::radius ( ) const
inline

Returns the radius for the heatmap.

Returns
heatmap radius
See Also
setRadius
radiusUnit
radiusMapUnitScale

Definition at line 89 of file qgsheatmaprenderer.h.

const QgsMapUnitScale& QgsHeatmapRenderer::radiusMapUnitScale ( ) const
inline

Returns the map unit scale used for the heatmap's radius.

Returns
map unit scale for heatmap's radius
See Also
radius
radiusUnit
setRadiusMapUnitScale

Definition at line 119 of file qgsheatmaprenderer.h.

QgsSymbolV2::OutputUnit QgsHeatmapRenderer::radiusUnit ( ) const
inline

Returns the units used for the heatmap's radius.

Returns
units for heatmap radius
See Also
radius
setRadiusUnit
radiusMapUnitScale

Definition at line 104 of file qgsheatmaprenderer.h.

bool QgsHeatmapRenderer::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
)
overridevirtual

Reimplemented from QgsFeatureRendererV2.

Definition at line 99 of file qgsheatmaprenderer.cpp.

double QgsHeatmapRenderer::renderQuality ( ) const
inline

Returns the render quality used for drawing the heatmap.

Returns
render quality. A value of 1 indicates maximum quality, and increasing the value will result in faster drawing but lower quality rendering.
See Also
setRenderQuality

Definition at line 146 of file qgsheatmaprenderer.h.

QDomElement QgsHeatmapRenderer::save ( QDomDocument &  doc)
overridevirtual

store renderer info to XML element

Reimplemented from QgsFeatureRendererV2.

Definition at line 352 of file qgsheatmaprenderer.cpp.

void QgsHeatmapRenderer::setColorRamp ( QgsVectorColorRampV2 ramp)

Sets the color ramp to use for shading the heatmap.

Parameters
rampcolor ramp for heatmap. Ownership of ramp is transferred to the renderer.
See Also
colorRamp

Definition at line 412 of file qgsheatmaprenderer.cpp.

void QgsHeatmapRenderer::setInvertRamp ( const bool  invert)
inline

Sets whether the ramp is inverted.

Parameters
invertset to true to invert color ramp
See Also
invertRamp
setColorRamp

Definition at line 81 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setMaximumValue ( const double  value)
inline

Sets the maximum value used for shading the heatmap.

Parameters
valuemaximum value for heatmap shading. Set to 0 for automatic calculation of maximum value.
See Also
maximumValue

Definition at line 139 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setRadius ( const double  radius)
inline

Sets the radius for the heatmap.

Parameters
radiusheatmap radius
See Also
radius
setRadiusUnit
setRadiusMapUnitScale

Definition at line 96 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setRadiusMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale used for the heatmap's radius.

Parameters
scalemap unit scale for heatmap's radius
See Also
setRadius
setRadiusUnit
radiusMapUnitScale

Definition at line 126 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setRadiusUnit ( const QgsSymbolV2::OutputUnit  unit)
inline

Sets the units used for the heatmap's radius.

Parameters
unitunits for heatmap radius
See Also
radiusUnit
setRadius
radiusMapUnitScale

Definition at line 111 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setRenderQuality ( const int  quality)
inline

Sets the render quality used for drawing the heatmap.

Parameters
qualityrender quality. A value of 1 indicates maximum quality, and increasing the value will result in faster drawing but lower quality rendering.
See Also
renderQuality

Definition at line 152 of file qgsheatmaprenderer.h.

void QgsHeatmapRenderer::setWeightExpression ( const QString &  expression)
inline

Sets the expression used for weighting points when generating the heatmap.

Parameters
expressionpoint weight expression. If set to empty, all points are equally weighted.
See Also
weightExpression

Definition at line 164 of file qgsheatmaprenderer.h.

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

Implements QgsFeatureRendererV2.

Definition at line 65 of file qgsheatmaprenderer.cpp.

void QgsHeatmapRenderer::stopRender ( QgsRenderContext context)
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 235 of file qgsheatmaprenderer.cpp.

QgsSymbolV2 * QgsHeatmapRenderer::symbolForFeature ( QgsFeature feature)
overridevirtual

to be overridden

Parameters
featurefeature
Returns
returns pointer to symbol or 0 if symbol was not found

Implements QgsFeatureRendererV2.

Definition at line 372 of file qgsheatmaprenderer.cpp.

QgsSymbolV2List QgsHeatmapRenderer::symbols ( )
overridevirtual

for symbol levels

Implements QgsFeatureRendererV2.

Definition at line 378 of file qgsheatmaprenderer.cpp.

QList< QString > QgsHeatmapRenderer::usedAttributes ( )
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 383 of file qgsheatmaprenderer.cpp.

QString QgsHeatmapRenderer::weightExpression ( ) const
inline

Returns the expression used for weighting points when generating the heatmap.

Returns
point weight expression. If empty, all points are equally weighted.
See Also
setWeightExpression

Definition at line 158 of file qgsheatmaprenderer.h.


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