QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgspointdisplacementrendererwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointdisplacementrendererwidget.cpp
3  --------------------------------------
4  begin : January 26, 2010
5  copyright : (C) 2010 by Marco Hugentobler
6  email : marco at hugis dot net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
20 #include "qgsrendererregistry.h"
21 #include "qgsfields.h"
22 #include "qgsstyle.h"
24 #include "qgssymbollayerutils.h"
25 #include "qgsvectorlayer.h"
26 #include "qgsguiutils.h"
27 #include "qgsapplication.h"
28 
30 {
31  return new QgsPointDisplacementRendererWidget( layer, style, renderer );
32 }
33 
35  : QgsRendererWidget( layer, style )
36 
37 {
38  if ( !layer )
39  {
40  return;
41  }
42 
43  //the renderer only applies to point vector layers
45  {
46  //setup blank dialog
47  mRenderer = nullptr;
48  setupBlankUi( layer->name() );
49  return;
50  }
51  setupUi( this );
52  connect( mLabelFieldComboBox, &QComboBox::currentTextChanged, this, &QgsPointDisplacementRendererWidget::mLabelFieldComboBox_currentIndexChanged );
53  connect( mRendererComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPointDisplacementRendererWidget::mRendererComboBox_currentIndexChanged );
54  connect( mPlacementComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPointDisplacementRendererWidget::mPlacementComboBox_currentIndexChanged );
55  connect( mCircleWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointDisplacementRendererWidget::mCircleWidthSpinBox_valueChanged );
56  connect( mCircleColorButton, &QgsColorButton::colorChanged, this, &QgsPointDisplacementRendererWidget::mCircleColorButton_colorChanged );
57  connect( mDistanceSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointDisplacementRendererWidget::mDistanceSpinBox_valueChanged );
58  connect( mDistanceUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointDisplacementRendererWidget::mDistanceUnitWidget_changed );
59  connect( mLabelColorButton, &QgsColorButton::colorChanged, this, &QgsPointDisplacementRendererWidget::mLabelColorButton_colorChanged );
60  connect( mCircleModificationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointDisplacementRendererWidget::mCircleModificationSpinBox_valueChanged );
61  connect( mLabelDistanceFactorSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPointDisplacementRendererWidget::mLabelDistanceFactorSpinBox_valueChanged );
62  connect( mScaleDependentLabelsCheckBox, &QCheckBox::stateChanged, this, &QgsPointDisplacementRendererWidget::mScaleDependentLabelsCheckBox_stateChanged );
63  connect( mRendererSettingsButton, &QPushButton::clicked, this, &QgsPointDisplacementRendererWidget::mRendererSettingsButton_clicked );
64  this->layout()->setContentsMargins( 0, 0, 0, 0 );
65 
66  mLabelFontButton->setMode( QgsFontButton::ModeQFont );
69  mCenterSymbolToolButton->setSymbolType( QgsSymbol::Marker );
70 
71  if ( renderer )
72  {
74  }
75  if ( !mRenderer )
76  {
77  mRenderer = new QgsPointDisplacementRenderer();
78  }
79 
80  blockAllSignals( true );
81 
82  mPlacementComboBox->addItem( tr( "Ring" ), QgsPointDisplacementRenderer::Ring );
83  mPlacementComboBox->addItem( tr( "Concentric Rings" ), QgsPointDisplacementRenderer::ConcentricRings );
84  mPlacementComboBox->addItem( tr( "Grid" ), QgsPointDisplacementRenderer::Grid );
85 
86  //insert attributes into combo box
87  if ( layer )
88  {
89  const QgsFields layerFields = layer->fields();
90  for ( const QgsField &f : layerFields )
91  {
92  mLabelFieldComboBox->addItem( f.name() );
93  }
94  mLabelFieldComboBox->addItem( tr( "None" ) );
95 
96  QString currentLabelAttribute = mRenderer->labelAttributeName();
97  if ( !currentLabelAttribute.isEmpty() )
98  {
99  mLabelFieldComboBox->setCurrentIndex( mLabelFieldComboBox->findText( currentLabelAttribute ) );
100  }
101  else
102  {
103  mLabelFieldComboBox->setCurrentIndex( mLabelFieldComboBox->findText( tr( "None" ) ) );
104  }
105  }
106 
107  //insert possible renderer types
109  QStringList::const_iterator it = rendererList.constBegin();
110  for ( ; it != rendererList.constEnd(); ++it )
111  {
112  if ( *it != QLatin1String( "pointDisplacement" ) && *it != QLatin1String( "pointCluster" ) && *it != QLatin1String( "heatmapRenderer" ) )
113  {
115  mRendererComboBox->addItem( m->icon(), m->visibleName(), *it );
116  }
117  }
118 
119  mCircleColorButton->setColorDialogTitle( tr( "Select Color" ) );
120  mCircleColorButton->setContext( QStringLiteral( "symbology" ) );
121  mCircleColorButton->setAllowOpacity( true );
122  mCircleColorButton->setShowNoColor( true );
123  mCircleColorButton->setNoColorString( tr( "Transparent Stroke" ) );
124  mLabelColorButton->setContext( QStringLiteral( "symbology" ) );
125  mLabelColorButton->setColorDialogTitle( tr( "Select Color" ) );
126  mLabelColorButton->setAllowOpacity( true );
127 
128  mCircleWidthSpinBox->setValue( mRenderer->circleWidth() );
129  mCircleColorButton->setColor( mRenderer->circleColor() );
130  mLabelColorButton->setColor( mRenderer->labelColor() );
131  mLabelFontButton->setCurrentFont( mRenderer->labelFont() );
132  mCircleModificationSpinBox->setClearValue( 0.0 );
133  mCircleModificationSpinBox->setValue( mRenderer->circleRadiusAddition() );
134  mLabelDistanceFactorSpinBox->setClearValue( 0.5 );
135  mLabelDistanceFactorSpinBox->setValue( mRenderer->labelDistanceFactor() );
136  mDistanceSpinBox->setValue( mRenderer->tolerance() );
137  mDistanceUnitWidget->setUnit( mRenderer->toleranceUnit() );
138  mDistanceUnitWidget->setMapUnitScale( mRenderer->toleranceMapUnitScale() );
139  mCenterSymbolToolButton->setSymbol( mRenderer->centerSymbol()->clone() );
140 
141  mPlacementComboBox->setCurrentIndex( mPlacementComboBox->findData( mRenderer->placement() ) );
142 
143  //scale dependent labeling
144  mMinLabelScaleWidget->setScale( std::max( mRenderer->minimumLabelScale(), 0.0 ) );
145  if ( mRenderer->minimumLabelScale() > 0 )
146  {
147  mScaleDependentLabelsCheckBox->setCheckState( Qt::Checked );
148  }
149  else
150  {
151  mScaleDependentLabelsCheckBox->setCheckState( Qt::Unchecked );
152  mMinLabelScaleWidget->setEnabled( false );
153  }
154 
155 
156  blockAllSignals( false );
157 
158  //set the appropriate renderer dialog
159  if ( mRenderer->embeddedRenderer() )
160  {
161  QString rendererName = mRenderer->embeddedRenderer()->type();
162  int rendererIndex = mRendererComboBox->findData( rendererName );
163  if ( rendererIndex != -1 )
164  {
165  mRendererComboBox->setCurrentIndex( rendererIndex );
166  mRendererComboBox_currentIndexChanged( rendererIndex );
167  }
168  }
169 
170  connect( mMinLabelScaleWidget, &QgsScaleWidget::scaleChanged, this, &QgsPointDisplacementRendererWidget::minLabelScaleChanged );
171  connect( mLabelFontButton, &QgsFontButton::changed, this, &QgsPointDisplacementRendererWidget::labelFontChanged );
172  connect( mCenterSymbolToolButton, &QgsSymbolButton::changed, this, &QgsPointDisplacementRendererWidget::centerSymbolChanged );
173  mCenterSymbolToolButton->setDialogTitle( tr( "Center symbol" ) );
174  mCenterSymbolToolButton->setLayer( mLayer );
175  mCenterSymbolToolButton->registerExpressionContextGenerator( this );
176 }
177 
179 {
180  delete mRenderer;
181 }
182 
184 {
185  return mRenderer;
186 }
187 
189 {
191  if ( mDistanceUnitWidget )
192  mDistanceUnitWidget->setMapCanvas( context.mapCanvas() );
193  if ( mMinLabelScaleWidget )
194  {
195  mMinLabelScaleWidget->setMapCanvas( context.mapCanvas() );
196  mMinLabelScaleWidget->setShowCurrentScaleButton( true );
197  }
198  if ( mCenterSymbolToolButton )
199  {
200  mCenterSymbolToolButton->setMapCanvas( context.mapCanvas() );
201  mCenterSymbolToolButton->setMessageBar( context.messageBar() );
202  }
203 }
204 
206 {
208  if ( auto *lExpressionContext = mContext.expressionContext() )
209  context = *lExpressionContext;
210  else
215  QList< QgsExpressionContextScope > scopes = mContext.additionalExpressionContextScopes();
216  scopes << scope;
217  const auto constScopes = scopes;
218  for ( const QgsExpressionContextScope &s : constScopes )
219  {
221  }
222  return context;
223 }
224 
225 void QgsPointDisplacementRendererWidget::mLabelFieldComboBox_currentIndexChanged( const QString &text )
226 {
227  if ( mRenderer )
228  {
229  if ( text == tr( "None" ) )
230  {
231  mRenderer->setLabelAttributeName( QString() );
232  }
233  else
234  {
235  mRenderer->setLabelAttributeName( text );
236  }
237  emit widgetChanged();
238  }
239 }
240 
241 void QgsPointDisplacementRendererWidget::mRendererComboBox_currentIndexChanged( int index )
242 {
243  QString rendererId = mRendererComboBox->itemData( index ).toString();
245  if ( m )
246  {
247  // unfortunately renderer conversion is only available through the creation of a widget...
248  std::unique_ptr< QgsFeatureRenderer> oldRenderer( mRenderer->embeddedRenderer()->clone() );
249  QgsRendererWidget *tempRenderWidget = m->createRendererWidget( mLayer, mStyle, oldRenderer.get() );
250  mRenderer->setEmbeddedRenderer( tempRenderWidget->renderer()->clone() );
251  delete tempRenderWidget;
252  emit widgetChanged();
253  }
254 }
255 
256 void QgsPointDisplacementRendererWidget::mPlacementComboBox_currentIndexChanged( int index )
257 {
258  if ( !mRenderer )
259  return;
260 
261  mRenderer->setPlacement( ( QgsPointDisplacementRenderer::Placement )mPlacementComboBox->itemData( index ).toInt() );
262  emit widgetChanged();
263 }
264 
265 void QgsPointDisplacementRendererWidget::mRendererSettingsButton_clicked()
266 {
267  if ( !mRenderer )
268  return;
269 
271  if ( m )
272  {
274  w->setPanelTitle( tr( "Renderer Settings" ) );
275 
277 
281  QList< QgsExpressionContextScope > scopes = context.additionalExpressionContextScopes();
282  scopes << scope;
284  w->setContext( context );
285 
286  connect( w, &QgsPanelWidget::widgetChanged, this, &QgsPointDisplacementRendererWidget::updateRendererFromWidget );
287  openPanel( w );
288  }
289 }
290 
291 void QgsPointDisplacementRendererWidget::labelFontChanged()
292 {
293  if ( !mRenderer )
294  {
295  return;
296  }
297 
298  mRenderer->setLabelFont( mLabelFontButton->currentFont() );
299  emit widgetChanged();
300 }
301 
302 void QgsPointDisplacementRendererWidget::mCircleWidthSpinBox_valueChanged( double d )
303 {
304  if ( mRenderer )
305  {
306  mRenderer->setCircleWidth( d );
307  emit widgetChanged();
308  }
309 }
310 
311 void QgsPointDisplacementRendererWidget::mCircleColorButton_colorChanged( const QColor &newColor )
312 {
313  if ( !mRenderer )
314  {
315  return;
316  }
317 
318  mRenderer->setCircleColor( newColor );
319  emit widgetChanged();
320 }
321 
322 void QgsPointDisplacementRendererWidget::mLabelColorButton_colorChanged( const QColor &newColor )
323 {
324  if ( !mRenderer )
325  {
326  return;
327  }
328 
329  mRenderer->setLabelColor( newColor );
330  emit widgetChanged();
331 }
332 
333 void QgsPointDisplacementRendererWidget::mCircleModificationSpinBox_valueChanged( double d )
334 {
335  if ( !mRenderer )
336  {
337  return;
338  }
339 
340  mRenderer->setCircleRadiusAddition( d );
341  emit widgetChanged();
342 }
343 
344 void QgsPointDisplacementRendererWidget::mLabelDistanceFactorSpinBox_valueChanged( double d )
345 {
346  if ( !mRenderer )
347  {
348  return;
349  }
350 
351  mRenderer->setLabelDistanceFactor( d );
352  emit widgetChanged();
353 }
354 
355 void QgsPointDisplacementRendererWidget::mDistanceSpinBox_valueChanged( double d )
356 {
357  if ( mRenderer )
358  {
359  mRenderer->setTolerance( d );
360  emit widgetChanged();
361  }
362 }
363 
364 void QgsPointDisplacementRendererWidget::mDistanceUnitWidget_changed()
365 {
366  if ( mRenderer )
367  {
368  mRenderer->setToleranceUnit( mDistanceUnitWidget->unit() );
369  mRenderer->setToleranceMapUnitScale( mDistanceUnitWidget->getMapUnitScale() );
370  emit widgetChanged();
371  }
372 }
373 
374 void QgsPointDisplacementRendererWidget::mScaleDependentLabelsCheckBox_stateChanged( int state )
375 {
376  if ( state == Qt::Unchecked )
377  {
378  mMinLabelScaleWidget->setScale( 0 );
379  mMinLabelScaleWidget->setEnabled( false );
380  }
381  else
382  {
383  mMinLabelScaleWidget->setEnabled( true );
384  }
385 }
386 
387 void QgsPointDisplacementRendererWidget::minLabelScaleChanged( double scale )
388 {
389  if ( !mRenderer )
390  {
391  return;
392  }
393 
394  mRenderer->setMinimumLabelScale( scale );
395  emit widgetChanged();
396 }
397 
398 void QgsPointDisplacementRendererWidget::blockAllSignals( bool block )
399 {
400  mLabelFieldComboBox->blockSignals( block );
401  mLabelFontButton->blockSignals( block );
402  mCircleWidthSpinBox->blockSignals( block );
403  mCircleColorButton->blockSignals( block );
404  mRendererComboBox->blockSignals( block );
405  mLabelColorButton->blockSignals( block );
406  mCircleModificationSpinBox->blockSignals( block );
407  mLabelDistanceFactorSpinBox->blockSignals( block );
408  mScaleDependentLabelsCheckBox->blockSignals( block );
409  mMinLabelScaleWidget->blockSignals( block );
410  mCenterSymbolToolButton->blockSignals( block );
411  mDistanceSpinBox->blockSignals( block );
412  mDistanceUnitWidget->blockSignals( block );
413  mPlacementComboBox->blockSignals( block );
414 }
415 
416 void QgsPointDisplacementRendererWidget::centerSymbolChanged()
417 {
418  mRenderer->setCenterSymbol( mCenterSymbolToolButton->clonedSymbol< QgsMarkerSymbol >() );
419  emit widgetChanged();
420 }
421 
422 void QgsPointDisplacementRendererWidget::updateRendererFromWidget()
423 {
424  QgsRendererWidget *w = qobject_cast<QgsRendererWidget *>( sender() );
425  if ( !w )
426  return;
427 
428  mRenderer->setEmbeddedRenderer( w->renderer()->clone() );
429  emit widgetChanged();
430 }
431 
432 void QgsPointDisplacementRendererWidget::setupBlankUi( const QString &layerName )
433 {
434  QLabel *label = new QLabel( tr( "The point displacement renderer only applies to (single) point layers. \n'%1' is not a (single) point layer and cannot be displayed by the point displacement renderer." ).arg( layerName ), this );
435  QVBoxLayout *layout = new QVBoxLayout( this );
436  layout->setContentsMargins( 0, 0, 0, 0 );
437  layout->addWidget( label );
438 }
QgsRendererWidget::renderer
virtual QgsFeatureRenderer * renderer()=0
Returns pointer to the renderer (no transfer of ownership)
QgsSymbolWidgetContext::globalProjectAtlasMapLayerScopes
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
Definition: qgssymbolwidgetcontext.cpp:92
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:370
QgsPointDistanceRenderer::labelAttributeName
QString labelAttributeName() const
Returns the attribute name used for labeling points, or an empty string if no labeling will be done b...
Definition: qgspointdistancerenderer.h:128
QgsPointDisplacementRendererWidget::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgspointdisplacementrendererwidget.cpp:205
qgsfields.h
QgsSymbolWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:54
QgsRendererWidget::mStyle
QgsStyle * mStyle
Definition: qgsrendererwidget.h:100
QgsApplication::rendererRegistry
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
Definition: qgsapplication.cpp:2148
QgsUnitTypes::RenderInches
@ RenderInches
Inches.
Definition: qgsunittypes.h:173
qgspointdisplacementrendererwidget.h
QgsSymbolButton::changed
void changed()
Emitted when the symbol's settings are changed.
QgsVectorLayer::wkbType
Q_INVOKABLE QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
Definition: qgsvectorlayer.cpp:664
QgsExpressionContextScope::addVariable
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Definition: qgsexpressioncontext.cpp:93
QgsPointDisplacementRendererWidget::~QgsPointDisplacementRendererWidget
~QgsPointDisplacementRendererWidget() override
Definition: qgspointdisplacementrendererwidget.cpp:178
QgsRendererWidget::mLayer
QgsVectorLayer * mLayer
Definition: qgsrendererwidget.h:99
QgsExpressionContext::EXPR_CLUSTER_COLOR
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
Definition: qgsexpressioncontext.h:737
QgsRendererAbstractMetadata::PointLayer
@ PointLayer
Compatible with point layers.
Definition: qgsrendererregistry.h:51
QgsUnitTypes::RenderPoints
@ RenderPoints
Points (e.g., for font sizes)
Definition: qgsunittypes.h:172
QgsRendererAbstractMetadata::visibleName
QString visibleName() const
Returns a friendly display name of the renderer.
Definition: qgsrendererregistry.h:82
qgssymbollayerutils.h
QgsRendererWidget::context
QgsSymbolWidgetContext context() const
Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expres...
Definition: qgsrendererwidget.cpp:342
QgsFields
Container of fields for a vector layer.
Definition: qgsfields.h:45
QgsSymbolWidgetContext
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Definition: qgssymbolwidgetcontext.h:36
QgsPanelWidget::openPanel
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
Definition: qgspanelwidget.cpp:79
QgsPointDisplacementRenderer::setPlacement
void setPlacement(Placement placement)
Sets the placement method used for dispersing the points.
Definition: qgspointdisplacementrenderer.h:131
QgsFeatureRenderer::type
QString type() const
Definition: qgsrenderer.h:141
QgsPointDisplacementRenderer::placement
Placement placement() const
Returns the placement method used for dispersing the points.
Definition: qgspointdisplacementrenderer.h:123
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsPointDisplacementRenderer::setLabelDistanceFactor
void setLabelDistanceFactor(double factor)
Sets a factor for increasing the label distances from the symbol.
Definition: qgspointdisplacementrenderer.h:109
QgsPointDistanceRenderer::embeddedRenderer
const QgsFeatureRenderer * embeddedRenderer() const override
Returns the current embedded renderer (subrenderer) for this feature renderer.
Definition: qgspointdistancerenderer.cpp:164
QgsPointDistanceRenderer::toleranceMapUnitScale
const QgsMapUnitScale & toleranceMapUnitScale() const
Returns the map unit scale object for the distance tolerance.
Definition: qgspointdistancerenderer.h:229
QgsPointDisplacementRenderer::setCircleRadiusAddition
void setCircleRadiusAddition(double distance)
Sets a factor for increasing the ring size of displacement groups.
Definition: qgspointdisplacementrenderer.h:95
QgsMarkerSymbol::clone
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
Definition: qgssymbol.cpp:1937
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
QgsPointDisplacementRenderer::circleWidth
double circleWidth() const
Returns the line width for the displacement group circle in mm.
Definition: qgspointdisplacementrenderer.h:73
qgsapplication.h
QgsPointDisplacementRenderer::convertFromRenderer
static QgsPointDisplacementRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
Creates a QgsPointDisplacementRenderer from an existing renderer.
Definition: qgspointdisplacementrenderer.cpp:475
QgsVectorLayer::fields
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Definition: qgsvectorlayer.cpp:3283
QgsPointDistanceRenderer::toleranceUnit
QgsUnitTypes::RenderUnit toleranceUnit() const
Returns the units for the tolerance distance.
Definition: qgspointdistancerenderer.h:212
QgsPointDisplacementRenderer::centerSymbol
QgsMarkerSymbol * centerSymbol()
Returns the symbol for the center of a displacement group (but not ownership of the symbol).
Definition: qgspointdisplacementrenderer.cpp:188
QgsPointDistanceRenderer::setLabelColor
void setLabelColor(const QColor &color)
Sets the color to use for for labeling points.
Definition: qgspointdistancerenderer.h:170
QgsSymbolWidgetContext::setAdditionalExpressionContextScopes
void setAdditionalExpressionContextScopes(const QList< QgsExpressionContextScope > &scopes)
Sets a list of additional expression context scopes to show as available within the layer.
Definition: qgssymbolwidgetcontext.cpp:82
QgsMarkerSymbol
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgssymbol.h:931
QgsFeatureRenderer::clone
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
qgsrendererregistry.h
QgsPointDistanceRenderer::setLabelAttributeName
void setLabelAttributeName(const QString &name)
Sets the attribute name for labeling points.
Definition: qgspointdistancerenderer.h:118
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
QgsPointDisplacementRenderer::Ring
@ Ring
Place points in a single ring around group.
Definition: qgspointdisplacementrenderer.h:39
QgsPointDistanceRenderer::setEmbeddedRenderer
void setEmbeddedRenderer(QgsFeatureRenderer *r) override
Sets an embedded renderer (subrenderer) for this feature renderer.
Definition: qgspointdistancerenderer.cpp:159
QgsUnitSelectionWidget::changed
void changed()
QgsPointDisplacementRenderer::circleRadiusAddition
double circleRadiusAddition() const
Returns the factor for increasing the ring size of displacement groups.
Definition: qgspointdisplacementrenderer.h:101
QgsSymbolWidgetContext::expressionContext
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
Definition: qgssymbolwidgetcontext.cpp:77
QgsPointDisplacementRendererWidget::setContext
void setContext(const QgsSymbolWidgetContext &context) override
Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expressio...
Definition: qgspointdisplacementrendererwidget.cpp:188
QgsPointDisplacementRenderer::ConcentricRings
@ ConcentricRings
Place points in concentric rings around group.
Definition: qgspointdisplacementrenderer.h:40
QgsRendererRegistry::renderersList
QStringList renderersList(QgsRendererAbstractMetadata::LayerTypes layerTypes=QgsRendererAbstractMetadata::All) const
Returns a list of available renderers.
Definition: qgsrendererregistry.cpp:123
QgsPointDistanceRenderer::labelColor
QColor labelColor() const
Returns the color used for for labeling points.
Definition: qgspointdistancerenderer.h:178
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
QgsPointDistanceRenderer::setToleranceMapUnitScale
void setToleranceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale object for the distance tolerance.
Definition: qgspointdistancerenderer.h:221
QgsPointDisplacementRenderer::setCircleWidth
void setCircleWidth(double width)
Sets the line width for the displacement group circle.
Definition: qgspointdisplacementrenderer.h:66
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition: qgsexpressioncontext.h:112
qgssymbolselectordialog.h
qgsstyle.h
QgsUnitTypes::RenderPixels
@ RenderPixels
Pixels.
Definition: qgsunittypes.h:170
QgsRendererWidget
Base class for renderer settings widgets.
Definition: qgsrendererwidget.h:45
QgsPointDistanceRenderer::tolerance
double tolerance() const
Returns the tolerance distance for grouping points.
Definition: qgspointdistancerenderer.h:195
qgsvectorlayer.h
QgsExpressionContext::EXPR_CLUSTER_SIZE
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
Definition: qgsexpressioncontext.h:735
QgsFontButton::ModeQFont
@ ModeQFont
Configure font settings for use with QFont objects.
Definition: qgsfontbutton.h:61
QgsPointDistanceRenderer::setToleranceUnit
void setToleranceUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the tolerance distance.
Definition: qgspointdistancerenderer.h:204
QgsWkbTypes::PointGeometry
@ PointGeometry
Definition: qgswkbtypes.h:142
QgsPointDisplacementRenderer::Placement
Placement
Placement methods for dispersing points.
Definition: qgspointdisplacementrenderer.h:38
QgsFeatureRenderer
Definition: qgsrenderer.h:103
QgsPointDisplacementRenderer
A renderer that automatically displaces points with the same geographic location.
Definition: qgspointdisplacementrenderer.h:31
QgsPointDisplacementRendererWidget::create
static QgsRendererWidget * create(QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer)
Definition: qgspointdisplacementrendererwidget.cpp:29
QgsStyle
Definition: qgsstyle.h:160
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsPointDisplacementRenderer::Grid
@ Grid
Place points in a grid around group.
Definition: qgspointdisplacementrenderer.h:41
QgsRendererWidget::mContext
QgsSymbolWidgetContext mContext
Context in which widget is shown.
Definition: qgsrendererwidget.h:118
QgsPointDisplacementRenderer::setCenterSymbol
void setCenterSymbol(QgsMarkerSymbol *symbol)
Sets the center symbol for a displacement group.
Definition: qgspointdisplacementrenderer.cpp:259
QgsPointDistanceRenderer::setLabelFont
void setLabelFont(const QFont &font)
Sets the font used for labeling points.
Definition: qgspointdistancerenderer.h:137
qgspointdisplacementrenderer.h
QgsUnitTypes::RenderMetersInMapUnits
@ RenderMetersInMapUnits
Meters value as Map units.
Definition: qgsunittypes.h:175
QgsMapLayer::name
QString name
Definition: qgsmaplayer.h:86
QgsPointDistanceRenderer::minimumLabelScale
double minimumLabelScale() const
Returns the minimum map scale (i.e.
Definition: qgspointdistancerenderer.h:161
QgsScaleWidget::scaleChanged
void scaleChanged(double scale)
Emitted when user has finished editing/selecting a new scale.
QgsPointDistanceRenderer::labelFont
QFont labelFont() const
Returns the font used for labeling points.
Definition: qgspointdistancerenderer.h:145
QgsPointDistanceRenderer::setMinimumLabelScale
void setMinimumLabelScale(double scale)
Sets the minimum map scale (i.e.
Definition: qgspointdistancerenderer.h:153
QgsWkbTypes::geometryType
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
Definition: qgswkbtypes.h:938
QgsPointDistanceRenderer::setTolerance
void setTolerance(double distance)
Sets the tolerance distance for grouping points.
Definition: qgspointdistancerenderer.h:187
QgsSymbol::Marker
@ Marker
Marker symbol.
Definition: qgssymbol.h:87
QgsSymbolWidgetContext::messageBar
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
Definition: qgssymbolwidgetcontext.cpp:64
QgsRendererAbstractMetadata::icon
QIcon icon() const
Returns an icon representing the renderer.
Definition: qgsrendererregistry.h:88
QgsPointDisplacementRenderer::setCircleColor
void setCircleColor(const QColor &color)
Sets the color used for drawing the displacement group circle.
Definition: qgspointdisplacementrenderer.h:81
QgsUnitTypes::RenderUnitList
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Definition: qgsunittypes.h:239
qgsguiutils.h
QgsRendererAbstractMetadata::createRendererWidget
virtual QgsRendererWidget * createRendererWidget(QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *oldRenderer)
Returns new instance of settings widget for the renderer.
Definition: qgsrendererregistry.h:115
QgsExpressionContextScope::StaticVariable
Single variable definition for use within a QgsExpressionContextScope.
Definition: qgsexpressioncontext.h:119
QgsPointDisplacementRenderer::labelDistanceFactor
double labelDistanceFactor() const
Returns the factor for label distance from the symbol.
Definition: qgspointdisplacementrenderer.h:116
QgsWkbTypes::isMultiType
static bool isMultiType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
Definition: qgswkbtypes.h:832
QgsRendererRegistry::rendererMetadata
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
Definition: qgsrendererregistry.cpp:118
QgsRendererAbstractMetadata
Stores metadata about one renderer class.
Definition: qgsrendererregistry.h:42
QgsRendererWidget::setContext
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expressio...
Definition: qgsrendererwidget.cpp:337
QgsUnitTypes::RenderMapUnits
@ RenderMapUnits
Map units.
Definition: qgsunittypes.h:169
QgsPointDisplacementRenderer::circleColor
QColor circleColor() const
Returns the color used for drawing the displacement group circle.
Definition: qgspointdisplacementrenderer.h:88
QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget
QgsPointDisplacementRendererWidget(QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer)
Definition: qgspointdisplacementrendererwidget.cpp:34
QgsSymbolWidgetContext::additionalExpressionContextScopes
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
Definition: qgssymbolwidgetcontext.cpp:87
QgsPointDisplacementRendererWidget::renderer
QgsFeatureRenderer * renderer() override
Returns pointer to the renderer (no transfer of ownership)
Definition: qgspointdisplacementrendererwidget.cpp:183
QgsFontButton::changed
void changed()
Emitted when the widget's text format settings are changed.
QgsField
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:50