QGIS API Documentation  2.99.0-Master (0a63d1f)
Public Types | Public Member Functions | Public Attributes | 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
}
 

Public Member Functions

 QgsDiagramLayerSettings ()
 
 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...
 
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...
 
int priority () const
 Returns the diagram priority. More...
 
void readXml (const QDomElement &elem, const QgsVectorLayer *layer)
 
QSet< QString > referencedFields (const QgsExpressionContext &context=QgsExpressionContext(), const QgsFields &fields=QgsFields()) 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 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 QgsVectorLayer *layer) const
 
double zIndex () const
 Returns the diagram z-index. More...
 

Public Attributes

int showColumn
 Attribute index for visibility (or -1 if visibility not data defined) More...
 
int xPosColumn
 Attribute index for x coordinate (or -1 if position not data defined) More...
 
int yPosColumn
 Attribute index for y coordinate (or -1 if position not data defined) 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 51 of file qgsdiagramrenderer.h.

Member Enumeration Documentation

◆ LinePlacementFlag

Line placement flags for controlling line based placements.

Enumerator
OnLine 
AboveLine 
BelowLine 
MapOrientation 

Definition at line 67 of file qgsdiagramrenderer.h.

◆ Placement

Enumerator
AroundPoint 
OverPoint 
Line 
Curved 
Horizontal 
Free 

Definition at line 56 of file qgsdiagramrenderer.h.

Constructor & Destructor Documentation

◆ QgsDiagramLayerSettings() [1/2]

QgsDiagramLayerSettings::QgsDiagramLayerSettings ( )

Definition at line 28 of file qgsdiagramrenderer.cpp.

◆ QgsDiagramLayerSettings() [2/2]

QgsDiagramLayerSettings::QgsDiagramLayerSettings ( const QgsDiagramLayerSettings rh)

Copy constructor.

Definition at line 36 of file qgsdiagramrenderer.cpp.

◆ ~QgsDiagramLayerSettings()

QgsDiagramLayerSettings::~QgsDiagramLayerSettings ( )

Definition at line 69 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()
Note
added in QGIS 2.16

Definition at line 198 of file qgsdiagramrenderer.h.

◆ distance()

double QgsDiagramLayerSettings::distance ( ) const
inline

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

See also
setDistance()
Note
added in QGIS 2.16

Definition at line 165 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()
Note
added in QGIS 2.16

Definition at line 152 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()
Note
added in QGIS 2.16

Definition at line 104 of file qgsdiagramrenderer.h.

◆ operator=()

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

Definition at line 52 of file qgsdiagramrenderer.cpp.

◆ placement()

Placement QgsDiagramLayerSettings::placement ( ) const
inline

Returns the diagram placement.

See also
setPlacement()
Note
added in QGIS 2.16

Definition at line 90 of file qgsdiagramrenderer.h.

◆ 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()
Note
added in QGIS 2.16

Definition at line 121 of file qgsdiagramrenderer.h.

◆ readXml()

void QgsDiagramLayerSettings::readXml ( const QDomElement &  elem,
const QgsVectorLayer layer 
)

Definition at line 88 of file qgsdiagramrenderer.cpp.

◆ referencedFields()

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

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

Parameters
contextexpression context the diagrams will be drawn using
fieldslayer fields
Note
added in QGIS 2.16

Definition at line 122 of file qgsdiagramrenderer.cpp.

◆ renderer() [1/2]

QgsDiagramRenderer* QgsDiagramLayerSettings::renderer ( )
inline

Returns the diagram renderer associated with the layer.

See also
setRenderer()
Note
added in QGIS 2.16

Definition at line 178 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
added in QGIS 2.16

Definition at line 184 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()
Note
added in QGIS 2.16

Definition at line 83 of file qgsdiagramrenderer.cpp.

◆ setDistance()

void QgsDiagramLayerSettings::setDistance ( double  distance)
inline

Sets the distance between the diagram and the feature.

Parameters
distancedistance in mm
See also
distance()
Note
added in QGIS 2.16

Definition at line 172 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()
Note
added in QGIS 2.16

Definition at line 159 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
getPlacement()
Note
added in QGIS 2.16

Definition at line 112 of file qgsdiagramrenderer.h.

◆ setPlacement()

void QgsDiagramLayerSettings::setPlacement ( Placement  value)
inline

Sets the diagram placement.

Parameters
valueplacement value
See also
placement()
Note
added in QGIS 2.16

Definition at line 97 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()
Note
added in QGIS 2.16

Definition at line 128 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()
Note
added in QGIS 2.16

Definition at line 74 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()
Note
added in QGIS 2.16

Definition at line 227 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()
Note
added in QGIS 2.16

Definition at line 146 of file qgsdiagramrenderer.h.

◆ showAllDiagrams()

bool QgsDiagramLayerSettings::showAllDiagrams ( ) const
inline

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

See also
setShowAllDiagrams()
Note
added in QGIS 2.16

Definition at line 220 of file qgsdiagramrenderer.h.

◆ writeXml()

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

Definition at line 104 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()
Note
added in QGIS 2.16

Definition at line 138 of file qgsdiagramrenderer.h.

Member Data Documentation

◆ showColumn

int QgsDiagramLayerSettings::showColumn

Attribute index for visibility (or -1 if visibility not data defined)

Definition at line 214 of file qgsdiagramrenderer.h.

◆ xPosColumn

int QgsDiagramLayerSettings::xPosColumn

Attribute index for x coordinate (or -1 if position not data defined)

Definition at line 208 of file qgsdiagramrenderer.h.

◆ yPosColumn

int QgsDiagramLayerSettings::yPosColumn

Attribute index for y coordinate (or -1 if position not data defined)

Definition at line 211 of file qgsdiagramrenderer.h.


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