47 setupBlankUi( layer->
name() );
51 connect( mRendererComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsPointClusterRendererWidget::mRendererComboBox_currentIndexChanged );
52 connect( mDistanceSpinBox, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &QgsPointClusterRendererWidget::mDistanceSpinBox_valueChanged );
54 connect( mRendererSettingsButton, &QPushButton::clicked,
this, &QgsPointClusterRendererWidget::mRendererSettingsButton_clicked );
55 this->layout()->setContentsMargins( 0, 0, 0, 0 );
71 blockAllSignals(
true );
75 QStringList::const_iterator it = rendererList.constBegin();
76 for ( ; it != rendererList.constEnd(); ++it )
78 if ( *it != QLatin1String(
"pointDisplacement" ) && *it != QLatin1String(
"pointCluster" ) && *it != QLatin1String(
"heatmapRenderer" ) )
85 mDistanceSpinBox->setValue( mRenderer->
tolerance() );
90 blockAllSignals(
false );
96 int rendererIndex = mRendererComboBox->findData( rendererName );
97 if ( rendererIndex != -1 )
99 mRendererComboBox->setCurrentIndex( rendererIndex );
100 mRendererComboBox_currentIndexChanged( rendererIndex );
104 connect( mCenterSymbolToolButton, &
QgsSymbolButton::changed,
this, &QgsPointClusterRendererWidget::centerSymbolChanged );
105 mCenterSymbolToolButton->setDialogTitle( tr(
"Cluster symbol" ) );
106 mCenterSymbolToolButton->setLayer(
mLayer );
107 mCenterSymbolToolButton->registerExpressionContextGenerator(
this );
123 if ( mDistanceUnitWidget )
124 mDistanceUnitWidget->setMapCanvas( context.
mapCanvas() );
125 if ( mCenterSymbolToolButton )
126 mCenterSymbolToolButton->setMapCanvas( context.
mapCanvas() );
129 void QgsPointClusterRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
131 QString rendererId = mRendererComboBox->itemData( index ).toString();
138 delete tempRenderWidget;
143 void QgsPointClusterRendererWidget::mRendererSettingsButton_clicked()
168 void QgsPointClusterRendererWidget::mDistanceSpinBox_valueChanged(
double d )
177 void QgsPointClusterRendererWidget::mDistanceUnitWidget_changed()
187 void QgsPointClusterRendererWidget::blockAllSignals(
bool block )
189 mRendererComboBox->blockSignals( block );
190 mCenterSymbolToolButton->blockSignals( block );
191 mDistanceSpinBox->blockSignals( block );
192 mDistanceUnitWidget->blockSignals( block );
214 void QgsPointClusterRendererWidget::centerSymbolChanged()
220 void QgsPointClusterRendererWidget::updateRendererFromWidget()
230 void QgsPointClusterRendererWidget::setupBlankUi(
const QString &layerName )
232 QGridLayout *layout =
new QGridLayout(
this );
233 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 );
234 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.
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.
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...
QgsWkbTypes::Type wkbType() const override
Returns the WKBType or WKBUnknown in case of error.
points (e.g., for font sizes)
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.
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
Gets 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...