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 );
 
  112     mRenderer = std::make_unique< QgsHeatmapRenderer >();
 
  115   btnColorRamp->setShowGradientOnly( 
true );
 
  119   if ( mRenderer->colorRamp() )
 
  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() );
 
  130   mRadiusUnitWidget->setMapUnitScale( mRenderer->radiusMapUnitScale() );
 
  131   mRadiusUnitWidget->blockSignals( 
false );
 
  132   mMaxSpinBox->blockSignals( 
true );
 
  133   mMaxSpinBox->setValue( mRenderer->maximumValue() );
 
  134   mMaxSpinBox->blockSignals( 
false );
 
  135   mQualitySlider->blockSignals( 
true );
 
  136   mQualitySlider->setValue( mRenderer->renderQuality() );
 
  137   mQualitySlider->blockSignals( 
false );
 
  139   mWeightExpressionWidget->setLayer( layer );
 
  140   mWeightExpressionWidget->setField( mRenderer->weightExpression() );
 
  148   return mRenderer.get();
 
  155     mRadiusUnitWidget->setMapCanvas( lMapCanvas );
 
  158 void QgsHeatmapRendererWidget::applyColorRamp()
 
  169   mRenderer->setColorRamp( ramp );
 
  173 void QgsHeatmapRendererWidget::mRadiusUnitWidget_changed()
 
  180   mRenderer->setRadiusUnit( mRadiusUnitWidget->unit() );
 
  181   mRenderer->setRadiusMapUnitScale( mRadiusUnitWidget->getMapUnitScale() );
 
  185 void QgsHeatmapRendererWidget::mRadiusSpinBox_valueChanged( 
double d )
 
  192   mRenderer->setRadius( d );
 
  196 void QgsHeatmapRendererWidget::mMaxSpinBox_valueChanged( 
double d )
 
  203   mRenderer->setMaximumValue( d );
 
  207 void QgsHeatmapRendererWidget::mQualitySlider_valueChanged( 
int v )
 
  214   mRenderer->setRenderQuality( v );
 
  218 void QgsHeatmapRendererWidget::weightExpressionChanged( 
const QString &expression )
 
  220   mRenderer->setWeightExpression( expression );
 
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.
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.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
@ RenderPoints
Points (e.g., for font sizes)
@ RenderMillimeters
Millimeters.
@ RenderMapUnits
Map units.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.