27 #include <QGridLayout> 48 QGridLayout* layout =
new QGridLayout(
this );
49 QLabel* label =
new QLabel(
tr(
"The heatmap renderer only applies to point and multipoint layers. \n" 50 "'%1' is not a point layer and cannot be rendered as a heatmap." )
51 .arg( layer->
name() ),
this );
52 layout->addWidget( label );
57 mRadiusUnitWidget->setUnits( QStringList() <<
tr(
"Pixels" ) <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 2 );
68 mRampComboBox->setShowGradientOnly(
true );
70 connect( mRampComboBox, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( applyColorRamp() ) );
73 mRampComboBox->blockSignals(
true );
75 mRampComboBox->blockSignals(
false );
77 mRadiusSpinBox->blockSignals(
true );
79 mRadiusSpinBox->blockSignals(
false );
80 mRadiusUnitWidget->blockSignals(
true );
84 mRadiusUnitWidget->setUnit( 1 );
87 mRadiusUnitWidget->setUnit( 2 );
91 mRadiusUnitWidget->setUnit( 0 );
95 mRadiusUnitWidget->blockSignals(
false );
96 mMaxSpinBox->blockSignals(
true );
98 mMaxSpinBox->blockSignals(
false );
99 mQualitySlider->blockSignals(
true );
101 mQualitySlider->blockSignals(
false );
102 mInvertCheckBox->blockSignals(
true );
104 mInvertCheckBox->blockSignals(
false );
106 mWeightExpressionWidget->setLayer( layer );
108 connect( mWeightExpressionWidget, SIGNAL( fieldChanged( QString ) ),
this, SLOT( weightExpressionChanged( QString ) ) );
116 void QgsHeatmapRendererWidget::applyColorRamp()
130 void QgsHeatmapRendererWidget::on_mButtonEditRamp_clicked()
138 if ( dlg.exec() && gradRamp )
141 mRampComboBox->blockSignals(
true );
143 mRampComboBox->blockSignals(
false );
152 void QgsHeatmapRendererWidget::on_mRadiusUnitWidget_changed()
159 switch ( mRadiusUnitWidget->getUnit() )
177 void QgsHeatmapRendererWidget::on_mRadiusSpinBox_valueChanged(
double d )
187 void QgsHeatmapRendererWidget::on_mMaxSpinBox_valueChanged(
double d )
197 void QgsHeatmapRendererWidget::on_mQualitySlider_valueChanged(
int v )
207 void QgsHeatmapRendererWidget::on_mInvertCheckBox_toggled(
bool v )
217 void QgsHeatmapRendererWidget::weightExpressionChanged( QString expression )
void setInvertRamp(const bool invert)
Sets whether the ramp is inverted.
virtual QString type() const =0
QgsSymbolV2::OutputUnit radiusUnit() const
Returns the units used for the heatmap's radius.
double maximumValue() const
Returns the maximum value used for shading the heatmap.
void setWeightExpression(const QString &expression)
Sets the expression used for weighting points when generating the heatmap.
QgsVectorColorRampV2 * colorRamp() const
Returns the color ramp used for shading the heatmap.
void setRadiusUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units used for the heatmap's radius.
const QString & name() const
Get the display name of the layer.
A renderer which draws points as a live heatmap.
const QgsMapUnitScale & radiusMapUnitScale() const
Returns the map unit scale used for the heatmap's radius.
double radius() const
Returns the radius for the heatmap.
void setRadiusMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the heatmap's radius.
virtual QgsVectorColorRampV2 * clone() const =0
static QgsStyleV2 * defaultStyle()
return default application-wide style
QGis::GeometryType geometryType() const
Returns point, line or polygon.
void setRenderQuality(const int quality)
Sets the render quality used for drawing the heatmap.
void setRadius(const double radius)
Sets the radius for the heatmap.
double renderQuality() const
Returns the render quality used for drawing the heatmap.
void setColorRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp to use for shading the heatmap.
static QgsHeatmapRenderer * convertFromRenderer(const QgsFeatureRendererV2 *renderer)
double invertRamp() const
Returns whether the ramp is inverted.
Represents a vector layer which manages a vector based data sets.
QString weightExpression() const
Returns the expression used for weighting points when generating the heatmap.
void setMaximumValue(const double value)
Sets the maximum value used for shading the heatmap.