48 setupBlankUi( layer->
name() );
52 connect( mRendererComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointClusterRendererWidget::mRendererComboBox_currentIndexChanged );
53 connect( mDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointClusterRendererWidget::mDistanceSpinBox_valueChanged );
55 connect( mRendererSettingsButton, &QPushButton::clicked,
this, &QgsPointClusterRendererWidget::mRendererSettingsButton_clicked );
56 this->layout()->setContentsMargins( 0, 0, 0, 0 );
72 blockAllSignals(
true );
76 QStringList::const_iterator it = rendererList.constBegin();
77 for ( ; it != rendererList.constEnd(); ++it )
79 if ( *it != QLatin1String(
"pointDisplacement" ) && *it != QLatin1String(
"pointCluster" ) && *it != QLatin1String(
"heatmapRenderer" ) )
86 mDistanceSpinBox->setValue( mRenderer->
tolerance() );
91 blockAllSignals(
false );
97 int rendererIndex = mRendererComboBox->findData( rendererName );
98 if ( rendererIndex != -1 )
100 mRendererComboBox->setCurrentIndex( rendererIndex );
101 mRendererComboBox_currentIndexChanged( rendererIndex );
105 connect( mCenterSymbolToolButton, &
QgsSymbolButton::changed,
this, &QgsPointClusterRendererWidget::centerSymbolChanged );
106 mCenterSymbolToolButton->setDialogTitle( tr(
"Cluster symbol" ) );
107 mCenterSymbolToolButton->setLayer(
mLayer );
108 mCenterSymbolToolButton->registerExpressionContextGenerator(
this );
124 if ( mDistanceUnitWidget )
125 mDistanceUnitWidget->setMapCanvas( context.
mapCanvas() );
126 if ( mCenterSymbolToolButton )
128 mCenterSymbolToolButton->setMapCanvas( context.
mapCanvas() );
129 mCenterSymbolToolButton->setMessageBar( context.
messageBar() );
133 void QgsPointClusterRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
135 QString rendererId = mRendererComboBox->itemData( index ).toString();
143 delete tempRenderWidget;
148 void QgsPointClusterRendererWidget::mRendererSettingsButton_clicked()
173 void QgsPointClusterRendererWidget::mDistanceSpinBox_valueChanged(
double d )
182 void QgsPointClusterRendererWidget::mDistanceUnitWidget_changed()
192 void QgsPointClusterRendererWidget::blockAllSignals(
bool block )
194 mRendererComboBox->blockSignals( block );
195 mCenterSymbolToolButton->blockSignals( block );
196 mDistanceSpinBox->blockSignals( block );
197 mDistanceUnitWidget->blockSignals( block );
212 const auto constScopes = scopes;
220 void QgsPointClusterRendererWidget::centerSymbolChanged()
226 void QgsPointClusterRendererWidget::updateRendererFromWidget()
236 void QgsPointClusterRendererWidget::setupBlankUi(
const QString &layerName )
238 QGridLayout *layout =
new QGridLayout(
this );
239 QLabel *label =
new QLabel( tr(
"The point cluster renderer only applies to (single) point layers. \n'%1' is not a (single) point layer and cannot be displayed by the point cluster renderer." ).arg( layerName ),
this );
240 layout->addWidget( label );
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
Single variable definition for use within a QgsExpressionContextScope.
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
void setClusterSymbol(QgsMarkerSymbol *symbol)
Sets the symbol for rendering clustered groups.
QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
QgsMarkerSymbol * clusterSymbol()
Returns the symbol used for rendering clustered groups (but not ownership of the symbol).
void setTolerance(double distance)
Sets the tolerance distance for grouping points.
void setToleranceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the distance tolerance.
void setToleranceUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the tolerance distance.
QStringList renderersList(QgsRendererAbstractMetadata::LayerTypes layerTypes=QgsRendererAbstractMetadata::All) const
Returns a list of available renderers.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
QgsUnitTypes::RenderUnit toleranceUnit() const
Returns the units for the tolerance distance.
A marker symbol type, for rendering Point and MultiPoint geometries.
static QgsPointClusterRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
Creates a QgsPointClusterRenderer from an existing renderer.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A renderer that automatically clusters points with the same geographic position.
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setAdditionalExpressionContextScopes(const QList< QgsExpressionContextScope > &scopes)
Sets a list of additional expression context scopes to show as available within the layer...
double tolerance() const
Returns the tolerance distance for grouping points.
const QgsMapUnitScale & toleranceMapUnitScale() const
Returns the map unit scale object for the distance tolerance.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
const QgsFeatureRenderer * embeddedRenderer() const override
Returns the current embedded renderer (subrenderer) for this feature renderer.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
Points (e.g., for font sizes)
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
void appendScopes(const QList< QgsExpressionContextScope *> &scopes)
Appends a list of scopes to the end of the context.
void setEmbeddedRenderer(QgsFeatureRenderer *r) override
Sets an embedded renderer (subrenderer) for this feature renderer.
Represents a vector layer which manages a vector based data sets.
static Type flatType(Type type)
Returns the flat type for a WKB type.
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer...