29 #include <QGridLayout> 79 QLabel *label =
new QLabel( tr(
"The heatmap renderer only applies to point and multipoint layers. \n" 80 "'%1' is not a point layer and cannot be rendered as a heatmap." )
81 .arg( layer->
name() ),
this );
82 layout()->addWidget( label );
88 connect( mRadiusSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged );
89 connect( mMaxSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged );
90 connect( mQualitySlider, &QSlider::valueChanged,
this, &QgsHeatmapRendererWidget::mQualitySlider_valueChanged );
91 this->layout()->setContentsMargins( 0, 0, 0, 0 );
95 mWeightExpressionWidget->registerExpressionContextGenerator(
this );
106 btnColorRamp->setShowGradientOnly(
true );
112 btnColorRamp->blockSignals(
true );
113 btnColorRamp->setColorRamp( mRenderer->
colorRamp() );
114 btnColorRamp->blockSignals(
false );
116 mRadiusSpinBox->blockSignals(
true );
117 mRadiusSpinBox->setValue( mRenderer->
radius() );
118 mRadiusSpinBox->blockSignals(
false );
119 mRadiusUnitWidget->blockSignals(
true );
120 mRadiusUnitWidget->setUnit( mRenderer->
radiusUnit() );
122 mRadiusUnitWidget->blockSignals(
false );
123 mMaxSpinBox->blockSignals(
true );
125 mMaxSpinBox->blockSignals(
false );
126 mQualitySlider->blockSignals(
true );
128 mQualitySlider->blockSignals(
false );
130 mWeightExpressionWidget->setLayer( layer );
144 mRadiusUnitWidget->setMapCanvas( context.
mapCanvas() );
147 void QgsHeatmapRendererWidget::applyColorRamp()
162 void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
174 void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged(
double d )
185 void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged(
double d )
196 void QgsHeatmapRendererWidget::mQualitySlider_valueChanged(
int v )
207 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...