QGIS API Documentation  3.6.0-Noosa (5873452)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsDiagramLayerSettings Class Reference

Stores the settings for rendering of all diagrams for a layer. More...

#include <qgsdiagramrenderer.h>

Public Types

enum  LinePlacementFlag { OnLine = 1, AboveLine = 1 << 1, BelowLine = 1 << 2, MapOrientation = 1 << 4 }
 Line placement flags for controlling line based placements. More...
 
enum  Placement {
  AroundPoint = 0, OverPoint, Line, Curved,
  Horizontal, Free
}
 
enum  Property {
  BackgroundColor, StrokeColor, StrokeWidth, PositionX,
  PositionY, Distance, Priority, ZIndex,
  IsObstacle, Show, AlwaysShow, StartAngle
}
 Data definable properties. More...
 

Public Member Functions

 QgsDiagramLayerSettings ()
 Constructor for QgsDiagramLayerSettings. More...
 
 QgsDiagramLayerSettings (const QgsDiagramLayerSettings &rh)
 Copy constructor. More...
 
 ~QgsDiagramLayerSettings ()
 
QgsCoordinateTransform coordinateTransform () const
 Returns the coordinate transform associated with the layer, or an invalid transform if no transformation is required. More...
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the diagram's property collection, used for data defined overrides. More...
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the diagram's property collection, used for data defined overrides. More...
 
double distance () const
 Returns the distance between the diagram and the feature (in mm). More...
 
bool isObstacle () const
 Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams. More...
 
LinePlacementFlags linePlacementFlags () const
 Returns the diagram placement flags. More...
 
QgsDiagramLayerSettingsoperator= (const QgsDiagramLayerSettings &rh)
 
Placement placement () const
 Returns the diagram placement. More...
 
bool prepare (const QgsExpressionContext &context=QgsExpressionContext()) const
 Prepares the diagrams for a specified expression context. More...
 
int priority () const
 Returns the diagram priority. More...
 
void readXml (const QDomElement &elem)
 Reads the diagram settings from a DOM element. More...
 
QSet< QString > referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const
 Returns the set of any fields referenced by the layer's diagrams. More...
 
QgsDiagramRendererrenderer ()
 Returns the diagram renderer associated with the layer. More...
 
const QgsDiagramRendererrenderer () const
 Returns the diagram renderer associated with the layer. More...
 
void setCoordinateTransform (const QgsCoordinateTransform &transform)
 Sets the coordinate transform associated with the layer. More...
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the diagram's property collection, used for data defined overrides. More...
 
void setDistance (double distance)
 Sets the distance between the diagram and the feature. More...
 
void setIsObstacle (bool isObstacle)
 Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams. More...
 
void setLinePlacementFlags (LinePlacementFlags flags)
 Sets the the diagram placement flags. More...
 
void setPlacement (Placement value)
 Sets the diagram placement. More...
 
void setPriority (int value)
 Sets the diagram priority. More...
 
void setRenderer (QgsDiagramRenderer *diagramRenderer)
 Sets the diagram renderer associated with the layer. More...
 
void setShowAllDiagrams (bool showAllDiagrams)
 Sets whether the layer should show all diagrams, including overlapping diagrams. More...
 
void setZIndex (double index)
 Sets the diagram z-index. More...
 
bool showAllDiagrams () const
 Returns whether the layer should show all diagrams, including overlapping diagrams. More...
 
void writeXml (QDomElement &layerElem, QDomDocument &doc) const
 Writes the diagram settings to a DOM element. More...
 
double zIndex () const
 Returns the diagram z-index. More...
 

Static Public Member Functions

static const QgsPropertiesDefinitionpropertyDefinitions ()
 Returns the diagram property definitions. More...
 

Detailed Description

Stores the settings for rendering of all diagrams for a layer.

QgsDiagramSettings stores the settings related to rendering the individual diagrams themselves, while QgsDiagramLayerSettings stores settings which control how ALL diagrams within a layer are rendered.

Definition at line 58 of file qgsdiagramrenderer.h.

Member Enumeration Documentation

◆ LinePlacementFlag

Line placement flags for controlling line based placements.

Enumerator
OnLine 
AboveLine 
BelowLine 
MapOrientation 

Definition at line 74 of file qgsdiagramrenderer.h.

◆ Placement

Enumerator
AroundPoint 
OverPoint 
Line 
Curved 
Horizontal 
Free 

Definition at line 63 of file qgsdiagramrenderer.h.

◆ Property

Data definable properties.

Since
QGIS 3.0
Enumerator
BackgroundColor 

Diagram background color.

StrokeColor 

Stroke color.

StrokeWidth 

Stroke width.

PositionX 
PositionY 

x-coordinate data defined diagram position

Distance 

y-coordinate data defined diagram position

Priority 

Distance to diagram from feature.

ZIndex 

Diagram priority (between 0 and 10)

IsObstacle 

Z-index for diagram ordering.

Show 

Whether diagram features act as obstacles for other diagrams/labels.

AlwaysShow 

