QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
30 #include <QGridLayout>
51 expContext << generator->createExpressionContextScope();
85 QLabel *label =
new QLabel( tr(
"The heatmap renderer only applies to point and multipoint layers. \n"
86 "'%1' is not a point layer and cannot be rendered as a heatmap." )
87 .arg( layer->
name() ),
this );
89 setLayout(
new QGridLayout() );
90 layout()->addWidget( label );
96 connect( mRadiusSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged );
97 connect( mMaxSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged );
98 connect( mQualitySlider, &QSlider::valueChanged,
this, &QgsHeatmapRendererWidget::mQualitySlider_valueChanged );
99 this->layout()->setContentsMargins( 0, 0, 0, 0 );
103 mWeightExpressionWidget->registerExpressionContextGenerator(
this );
104 mWeightExpressionWidget->setAllowEmptyFieldName(
true );
115 btnColorRamp->setShowGradientOnly(
true );
121 btnColorRamp->blockSignals(
true );
122 btnColorRamp->setColorRamp( mRenderer->
colorRamp() );
123 btnColorRamp->blockSignals(
false );
125 mRadiusSpinBox->blockSignals(
true );
126 mRadiusSpinBox->setValue( mRenderer->
radius() );
127 mRadiusSpinBox->blockSignals(
false );
128 mRadiusUnitWidget->blockSignals(
true );
129 mRadiusUnitWidget->setUnit( mRenderer->
radiusUnit() );
131 mRadiusUnitWidget->blockSignals(
false );
132 mMaxSpinBox->blockSignals(
true );
134 mMaxSpinBox->blockSignals(
false );
135 mQualitySlider->blockSignals(
true );
137 mQualitySlider->blockSignals(
false );
139 mWeightExpressionWidget->setLayer( layer );
153 mRadiusUnitWidget->setMapCanvas( lMapCanvas );
156 void QgsHeatmapRendererWidget::applyColorRamp()
171 void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
183 void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged(
double d )
194 void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged(
double d )
205 void QgsHeatmapRendererWidget::mQualitySlider_valueChanged(
int v )
216 void QgsHeatmapRendererWidget::weightExpressionChanged(
const QString &expression )
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for color ramps.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
QString weightExpression() const
Returns the expression used for weighting points when generating the heatmap.
QgsUnitTypes::RenderUnit radiusUnit() const
Returns the units used for the heatmap's radius.
@ RenderPoints
Points (e.g., for font sizes)
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
A renderer which draws points as a live heatmap.
static QgsProject * instance()
Returns the QgsProject singleton instance.
@ RenderMillimeters
Millimeters.
Abstract interface for generating an expression context scope.
void setRadius(const double radius)
Sets the radius for the heatmap.
void setRadiusUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the heatmap's radius.
void setMaximumValue(const double value)
Sets the maximum value used for shading the heatmap.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
double renderQuality() const
Returns the render quality used for drawing the heatmap.
void setWeightExpression(const QString &expression)
Sets the expression used for weighting points when generating the heatmap.
QgsColorRamp * colorRamp() const
Returns the color ramp used for shading the heatmap.
void setRenderQuality(const int quality)
Sets the render quality used for drawing the heatmap.
double maximumValue() const
Returns the maximum value used for shading the heatmap.
void setColorRamp(QgsColorRamp *ramp)
Sets the color ramp to use for shading the heatmap.
Single scope for storing variables and functions for use within a QgsExpressionContext.
static QgsHeatmapRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Represents a vector layer which manages a vector based data sets.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
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.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
The QgsMapSettings class contains configuration for rendering of the map.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
@ RenderMapUnits
Map units.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
const QgsMapUnitScale & radiusMapUnitScale() const
Returns the map unit scale used for the heatmap's radius.