QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
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 )
126 if ( mCenterSymbolToolButton )
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 );
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
Q_INVOKABLE QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
@ RenderPoints
Points (e.g., for font sizes)
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
static QgsPointClusterRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
Creates a QgsPointClusterRenderer from an existing renderer.
@ RenderMillimeters
Millimeters.
const QgsFeatureRenderer * embeddedRenderer() const override
Returns the current embedded renderer (subrenderer) for this feature renderer.
const QgsMapUnitScale & toleranceMapUnitScale() const
Returns the map unit scale object for the distance tolerance.
QgsMarkerSymbol * clusterSymbol()
Returns the symbol used for rendering clustered groups (but not ownership of the symbol).
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
A renderer that automatically clusters points with the same geographic position.
QgsUnitTypes::RenderUnit toleranceUnit() const
Returns the units for the tolerance distance.
void setAdditionalExpressionContextScopes(const QList< QgsExpressionContextScope > &scopes)
Sets a list of additional expression context scopes to show as available within the layer.
A marker symbol type, for rendering Point and MultiPoint geometries.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
void setEmbeddedRenderer(QgsFeatureRenderer *r) override
Sets an embedded renderer (subrenderer) for this feature renderer.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
QStringList renderersList(QgsRendererAbstractMetadata::LayerTypes layerTypes=QgsRendererAbstractMetadata::All) const
Returns a list of available renderers.
void setToleranceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the distance tolerance.
Single scope for storing variables and functions for use within a QgsExpressionContext.
double tolerance() const
Returns the tolerance distance for grouping points.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
void setToleranceUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the tolerance distance.
Represents a vector layer which manages a vector based data sets.
void setTolerance(double distance)
Sets the tolerance distance for grouping points.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
void setClusterSymbol(QgsMarkerSymbol *symbol)
Sets the symbol for rendering clustered groups.
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Single variable definition for use within a QgsExpressionContextScope.
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
@ RenderMapUnits
Map units.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.