QGIS API Documentation 3.43.0-Master (e01d6d7c4c0)
Public Member Functions | Static Public Attributes | List of all members
QgsLabelThinningSettings Class Reference

Contains settings related to how the label engine removes candidate label positions and reduces the number of displayed labels. More...

#include <qgslabelthinningsettings.h>

Public Member Functions

bool allowDuplicateRemoval () const
 Returns whether duplicate label removal is permitted for this layer.
 
double labelMarginDistance () const
 Returns the minimum distance to other labels (i.e.
 
const QgsMapUnitScalelabelMarginDistanceMapUnitScale () const
 Returns the map unit scale for the minimum distance to other labels.
 
Qgis::RenderUnit labelMarginDistanceUnit () const
 Returns the units for the minimum distance to other labels.
 
bool limitNumberOfLabelsEnabled () const
 Returns true if the number of labels drawn for the layer should be limited.
 
int maximumNumberLabels () const
 Returns the maximum number of labels which should be drawn for this layer.
 
double minimumDistanceToDuplicate () const
 Returns the minimum distance to labels with duplicate text.
 
const QgsMapUnitScaleminimumDistanceToDuplicateMapUnitScale () const
 Returns the map unit scale for the minimum distance to labels with duplicate text.
 
Qgis::RenderUnit minimumDistanceToDuplicateUnit () const
 Returns the units for the minimum distance to labels with duplicate text.
 
double minimumFeatureSize () const
 Returns the minimum feature size (in millimeters) for a feature to be labelled.
 
void setAllowDuplicateRemoval (bool allow)
 Sets whether duplicate label removal is permitted for this layer.
 
void setLabelMarginDistance (double distance)
 Sets the minimum distance to other labels (i.e.
 
void setLabelMarginDistanceMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the minimum distance to other labels.
 
void setLabelMarginDistanceUnit (Qgis::RenderUnit unit)
 Sets the unit for the minimum distance to other labels.
 
void setLimitNumberLabelsEnabled (bool enabled)
 Sets whether the the number of labels drawn for the layer should be limited.
 
void setMaximumNumberLabels (int number)
 Sets the maximum number of labels which should be drawn for this layer.
 
void setMinimumDistanceToDuplicate (double distance)
 Sets the minimum distance to labels with duplicate text.
 
void setMinimumDistanceToDuplicateMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for the minimum distance to labels with duplicate text.
 
void setMinimumDistanceToDuplicateUnit (Qgis::RenderUnit unit)
 Sets the unit for the minimum distance to labels with duplicate text.
 
void setMinimumFeatureSize (double size)
 Sets the minimum feature size (in millimeters) for a feature to be labelled.
 
void updateDataDefinedProperties (const QgsPropertyCollection &properties, QgsExpressionContext &context)
 Updates the thinning settings to respect any data defined properties set within the specified properties collection.
 

Static Public Attributes

static constexpr double DEFAULT_MINIMUM_DISTANCE_TO_DUPLICATE = 20
 Default minimum distance to duplicate labels.
 

Detailed Description

Contains settings related to how the label engine removes candidate label positions and reduces the number of displayed labels.

Since
QGIS 3.12

Definition at line 35 of file qgslabelthinningsettings.h.

Member Function Documentation

◆ allowDuplicateRemoval()

bool QgsLabelThinningSettings::allowDuplicateRemoval ( ) const
inline

Returns whether duplicate label removal is permitted for this layer.

See also
setAllowDuplicateRemoval()
Since
QGIS 3.44

Definition at line 236 of file qgslabelthinningsettings.h.

◆ labelMarginDistance()

double QgsLabelThinningSettings::labelMarginDistance ( ) const
inline

Returns the minimum distance to other labels (i.e.

the minimum space/margin around labels).

Units are specified through labelMarginDistanceUnit().

See also
setLabelMarginDistance()
labelMarginDistanceUnit()
Since
QGIS 3.44

Definition at line 91 of file qgslabelthinningsettings.h.

◆ labelMarginDistanceMapUnitScale()

const QgsMapUnitScale & QgsLabelThinningSettings::labelMarginDistanceMapUnitScale ( ) const
inline

Returns the map unit scale for the minimum distance to other labels.

See also
setLabelMarginDistanceMapUnitScale()
labelMarginDistanceUnit()
labelMarginDistance()
Since
QGIS 3.44

Definition at line 145 of file qgslabelthinningsettings.h.

◆ labelMarginDistanceUnit()

Qgis::RenderUnit QgsLabelThinningSettings::labelMarginDistanceUnit ( ) const
inline

Returns the units for the minimum distance to other labels.

See also
setLabelMarginDistanceUnit()
labelMarginDistance()
Since
QGIS 3.44

Definition at line 123 of file qgslabelthinningsettings.h.

◆ limitNumberOfLabelsEnabled()

bool QgsLabelThinningSettings::limitNumberOfLabelsEnabled ( ) const
inline

Returns true if the number of labels drawn for the layer should be limited.

See also
maximumNumberLabels()
setLimitNumberLabelsEnabled()

Definition at line 44 of file qgslabelthinningsettings.h.

◆ maximumNumberLabels()

int QgsLabelThinningSettings::maximumNumberLabels ( ) const
inline

Returns the maximum number of labels which should be drawn for this layer.

This only has an effect if limitNumberOfLabelsEnabled() is true.

See also
limitNumberOfLabelsEnabled()
setMaximumNumberLabels()

Definition at line 59 of file qgslabelthinningsettings.h.

◆ minimumDistanceToDuplicate()

double QgsLabelThinningSettings::minimumDistanceToDuplicate ( ) const
inline

Returns the minimum distance to labels with duplicate text.

Units are specified through minimumDistanceToDuplicateUnit().

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
setMinimumDistanceToDuplicate()
minimumDistanceToDuplicateUnit()
Since
QGIS 3.44

Definition at line 164 of file qgslabelthinningsettings.h.

◆ minimumDistanceToDuplicateMapUnitScale()

const QgsMapUnitScale & QgsLabelThinningSettings::minimumDistanceToDuplicateMapUnitScale ( ) const
inline

Returns the map unit scale for the minimum distance to labels with duplicate text.

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
setMinimumDistanceToDuplicateMapUnitScale()
minimumDistanceToDuplicateUnit()
minimumDistanceToDuplicate()
Since
QGIS 3.44

Definition at line 228 of file qgslabelthinningsettings.h.

◆ minimumDistanceToDuplicateUnit()

Qgis::RenderUnit QgsLabelThinningSettings::minimumDistanceToDuplicateUnit ( ) const
inline

Returns the units for the minimum distance to labels with duplicate text.

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
setMinimumDistanceToDuplicateUnit()
minimumDistanceToDuplicate()
Since
QGIS 3.44

Definition at line 202 of file qgslabelthinningsettings.h.

◆ minimumFeatureSize()

double QgsLabelThinningSettings::minimumFeatureSize ( ) const
inline

Returns the minimum feature size (in millimeters) for a feature to be labelled.

See also
setMinimumFeatureSize()

Definition at line 73 of file qgslabelthinningsettings.h.

◆ setAllowDuplicateRemoval()

void QgsLabelThinningSettings::setAllowDuplicateRemoval ( bool  allow)
inline

Sets whether duplicate label removal is permitted for this layer.

See also
setAllowDuplicateRemoval()
Since
QGIS 3.44

Definition at line 244 of file qgslabelthinningsettings.h.

◆ setLabelMarginDistance()

void QgsLabelThinningSettings::setLabelMarginDistance ( double  distance)
inline

Sets the minimum distance to other labels (i.e.

the minimum space/margin around labels).

Units are specified through setLabelMarginDistanceUnit().

See also
labelMarginDistance()
setLabelMarginDistanceUnit()
Since
QGIS 3.44

Definition at line 103 of file qgslabelthinningsettings.h.

◆ setLabelMarginDistanceMapUnitScale()

void QgsLabelThinningSettings::setLabelMarginDistanceMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for the minimum distance to other labels.

See also
labelMarginDistanceMapUnitScale()
labelMarginDistanceUnit()
setLabelMarginDistance()
Since
QGIS 3.44

Definition at line 134 of file qgslabelthinningsettings.h.

◆ setLabelMarginDistanceUnit()

void QgsLabelThinningSettings::setLabelMarginDistanceUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the minimum distance to other labels.

See also
labelMarginDistanceUnit()
setLabelMarginDistance()
Since
QGIS 3.44

Definition at line 113 of file qgslabelthinningsettings.h.

◆ setLimitNumberLabelsEnabled()

void QgsLabelThinningSettings::setLimitNumberLabelsEnabled ( bool  enabled)
inline

Sets whether the the number of labels drawn for the layer should be limited.

See also
setMaximumNumberLabels()
limitNumberOfLabelsEnabled()

Definition at line 51 of file qgslabelthinningsettings.h.

◆ setMaximumNumberLabels()

void QgsLabelThinningSettings::setMaximumNumberLabels ( int  number)
inline

Sets the maximum number of labels which should be drawn for this layer.

This only has an effect if limitNumberOfLabelsEnabled() is true.

See also
setLimitNumberLabelsEnabled()
maximumNumberLabels()

Definition at line 67 of file qgslabelthinningsettings.h.

◆ setMinimumDistanceToDuplicate()

void QgsLabelThinningSettings::setMinimumDistanceToDuplicate ( double  distance)
inline

Sets the minimum distance to labels with duplicate text.

Units are specified through setMinimumDistanceToDuplicateUnit().

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
minimumDistanceToDuplicate()
setMinimumDistanceToDuplicateUnit()
Since
QGIS 3.44

Definition at line 178 of file qgslabelthinningsettings.h.

◆ setMinimumDistanceToDuplicateMapUnitScale()

void QgsLabelThinningSettings::setMinimumDistanceToDuplicateMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for the minimum distance to labels with duplicate text.

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
minimumDistanceToDuplicateMapUnitScale()
minimumDistanceToDuplicateUnit()
setMinimumDistanceToDuplicate()
Since
QGIS 3.44

Definition at line 215 of file qgslabelthinningsettings.h.

◆ setMinimumDistanceToDuplicateUnit()

void QgsLabelThinningSettings::setMinimumDistanceToDuplicateUnit ( Qgis::RenderUnit  unit)
inline

Sets the unit for the minimum distance to labels with duplicate text.

Note
This setting is only respected if allowDuplicateRemoval() is true.
See also
minimumDistanceToDuplicateUnit()
setMinimumDistanceToDuplicate()
Since
QGIS 3.44

Definition at line 190 of file qgslabelthinningsettings.h.

◆ setMinimumFeatureSize()

void QgsLabelThinningSettings::setMinimumFeatureSize ( double  size)
inline

Sets the minimum feature size (in millimeters) for a feature to be labelled.

See also
minimumFeatureSize()

Definition at line 79 of file qgslabelthinningsettings.h.

◆ updateDataDefinedProperties()

void QgsLabelThinningSettings::updateDataDefinedProperties ( const QgsPropertyCollection properties,
QgsExpressionContext context 
)

Updates the thinning settings to respect any data defined properties set within the specified properties collection.

Definition at line 22 of file qgslabelthinningsettings.cpp.

Member Data Documentation

◆ DEFAULT_MINIMUM_DISTANCE_TO_DUPLICATE

constexpr double QgsLabelThinningSettings::DEFAULT_MINIMUM_DISTANCE_TO_DUPLICATE = 20
staticconstexpr

Default minimum distance to duplicate labels.

Definition at line 149 of file qgslabelthinningsettings.h.


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