28 #include <QGridLayout> 78 QLabel *label =
new QLabel( tr(
"The heatmap renderer only applies to point and multipoint layers. \n" 79 "'%1' is not a point layer and cannot be rendered as a heatmap." )
80 .arg( layer->
name() ),
this );
81 layout()->addWidget( label );
87 connect( mRadiusSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged );
88 connect( mMaxSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged );
89 connect( mQualitySlider, &QSlider::valueChanged,
this, &QgsHeatmapRendererWidget::mQualitySlider_valueChanged );
90 this->layout()->setContentsMargins( 0, 0, 0, 0 );
94 mWeightExpressionWidget->registerExpressionContextGenerator(
this );
105 btnColorRamp->setShowGradientOnly(
true );
111 btnColorRamp->blockSignals(
true );
112 btnColorRamp->setColorRamp( mRenderer->
colorRamp() );
113 btnColorRamp->blockSignals(
false );
115 mRadiusSpinBox->blockSignals(
true );
116 mRadiusSpinBox->setValue( mRenderer->
radius() );
117 mRadiusSpinBox->blockSignals(
false );
118 mRadiusUnitWidget->blockSignals(
true );
119 mRadiusUnitWidget->setUnit( mRenderer->
radiusUnit() );
121 mRadiusUnitWidget->blockSignals(
false );
122 mMaxSpinBox->blockSignals(
true );
124 mMaxSpinBox->blockSignals(
false );
125 mQualitySlider->blockSignals(
true );
127 mQualitySlider->blockSignals(
false );
129 mWeightExpressionWidget->setLayer( layer );
143 mRadiusUnitWidget->setMapCanvas( context.
mapCanvas() );
146 void QgsHeatmapRendererWidget::applyColorRamp()
161 void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
173 void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged(
double d )
184 void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged(
double d )
195 void QgsHeatmapRendererWidget::mQualitySlider_valueChanged(
int v )
206 void QgsHeatmapRendererWidget::weightExpressionChanged(
const QString &expression )
double renderQuality() const
Returns the render quality used for drawing the heatmap.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp to use for shading the heatmap.
Abstract base class for color ramps.
double maximumValue() const
Returns the maximum value used for shading the heatmap.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
void setWeightExpression(const QString &expression)
Sets the expression used for weighting points when generating the heatmap.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
The QgsMapSettings class contains configuration for rendering of the map.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
A renderer which draws points as a live heatmap.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
void setRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the heatmap's radius.
double radius() const
Returns the radius for the heatmap.
const QgsMapUnitScale & radiusMapUnitScale() const
Returns the map unit scale used for the heatmap's radius.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
points (e.g., for font sizes)
QgsColorRamp * colorRamp() const
Returns the color ramp used for shading the heatmap.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setRenderQuality(const int quality)
Sets the render quality used for drawing the heatmap.
void setRadiusUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the heatmap's radius.
void setRadius(const double radius)
Sets the radius for the heatmap.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
static QgsExpressionContextScope * atlasScope(QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static QgsProject * instance()
Returns the QgsProject singleton instance.
static QgsHeatmapRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
QString weightExpression() const
Returns the expression used for weighting points when generating the heatmap.
Represents a vector layer which manages a vector based data sets.
void setMaximumValue(const double value)
Sets the maximum value used for shading the heatmap.
QgsUnitTypes::RenderUnit radiusUnit() const
Returns the units used for the heatmap's radius.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer...