QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
QgsLabelingEngineSettings Class Reference

Stores global configuration for labeling engine. More...

#include <qgslabelingenginesettings.h>

Public Types

enum  Search {
  Chain , Popmusic_Tabu , Popmusic_Chain , Popmusic_Tabu_Chain ,
  Falp
}
 Search methods in the PAL library to remove colliding labels (methods have different processing speed and number of labels placed). More...

Public Member Functions

 QgsLabelingEngineSettings ()
 QgsLabelingEngineSettings (const QgsLabelingEngineSettings &other)
 QgsLabelingEngineSettings (QgsLabelingEngineSettings &&other)
 ~QgsLabelingEngineSettings ()
void addRule (QgsAbstractLabelingEngineRule *rule)
 Adds a labeling engine rule which must be satisfied while placing labels.
void clear ()
 Returns the configuration to the defaults.
Qgis::TextRenderFormat defaultTextRenderFormat () const
 Returns the default text rendering format for the labels.
Qgis::LabelingFlags flags () const
 Gets flags of the labeling engine.
double maximumLineCandidatesPerCm () const
 Returns the maximum number of line label candidate positions per centimeter.
double maximumPolygonCandidatesPerCmSquared () const
 Returns the maximum number of polygon label candidate positions per centimeter squared.
Q_DECL_DEPRECATED void numCandidatePositions (int &candPoint, int &candLine, int &candPolygon) const
 Gets number of candidate positions that will be generated for each label feature.
QgsLabelingEngineSettingsoperator= (const QgsLabelingEngineSettings &other)
QgsLabelingEngineSettingsoperator= (QgsLabelingEngineSettings &&other)
Qgis::LabelPlacementEngineVersion placementVersion () const
 Returns the placement engine version, which dictates how the label placement problem is solved.
void readSettingsFromProject (QgsProject *project)
 Read configuration of the labeling engine from a project.
void readXml (const QDomElement &element, const QgsReadWriteContext &context)
 Reads the label engine settings from an XML element.
void resolveReferences (const QgsProject *project)
 Resolves reference to layers from stored layer ID.
QList< QgsAbstractLabelingEngineRule * > rules ()
 Returns a list of labeling engine rules which must be satisfied while placing labels.
QList< const QgsAbstractLabelingEngineRule * > rules () const
 Returns a list of labeling engine rules which must be satisfied while placing labels.
Q_DECL_DEPRECATED Search searchMethod () const
 Which search method to use for removal collisions between labels.
void setDefaultTextRenderFormat (Qgis::TextRenderFormat format)
 Sets the default text rendering format for the labels.
void setFlag (Qgis::LabelingFlag f, bool enabled=true)
 Sets whether a particual flag is enabled.
void setFlags (Qgis::LabelingFlags flags)
 Sets flags of the labeling engine.
void setMaximumLineCandidatesPerCm (double candidates)
 Sets the maximum number of line label candidates per centimeter.
void setMaximumPolygonCandidatesPerCmSquared (double candidates)
 Sets the maximum number of polygon label candidates per centimeter squared.
Q_DECL_DEPRECATED void setNumCandidatePositions (int candPoint, int candLine, int candPolygon)
 Sets the number of candidate positions that will be generated for each label feature.
void setPlacementVersion (Qgis::LabelPlacementEngineVersion version)
 Sets the placement engine version, which dictates how the label placement problem is solved.
void setRules (const QList< QgsAbstractLabelingEngineRule * > &rules)
 Sets the labeling engine rules which must be satisfied while placing labels.
Q_DECL_DEPRECATED void setSearchMethod (Search s)
 Used to set which search method to use for removal collisions between labels.
void setUnplacedLabelColor (const QColor &color)
 Sets the color to use when rendering unplaced labels.
bool testFlag (Qgis::LabelingFlag f) const
 Test whether a particular flag is enabled.
QColor unplacedLabelColor () const
 Returns the color to use when rendering unplaced labels.
void writeSettingsToProject (QgsProject *project)
 Write configuration of the labeling engine to a project.
