46 expContext << generator->createExpressionContextScope();
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 );
84 setLayout(
new QGridLayout() );
85 layout()->addWidget( label );
91 connect( mRadiusSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged );
92 connect( mMaxSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged );
93 connect( mQualitySlider, &QSlider::valueChanged,
this, &QgsHeatmapRendererWidget::mQualitySlider_valueChanged );
94 this->layout()->setContentsMargins( 0, 0, 0, 0 );
102 mWeightExpressionWidget->registerExpressionContextGenerator(
this );
103 mWeightExpressionWidget->setAllowEmptyFieldName(
true );
111 mRenderer = std::make_unique< QgsHeatmapRenderer >();
116 btnColorRamp->setShowGradientOnly(
true );
120 if ( mRenderer->colorRamp() )
122 btnColorRamp->blockSignals(
true );
123 btnColorRamp->setColorRamp( mRenderer->colorRamp() );
124 btnColorRamp->blockSignals(
false );
126 mRadiusSpinBox->blockSignals(
true );
127 mRadiusSpinBox->setValue( mRenderer->radius() );
128 mRadiusSpinBox->blockSignals(
false );
129 mRadiusUnitWidget->blockSignals(
true );
130 mRadiusUnitWidget->setUnit( mRenderer->radiusUnit() );
131 mRadiusUnitWidget->setMapUnitScale( mRenderer->radiusMapUnitScale() );
132 mRadiusUnitWidget->blockSignals(
false );
133 mMaxSpinBox->blockSignals(
true );
134 mMaxSpinBox->setValue( mRenderer->maximumValue() );
135 mMaxSpinBox->blockSignals(
false );
136 mQualitySlider->blockSignals(
true );
137 mQualitySlider->setValue( mRenderer->renderQuality() );
138 mQualitySlider->blockSignals(
false );
140 mWeightExpressionWidget->setLayer( layer );
141 mWeightExpressionWidget->setField( mRenderer->weightExpression() );
149 return mRenderer.get();
156 mRadiusUnitWidget->setMapCanvas( lMapCanvas );
159void QgsHeatmapRendererWidget::applyColorRamp()
170 mRenderer->setColorRamp( ramp );
174void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
181 mRenderer->setRadiusUnit( mRadiusUnitWidget->unit() );
182 mRenderer->setRadiusMapUnitScale( mRadiusUnitWidget->getMapUnitScale() );
186void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged(
double d )
193 mRenderer->setRadius( d );
197void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged(
double d )
204 mRenderer->setMaximumValue( d );
208void QgsHeatmapRendererWidget::mQualitySlider_valueChanged(
int v )
215 mRenderer->setRenderQuality( v );
219void QgsHeatmapRendererWidget::weightExpressionChanged(
const QString &expression )
221 mRenderer->setWeightExpression( expression );
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ MetersInMapUnits
Meters value as Map units.
Abstract base class for color ramps.
Abstract interface for generating an expression context scope.
Single scope for storing variables and functions for use within a QgsExpressionContext.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * atlasScope(const 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.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
static QgsHeatmapRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
The QgsMapSettings class contains configuration for rendering of the map.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.