2016-08-06 11:01:42 +02:00
|
|
|
class QgsHeatmapRenderer : QgsFeatureRenderer
|
2014-11-22 13:03:54 +11:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsheatmaprenderer.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsHeatmapRenderer();
|
|
|
|
virtual ~QgsHeatmapRenderer();
|
|
|
|
|
|
|
|
//reimplemented methods
|
2015-11-12 19:35:14 +11:00
|
|
|
virtual QgsHeatmapRenderer* clone() const /Factory/;
|
2015-07-22 10:46:13 +02:00
|
|
|
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
|
2014-11-22 13:03:54 +11:00
|
|
|
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
|
|
|
|
virtual void stopRender( QgsRenderContext& context );
|
2015-11-08 19:18:00 +00:00
|
|
|
//! @note symbolForFeature2 in python bindings
|
2016-09-12 16:50:14 +10:00
|
|
|
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
|
2015-11-08 19:18:00 +00:00
|
|
|
//! @note symbol2 in python bindings
|
2016-09-12 16:50:14 +10:00
|
|
|
virtual QgsSymbolList symbols( QgsRenderContext& context );
|
2014-11-22 13:03:54 +11:00
|
|
|
virtual QString dump() const;
|
2017-01-11 10:36:51 +10:00
|
|
|
virtual QSet<QString> usedAttributes( const QgsRenderContext& context ) const;
|
2016-08-06 11:01:42 +02:00
|
|
|
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;
|
2014-11-22 13:03:54 +11:00
|
|
|
virtual QDomElement save( QDomDocument& doc );
|
2016-08-06 11:01:42 +02:00
|
|
|
static QgsHeatmapRenderer* convertFromRenderer( const QgsFeatureRenderer* renderer ) /Factory/;
|
2014-11-22 13:03:54 +11:00
|
|
|
|
|
|
|
//reimplemented to extent the request so that points up to heatmap's radius distance outside
|
|
|
|
//visible area are included
|
|
|
|
virtual void modifyRequestExtent( QgsRectangle& extent, QgsRenderContext& context );
|
|
|
|
|
|
|
|
//heatmap specific methods
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the color ramp used for shading the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns color ramp for heatmap
|
|
|
|
* @see setColorRamp
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2016-08-24 10:56:29 +10:00
|
|
|
QgsColorRamp* colorRamp() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the color ramp to use for shading the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param ramp color ramp for heatmap. Ownership of ramp is transferred to the renderer.
|
|
|
|
* @see colorRamp
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2016-08-24 10:56:29 +10:00
|
|
|
void setColorRamp( QgsColorRamp* ramp /Transfer/ );
|
2014-11-30 10:26:17 +01:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the radius for the heatmap
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns heatmap radius
|
|
|
|
* @see setRadius
|
|
|
|
* @see radiusUnit
|
|
|
|
* @see radiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
double radius() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the radius for the heatmap
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param radius heatmap radius
|
|
|
|
* @see radius
|
|
|
|
* @see setRadiusUnit
|
|
|
|
* @see setRadiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
void setRadius( const double radius );
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the units used for the heatmap's radius
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns units for heatmap radius
|
|
|
|
* @see radius
|
|
|
|
* @see setRadiusUnit
|
|
|
|
* @see radiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2016-07-17 22:11:17 +10:00
|
|
|
QgsUnitTypes::RenderUnit radiusUnit() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the units used for the heatmap's radius
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param unit units for heatmap radius
|
|
|
|
* @see radiusUnit
|
|
|
|
* @see setRadius
|
|
|
|
* @see radiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2016-07-17 22:11:17 +10:00
|
|
|
void setRadiusUnit( const QgsUnitTypes::RenderUnit unit );
|
2014-11-22 13:03:54 +11:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the map unit scale used for the heatmap's radius
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns map unit scale for heatmap's radius
|
|
|
|
* @see radius
|
|
|
|
* @see radiusUnit
|
|
|
|
* @see setRadiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
const QgsMapUnitScale& radiusMapUnitScale() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the map unit scale used for the heatmap's radius
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param scale map unit scale for heatmap's radius
|
|
|
|
* @see setRadius
|
|
|
|
* @see setRadiusUnit
|
|
|
|
* @see radiusMapUnitScale
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
void setRadiusMapUnitScale( const QgsMapUnitScale& scale );
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the maximum value used for shading the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns maximum value for heatmap shading. If 0, then maximum value will be automatically
|
|
|
|
* calculated.
|
|
|
|
* @see setMaximumValue
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
double maximumValue() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the maximum value used for shading the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param value maximum value for heatmap shading. Set to 0 for automatic calculation of
|
|
|
|
* maximum value.
|
|
|
|
* @see maximumValue
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
void setMaximumValue( const double value );
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the render quality used for drawing the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @returns render quality. A value of 1 indicates maximum quality, and increasing the
|
|
|
|
* value will result in faster drawing but lower quality rendering.
|
|
|
|
* @see setRenderQuality
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
double renderQuality() const;
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the render quality used for drawing the heatmap.
|
2014-11-22 13:03:54 +11:00
|
|
|
* @param quality render quality. A value of 1 indicates maximum quality, and increasing the
|
|
|
|
* value will result in faster drawing but lower quality rendering.
|
|
|
|
* @see renderQuality
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-22 13:03:54 +11:00
|
|
|
void setRenderQuality( const int quality );
|
2014-11-30 10:26:17 +01:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Returns the expression used for weighting points when generating the heatmap.
|
2014-11-23 21:47:58 +11:00
|
|
|
* @returns point weight expression. If empty, all points are equally weighted.
|
|
|
|
* @see setWeightExpression
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-23 21:47:58 +11:00
|
|
|
QString weightExpression() const;
|
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets the expression used for weighting points when generating the heatmap.
|
2014-11-23 21:47:58 +11:00
|
|
|
* @param expression point weight expression. If set to empty, all points are equally weighted.
|
|
|
|
* @see weightExpression
|
2016-02-14 03:50:23 +01:00
|
|
|
*/
|
2014-11-23 21:47:58 +11:00
|
|
|
void setWeightExpression( const QString& expression );
|
2014-11-22 13:03:54 +11:00
|
|
|
|
|
|
|
};
|