Whether to show the diagram.

StartAngle 

Whether the diagram should always be shown, even if it overlaps other diagrams/labels.

Definition at line 87 of file qgsdiagramrenderer.h.

Constructor & Destructor Documentation

◆ QgsDiagramLayerSettings() [1/2]

QgsDiagramLayerSettings::QgsDiagramLayerSettings ( )

Constructor for QgsDiagramLayerSettings.

Definition at line 62 of file qgsdiagramrenderer.cpp.

◆ QgsDiagramLayerSettings() [2/2]

QgsDiagramLayerSettings::QgsDiagramLayerSettings ( const QgsDiagramLayerSettings rh)

Copy constructor.

Definition at line 67 of file qgsdiagramrenderer.cpp.

◆ ~QgsDiagramLayerSettings()

QgsDiagramLayerSettings::~QgsDiagramLayerSettings ( )

Definition at line 97 of file qgsdiagramrenderer.cpp.

Member Function Documentation

◆ coordinateTransform()

QgsCoordinateTransform QgsDiagramLayerSettings::coordinateTransform ( ) const
inline

Returns the coordinate transform associated with the layer, or an invalid transform if no transformation is required.

See also
setCoordinateTransform()
Since
QGIS 2.16

Definition at line 249 of file qgsdiagramrenderer.h.

◆ dataDefinedProperties() [1/2]

QgsPropertyCollection& QgsDiagramLayerSettings::dataDefinedProperties ( )
inline

Returns a reference to the diagram's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Since
QGIS 3.0

Definition at line 306 of file qgsdiagramrenderer.h.

◆ dataDefinedProperties() [2/2]

const QgsPropertyCollection& QgsDiagramLayerSettings::dataDefinedProperties ( ) const
inline

Returns a reference to the diagram's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Property
Note
not available in Python bindings
Since
QGIS 3.0

Definition at line 315 of file qgsdiagramrenderer.h.

◆ distance()

double QgsDiagramLayerSettings::distance ( ) const
inline

Returns the distance between the diagram and the feature (in mm).

See also
setDistance()
Since
QGIS 2.16

Definition at line 210 of file qgsdiagramrenderer.h.

◆ isObstacle()

bool QgsDiagramLayerSettings::isObstacle ( ) const
inline

Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.

See also
setIsObstacle()
Since
QGIS 2.16

Definition at line 195 of file qgsdiagramrenderer.h.

◆ linePlacementFlags()

LinePlacementFlags QgsDiagramLayerSettings::linePlacementFlags ( ) const
inline

Returns the diagram placement flags.

These are only used if the diagram placement is set to a line type.

See also
setLinePlacementFlags()
Since
QGIS 2.16

Definition at line 142 of file qgsdiagramrenderer.h.

◆ operator=()

QgsDiagramLayerSettings & QgsDiagramLayerSettings::operator= ( const QgsDiagramLayerSettings rh)

Definition at line 82 of file qgsdiagramrenderer.cpp.

◆ placement()

Placement QgsDiagramLayerSettings::placement ( ) const
inline

Returns the diagram placement.

See also
setPlacement()
Since
QGIS 2.16

Definition at line 126 of file qgsdiagramrenderer.h.

◆ prepare()

bool QgsDiagramLayerSettings::prepare ( const QgsExpressionContext context = QgsExpressionContext()) const

Prepares the diagrams for a specified expression context.

Calling prepare before rendering multiple diagrams allows precalculation of expensive setup tasks such as parsing expressions. Returns true if preparation was successful.

Since
QGIS 3.0

Definition at line 153 of file qgsdiagramrenderer.cpp.

◆ priority()

int QgsDiagramLayerSettings::priority ( ) const
inline

Returns the diagram priority.

Returns
diagram priority, where 0 = low and 10 = high
Note
placement priority is shared with labeling, so diagrams with a high priority may displace labels and vice-versa
See also
setPriority()
Since
QGIS 2.16

Definition at line 161 of file qgsdiagramrenderer.h.

◆ propertyDefinitions()

const QgsPropertiesDefinition & QgsDiagramLayerSettings::propertyDefinitions ( )
static

Returns the diagram property definitions.

Since
QGIS 3.0

Definition at line 56 of file qgsdiagramrenderer.cpp.

◆ readXml()

void QgsDiagramLayerSettings::readXml ( const QDomElement &  elem)

Reads the diagram settings from a DOM element.

See also
writeXml()

Definition at line 116 of file qgsdiagramrenderer.cpp.

◆ referencedFields()

QSet< QString > QgsDiagramLayerSettings::referencedFields ( const QgsExpressionContext context = QgsExpressionContext()) const

Returns the set of any fields referenced by the layer's diagrams.

Parameters
contextexpression context the diagrams will be drawn using
Since
QGIS 2.16

Definition at line 158 of file qgsdiagramrenderer.cpp.

◆ renderer() [1/2]

QgsDiagramRenderer* QgsDiagramLayerSettings::renderer ( )
inline

Returns the diagram renderer associated with the layer.

