29 #include <QGridLayout> 80 QLabel *label =
new QLabel( tr(
"The heatmap renderer only applies to point and multipoint layers. \n" 81 "'%1' is not a point layer and cannot be rendered as a heatmap." )
82 .arg( layer->
name() ),
this );
83 layout()->addWidget( label );
89 connect( mRadiusSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged );
90 connect( mMaxSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged );
91 connect( mQualitySlider, &QSlider::valueChanged,
this, &QgsHeatmapRendererWidget::mQualitySlider_valueChanged );
92 this->layout()->setContentsMargins( 0, 0, 0, 0 );
96 mWeightExpressionWidget->registerExpressionContextGenerator(
this );
107 btnColorRamp->setShowGradientOnly(
true );
113 btnColorRamp->blockSignals(
true );
114 btnColorRamp->setColorRamp( mRenderer->
colorRamp() );
115 btnColorRamp->blockSignals(
false );
117 mRadiusSpinBox->blockSignals(
true );
118 mRadiusSpinBox->setValue( mRenderer->
radius() );
119 mRadiusSpinBox->blockSignals(
false );
120 mRadiusUnitWidget->blockSignals(
true );
121 mRadiusUnitWidget->setUnit( mRenderer->
radiusUnit() );
123 mRadiusUnitWidget->blockSignals(
false );
124 mMaxSpinBox->blockSignals(
true );
126 mMaxSpinBox->blockSignals(
false );
127 mQualitySlider->blockSignals(
true );
129 mQualitySlider->blockSignals(
false );
131 mWeightExpressionWidget->setLayer( layer );
145 mRadiusUnitWidget->setMapCanvas( context.
mapCanvas() );
148 void QgsHeatmapRendererWidget::applyColorRamp()
163 void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
175 void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged(
double d )
186 void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged(
double d )
197 void QgsHeatmapRendererWidget::mQualitySlider_valueChanged(
int v )
208 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...
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.
Points (e.g., for font sizes)
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...