void writeXml (QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
 Writes the label engine settings to an XML element.

Detailed Description

Stores global configuration for labeling engine.

Definition at line 34 of file qgslabelingenginesettings.h.

Member Enumeration Documentation

◆ Search

Search methods in the PAL library to remove colliding labels (methods have different processing speed and number of labels placed).

Enumerator
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Definition at line 44 of file qgslabelingenginesettings.h.

Constructor & Destructor Documentation

◆ QgsLabelingEngineSettings() [1/3]

QgsLabelingEngineSettings::QgsLabelingEngineSettings ( )

Definition at line 24 of file qgslabelingenginesettings.cpp.

◆ ~QgsLabelingEngineSettings()

QgsLabelingEngineSettings::~QgsLabelingEngineSettings ( )
default

◆ QgsLabelingEngineSettings() [2/3]

QgsLabelingEngineSettings::QgsLabelingEngineSettings ( const QgsLabelingEngineSettings & other)

Definition at line 30 of file qgslabelingenginesettings.cpp.

◆ QgsLabelingEngineSettings() [3/3]

QgsLabelingEngineSettings::QgsLabelingEngineSettings ( QgsLabelingEngineSettings && other)

Definition at line 48 of file qgslabelingenginesettings.cpp.

Member Function Documentation

◆ addRule()

void QgsLabelingEngineSettings::addRule ( QgsAbstractLabelingEngineRule * rule)

Adds a labeling engine rule which must be satisfied while placing labels.

Ownership of the rule is transferred to the settings.

See also
rules()
setRules()
Since
QGIS 3.40

Definition at line 245 of file qgslabelingenginesettings.cpp.

◆ clear()

void QgsLabelingEngineSettings::clear ( )

Returns the configuration to the defaults.

Definition at line 99 of file qgslabelingenginesettings.cpp.

◆ defaultTextRenderFormat()

Qgis::TextRenderFormat QgsLabelingEngineSettings::defaultTextRenderFormat ( ) const
inline

Returns the default text rendering format for the labels.

See also
setDefaultTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 201 of file qgslabelingenginesettings.h.

◆ flags()

Qgis::LabelingFlags QgsLabelingEngineSettings::flags ( ) const
inline

Gets flags of the labeling engine.

Definition at line 68 of file qgslabelingenginesettings.h.

◆ maximumLineCandidatesPerCm()

double QgsLabelingEngineSettings::maximumLineCandidatesPerCm ( ) const
inline

Returns the maximum number of line label candidate positions per centimeter.

See also
setMaximumLineCandidatesPerCm()
Since
QGIS 3.12

Definition at line 80 of file qgslabelingenginesettings.h.

◆ maximumPolygonCandidatesPerCmSquared()

double QgsLabelingEngineSettings::maximumPolygonCandidatesPerCmSquared ( ) const
inline

Returns the maximum number of polygon label candidate positions per centimeter squared.

See also
setMaximumPolygonCandidatesPerCmSquared()
Since
QGIS 3.12

Definition at line 96 of file qgslabelingenginesettings.h.

◆ numCandidatePositions()

Q_DECL_DEPRECATED void QgsLabelingEngineSettings::numCandidatePositions ( int & candPoint,
int & candLine,
int & candPolygon ) const
inline

Gets number of candidate positions that will be generated for each label feature.

Deprecated
QGIS 3.12. Use maximumPolygonCandidatesPerCmSquared() and maximumLineCandidatesPerCm() instead.

Definition at line 110 of file qgslabelingenginesettings.h.

◆ operator=() [1/2]

QgsLabelingEngineSettings & QgsLabelingEngineSettings::operator= ( const QgsLabelingEngineSettings & other)

Definition at line 60 of file qgslabelingenginesettings.cpp.

◆ operator=() [2/2]

QgsLabelingEngineSettings & QgsLabelingEngineSettings::operator= ( QgsLabelingEngineSettings && other)

Definition at line 83 of file qgslabelingenginesettings.cpp.

◆ placementVersion()

Qgis::LabelPlacementEngineVersion QgsLabelingEngineSettings::placementVersion ( ) const

Returns the placement engine version, which dictates how the label placement problem is solved.

See also
setPlacementVersion()
Since
QGIS 3.10.2

Definition at line 215 of file qgslabelingenginesettings.cpp.

◆ readSettingsFromProject()

void QgsLabelingEngineSettings::readSettingsFromProject ( QgsProject * project)

Read configuration of the labeling engine from a project.

Note
Both this method and readXml() must be called to completely restore the object's state from a project.

Definition at line 104 of file qgslabelingenginesettings.cpp.

◆ readXml()

void QgsLabelingEngineSettings::readXml ( const QDomElement & element,
const QgsReadWriteContext & context )

Reads the label engine settings from an XML element.

Note
Both this method and readSettingsFromProject() must be called to completely restore the object's state from a project.
resolveReferences() must be called following this method.
See also
writeXml()
readSettingsFromProject()
Since
QGIS 3.40

Definition at line 173 of file qgslabelingenginesettings.cpp.

◆ resolveReferences()

void QgsLabelingEngineSettings::resolveReferences ( const QgsProject * project)

Resolves reference to layers from stored layer ID.

Should be called following a call readXml().

Since
QGIS 3.40

Definition at line 197 of file qgslabelingenginesettings.cpp.

◆ rules() [1/2]

QList< QgsAbstractLabelingEngineRule * > QgsLabelingEngineSettings::rules ( )

Returns a list of labeling engine rules which must be satisfied while placing labels.

See also
addRule()
setRules()
Since
QGIS 3.40

Definition at line 225 of file qgslabelingenginesettings.cpp.

◆ rules() [2/2]

QList< const QgsAbstractLabelingEngineRule * > QgsLabelingEngineSettings::rules ( ) const

Returns a list of labeling engine rules which must be satisfied while placing labels.

See also
addRule()
setRules()
Since
QGIS 3.40

Definition at line 235 of file qgslabelingenginesettings.cpp.

◆ searchMethod()

Q_DECL_DEPRECATED Search QgsLabelingEngineSettings::searchMethod ( ) const
inline

Which search method to use for removal collisions between labels.

Deprecated
QGIS 3.10. Chain is always used.

Definition at line 138 of file qgslabelingenginesettings.h.

◆ setDefaultTextRenderFormat()

void QgsLabelingEngineSettings::setDefaultTextRenderFormat ( Qgis::TextRenderFormat format)
inline

Sets the default text rendering format for the labels.

See also
defaultTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 212 of file qgslabelingenginesettings.h.

◆ setFlag()

void QgsLabelingEngineSettings::setFlag ( Qgis::LabelingFlag f,
bool enabled = true )
inline

Sets whether a particual flag is enabled.

Definition at line 72 of file qgslabelingenginesettings.h.

◆ setFlags()

void QgsLabelingEngineSettings::setFlags ( Qgis::LabelingFlags flags)
inline

Sets flags of the labeling engine.

Definition at line 66 of file qgslabelingenginesettings.h.

◆ setMaximumLineCandidatesPerCm()

void QgsLabelingEngineSettings::setMaximumLineCandidatesPerCm ( double candidates)
inline

Sets the maximum number of line label candidates per centimeter.

See also
maximumLineCandidatesPerCm()
Since
QGIS 3.12

Definition at line 88 of file qgslabelingenginesettings.h.

◆ setMaximumPolygonCandidatesPerCmSquared()

void QgsLabelingEngineSettings::setMaximumPolygonCandidatesPerCmSquared ( double candidates)
inline

Sets the maximum number of polygon label candidates per centimeter squared.

See also
maximumPolygonCandidatesPerCmSquared()
Since
QGIS 3.12

Definition at line 104 of file qgslabelingenginesettings.h.

◆ setNumCandidatePositions()

Q_DECL_DEPRECATED void QgsLabelingEngineSettings::setNumCandidatePositions ( int candPoint,
int candLine,
int candPolygon )
inline

Sets the number of candidate positions that will be generated for each label feature.

Deprecated
QGIS 3.12. Use setMaximumPolygonCandidatesPerCmSquared() and setMaximumLineCandidatesPerCm() instead.

Definition at line 121 of file qgslabelingenginesettings.h.

◆ setPlacementVersion()

void QgsLabelingEngineSettings::setPlacementVersion ( Qgis::LabelPlacementEngineVersion version)

Sets the placement engine version, which dictates how the label placement problem is solved.

See also
placementVersion()
Since
QGIS 3.10.2

Definition at line 220 of file qgslabelingenginesettings.cpp.

◆ setRules()

void QgsLabelingEngineSettings::setRules ( const QList< QgsAbstractLabelingEngineRule * > & rules)

Sets the labeling engine rules which must be satisfied while placing labels.

Ownership of the rules are transferred to the settings.

See also
addRule()
rules()
Since
QGIS 3.40

Definition at line 250 of file qgslabelingenginesettings.cpp.

◆ setSearchMethod()

Q_DECL_DEPRECATED void QgsLabelingEngineSettings::setSearchMethod ( Search s)
inline

Used to set which search method to use for removal collisions between labels.

Deprecated
QGIS 3.10. Chain is always used.

Definition at line 132 of file qgslabelingenginesettings.h.

◆ setUnplacedLabelColor()

void QgsLabelingEngineSettings::setUnplacedLabelColor ( const QColor & color)

Sets the color to use when rendering unplaced labels.

See also
unplacedLabelColor()
Since
QGIS 3.10

Definition at line 210 of file qgslabelingenginesettings.cpp.

◆ testFlag()

bool QgsLabelingEngineSettings::testFlag ( Qgis::LabelingFlag f) const
inline

Test whether a particular flag is enabled.

Definition at line 70 of file qgslabelingenginesettings.h.

◆ unplacedLabelColor()

QColor QgsLabelingEngineSettings::unplacedLabelColor ( ) const

Returns the color to use when rendering unplaced labels.

See also
setUnplacedLabelColor()
Since
QGIS 3.10

Definition at line 205 of file qgslabelingenginesettings.cpp.

◆ writeSettingsToProject()

void QgsLabelingEngineSettings::writeSettingsToProject ( QgsProject * project)

Write configuration of the labeling engine to a project.

Note
Both this method and writeXml() must be called to completely store the object's state in a project.

Definition at line 133 of file qgslabelingenginesettings.cpp.

◆ writeXml()

void QgsLabelingEngineSettings::writeXml ( QDomDocument & doc,
QDomElement & element,
const QgsReadWriteContext & context ) const

Writes the label engine settings to an XML element.

Note
Both this method and writeSettingsToProject() must be called to completely store the object's state in a project.
See also
readXml()
writeSettingsToProject()
Since
QGIS 3.40

Definition at line 153 of file qgslabelingenginesettings.cpp.


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