QgsPointDisplacementRenderer class
A renderer that automatically displaces points with the same geographic location.
Contents
Base classes
- class QgsPointDistanceRenderer
- An abstract base class for distance based point renderers (e.g., clusterer and displacement renderers).
Public types
- enum Placement { Ring, ConcentricRings, Grid }
- Placement methods for dispersing points.
Public static functions
- static auto convertFromRenderer(const QgsFeatureRenderer* renderer) -> QgsPointDisplacementRenderer*
- Creates a QgsPointDisplacementRenderer from an existing renderer.
- static auto create(QDomElement& symbologyElem, const QgsReadWriteContext& context) -> QgsFeatureRenderer*
- Create a renderer from XML element.
Constructors, destructors, conversion operators
- QgsPointDisplacementRenderer(const QString& labelAttributeName = QString())
- Constructor for QgsPointDisplacementRenderer.
Public functions
- auto centerSymbol() -> QgsMarkerSymbol*
- Returns the symbol for the center of a displacement group (but not ownership of the symbol).
- auto circleColor() const -> QColor
- Returns the color used for drawing the displacement group circle.
- auto circleRadiusAddition() const -> double
- Returns the factor for increasing the ring size of displacement groups.
- auto circleWidth() const -> double
- Returns the line width for the displacement group circle in mm.
- auto clone() const -> QgsPointDisplacementRenderer* override
- Create a deep copy of this renderer.
- auto placement() const -> Placement
- Returns the placement method used for dispersing the points.
- auto save(QDomDocument& doc, const QgsReadWriteContext& context) -> QDomElement override
- store renderer info to XML element
- void setCenterSymbol(QgsMarkerSymbol* symbol)
- Sets the center symbol for a displacement group.
- void setCircleColor(const QColor& color)
- Sets the color used for drawing the displacement group circle.
- void setCircleRadiusAddition(double distance)
- Sets a factor for increasing the ring size of displacement groups.
- void setCircleWidth(double width)
- Sets the line width for the displacement group circle.
- void setPlacement(Placement placement)
- Sets the placement method used for dispersing the points.
- void startRender(QgsRenderContext& context, const QgsFields& fields) override
- Must be called when a new render cycle is started.
- void stopRender(QgsRenderContext& context) override
- Must be called when a render cycle has finished, to allow the renderer to clean up.
- auto usedAttributes(const QgsRenderContext& context) const -> QSet<QString> override
- Returns a list of attributes required by this renderer.
Enum documentation
enum QgsPointDisplacementRenderer:: Placement
Placement methods for dispersing points.
| Enumerators | |
|---|---|
| Ring |
Place points in a single ring around group. |
| ConcentricRings |
Place points in concentric rings around group. |
| Grid |
Place points in a grid around group. |
Function documentation
static QgsPointDisplacementRenderer* QgsPointDisplacementRenderer:: convertFromRenderer(const QgsFeatureRenderer* renderer)
Creates a QgsPointDisplacementRenderer from an existing renderer.
| Returns | a new renderer if the conversion was possible, otherwise nullptr. |
|---|
QgsPointDisplacementRenderer:: QgsPointDisplacementRenderer(const QString& labelAttributeName = QString())
Constructor for QgsPointDisplacementRenderer.
| Parameters | |
|---|---|
| labelAttributeName | optional attribute name for labeling points |
QgsMarkerSymbol* QgsPointDisplacementRenderer:: centerSymbol()
Returns the symbol for the center of a displacement group (but not ownership of the symbol).
QColor QgsPointDisplacementRenderer:: circleColor() const
Returns the color used for drawing the displacement group circle.
double QgsPointDisplacementRenderer:: circleRadiusAddition() const
Returns the factor for increasing the ring size of displacement groups.
double QgsPointDisplacementRenderer:: circleWidth() const
Returns the line width for the displacement group circle in mm.
QgsPointDisplacementRenderer* QgsPointDisplacementRenderer:: clone() const override
Create a deep copy of this renderer.
| Returns | A copy of this renderer |
|---|
Should be implemented by all subclasses and generate a proper subclass.
void QgsPointDisplacementRenderer:: setCenterSymbol(QgsMarkerSymbol* symbol)
Sets the center symbol for a displacement group.
| Parameters | |
|---|---|
| symbol | new center symbol. Ownership is transferred to the renderer. |
void QgsPointDisplacementRenderer:: setCircleColor(const QColor& color)
Sets the color used for drawing the displacement group circle.
| Parameters | |
|---|---|
| color | circle color |
void QgsPointDisplacementRenderer:: setCircleRadiusAddition(double distance)
Sets a factor for increasing the ring size of displacement groups.
| Parameters | |
|---|---|
| distance | addition factor |
void QgsPointDisplacementRenderer:: setCircleWidth(double width)
Sets the line width for the displacement group circle.
| Parameters | |
|---|---|
| width | line width in mm |
void QgsPointDisplacementRenderer:: setPlacement(Placement placement)
Sets the placement method used for dispersing the points.
| Parameters | |
|---|---|
| placement | placement method |
void QgsPointDisplacementRenderer:: startRender(QgsRenderContext& context,
const QgsFields& fields) override
Must be called when a new render cycle is started.
| Parameters | |
|---|---|
| context | Additional information passed to the renderer about the job which will be rendered |
| fields | The fields available for rendering |
A call to startRender() must always be followed by a corresponding call to stopRender() after all features have been rendered.
void QgsPointDisplacementRenderer:: stopRender(QgsRenderContext& context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
Calls to stopRender() must always be preceded by a call to startRender().
QSet<QString> QgsPointDisplacementRenderer:: usedAttributes(const QgsRenderContext& context) const override
Returns a list of attributes required by this renderer.
| Returns | A set of attributes |
|---|
Attributes not listed in here may not have been requested from the provider at rendering time.