See also
setRenderer()
Since
QGIS 2.16

Definition at line 225 of file qgsdiagramrenderer.h.

◆ renderer() [2/2]

const QgsDiagramRenderer* QgsDiagramLayerSettings::renderer ( ) const
inline

Returns the diagram renderer associated with the layer.

See also
setRenderer()
Note
not available in Python bindings
Since
QGIS 2.16

Definition at line 233 of file qgsdiagramrenderer.h.

◆ setCoordinateTransform()

void QgsDiagramLayerSettings::setCoordinateTransform ( const QgsCoordinateTransform transform)

Sets the coordinate transform associated with the layer.

Parameters
transformcoordinate transform. Ownership is transferred to the object.
See also
coordinateTransform()
Since
QGIS 2.16

Definition at line 111 of file qgsdiagramrenderer.cpp.

◆ setDataDefinedProperties()

void QgsDiagramLayerSettings::setDataDefinedProperties ( const QgsPropertyCollection collection)
inline

Sets the diagram's property collection, used for data defined overrides.

Parameters
collectionproperty collection. Existing properties will be replaced.
See also
dataDefinedProperties()
Property
Since
QGIS 3.0

Definition at line 324 of file qgsdiagramrenderer.h.

◆ setDistance()

void QgsDiagramLayerSettings::setDistance ( double  distance)
inline

Sets the distance between the diagram and the feature.

Parameters
distancedistance in mm
See also
distance()
Since
QGIS 2.16

Definition at line 218 of file qgsdiagramrenderer.h.

◆ setIsObstacle()

void QgsDiagramLayerSettings::setIsObstacle ( bool  isObstacle)
inline

Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.

Parameters
isObstacleset to true for feature to act as obstacle
See also
isObstacle()
Since
QGIS 2.16

Definition at line 203 of file qgsdiagramrenderer.h.

◆ setLinePlacementFlags()

void QgsDiagramLayerSettings::setLinePlacementFlags ( LinePlacementFlags  flags)
inline

Sets the the diagram placement flags.

These are only used if the diagram placement is set to a line type.

Parameters
flagsplacement value
See also
linePlacementFlags()
Since
QGIS 2.16

Definition at line 151 of file qgsdiagramrenderer.h.

◆ setPlacement()

void QgsDiagramLayerSettings::setPlacement ( Placement  value)
inline

Sets the diagram placement.

Parameters
valueplacement value
See also
placement()
Since
QGIS 2.16

Definition at line 134 of file qgsdiagramrenderer.h.

◆ setPriority()

void QgsDiagramLayerSettings::setPriority ( int  value)
inline

Sets the diagram priority.

Parameters
valuepriority, where 0 = low and 10 = high
See also
priority()
Since
QGIS 2.16

Definition at line 169 of file qgsdiagramrenderer.h.

◆ setRenderer()

void QgsDiagramLayerSettings::setRenderer ( QgsDiagramRenderer diagramRenderer)

Sets the diagram renderer associated with the layer.

Parameters
diagramRendererdiagram renderer. Ownership is transferred to the object.
See also
renderer()
Since
QGIS 2.16

Definition at line 102 of file qgsdiagramrenderer.cpp.

◆ setShowAllDiagrams()

void QgsDiagramLayerSettings::setShowAllDiagrams ( bool  showAllDiagrams)
inline

Sets whether the layer should show all diagrams, including overlapping diagrams.

Parameters
showAllDiagramsset to true to show all diagrams
See also
showAllDiagrams()
Since
QGIS 2.16

Definition at line 272 of file qgsdiagramrenderer.h.

◆ setZIndex()

void QgsDiagramLayerSettings::setZIndex ( double  index)
inline

Sets the diagram z-index.

Diagrams (or labels) with a higher z-index are drawn over diagrams with a lower z-index.

Parameters
indexdiagram z-index
See also
zIndex()
Since
QGIS 2.16

Definition at line 188 of file qgsdiagramrenderer.h.

◆ showAllDiagrams()

bool QgsDiagramLayerSettings::showAllDiagrams ( ) const
inline

Returns whether the layer should show all diagrams, including overlapping diagrams.

See also
setShowAllDiagrams()
Since
QGIS 2.16

Definition at line 264 of file qgsdiagramrenderer.h.

◆ writeXml()

void QgsDiagramLayerSettings::writeXml ( QDomElement &  layerElem,
QDomDocument &  doc 
) const

Writes the diagram settings to a DOM element.

See also
readXml()

Definition at line 137 of file qgsdiagramrenderer.cpp.

◆ zIndex()

double QgsDiagramLayerSettings::zIndex ( ) const
inline

Returns the diagram z-index.

Diagrams (or labels) with a higher z-index are drawn over diagrams with a lower z-index.

Note
z-index ordering is shared with labeling, so diagrams with a high z-index may be drawn over labels with a low z-index and vice-versa
See also
setZIndex()
Since
QGIS 2.16

Definition at line 179 of file qgsdiagramrenderer.h.


The documentation for this class was generated from the following files: