QGIS API Documentation  3.9.0-Master (635e245143)
Public Types | Public Member Functions | List of all members
QgsLabelingEngineSettings Class Reference

Stores global configuration for labeling engine. More...

#include <qgslabelingenginesettings.h>

Public Types

enum  Flag {
  UseAllLabels = 1 << 1, UsePartialCandidates = 1 << 2, RenderOutlineLabels = 1 << 3, DrawLabelRectOnly = 1 << 4,
  DrawCandidates = 1 << 5, DrawUnplacedLabels = 1 << 6
}
 Various flags that affect drawing and placement of labels. More...
 
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 ()
 
void clear ()
 Returns the configuration to the defaults. More...
 
QgsRenderContext::TextRenderFormat defaultTextRenderFormat () const
 Returns the default text rendering format for the labels. More...
 
Flags flags () const
 Gets flags of the labeling engine. More...
 
void numCandidatePositions (int &candPoint, int &candLine, int &candPolygon) const
 Gets number of candidate positions that will be generated for each label feature (default to 8) More...
 
void readSettingsFromProject (QgsProject *project)
 Read configuration of the labeling engine from a project. More...
 
Q_DECL_DEPRECATED Search searchMethod () const
 Which search method to use for removal collisions between labels. More...
 
void setDefaultTextRenderFormat (QgsRenderContext::TextRenderFormat format)
 Sets the default text rendering format for the labels. More...
 
void setFlag (Flag f, bool enabled=true)
 Sets whether a particual flag is enabled. More...
 
void setFlags (Flags flags)
 Sets flags of the labeling engine. More...
 
void setNumCandidatePositions (int candPoint, int candLine, int candPolygon)
 Sets number of candidate positions that will be generated for each label feature. More...
 
Q_DECL_DEPRECATED void setSearchMethod (Search s)
 Used to set which search method to use for removal collisions between labels. More...
 
void setUnplacedLabelColor (const QColor &color)
 Sets the color to use when rendering unplaced labels. More...
 
bool testFlag (Flag f) const
 Test whether a particular flag is enabled. More...
 
QColor unplacedLabelColor () const
 Returns the color to use when rendering unplaced labels. More...
 
void writeSettingsToProject (QgsProject *project)
 Write configuration of the labeling engine to a project. More...
 

Detailed Description

Stores global configuration for labeling engine.

Since
QGIS 3.0

Definition at line 30 of file qgslabelingenginesettings.h.

Member Enumeration Documentation

◆ Flag

Various flags that affect drawing and placement of labels.

Enumerator
UseAllLabels 

Whether to draw all labels even if there would be collisions.

UsePartialCandidates 

Whether to use also label candidates that are partially outside of the map view.

RenderOutlineLabels 

Whether to render labels as text or outlines. Deprecated and of QGIS 3.4.3 - use defaultTextRenderFormat() instead.

DrawLabelRectOnly 

Whether to only draw the label rect and not the actual label text (used for unit tests)

DrawCandidates 

Whether to draw rectangles of generated candidates (good for debugging)

DrawUnplacedLabels 

Whether to render unplaced labels as an indicator/warning for users.

Definition at line 34 of file qgslabelingenginesettings.h.

◆ 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 52 of file qgslabelingenginesettings.h.

Constructor & Destructor Documentation

◆ QgsLabelingEngineSettings()

QgsLabelingEngineSettings::QgsLabelingEngineSettings ( )

Definition at line 21 of file qgslabelingenginesettings.cpp.

Member Function Documentation

◆ clear()

void QgsLabelingEngineSettings::clear ( )

Returns the configuration to the defaults.

Definition at line 26 of file qgslabelingenginesettings.cpp.

◆ defaultTextRenderFormat()

QgsRenderContext::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 107 of file qgslabelingenginesettings.h.

◆ flags()

Flags QgsLabelingEngineSettings::flags ( ) const
inline

Gets flags of the labeling engine.

Definition at line 69 of file qgslabelingenginesettings.h.

◆ numCandidatePositions()

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

Gets number of candidate positions that will be generated for each label feature (default to 8)

Definition at line 76 of file qgslabelingenginesettings.h.

◆ readSettingsFromProject()

void QgsLabelingEngineSettings::readSettingsFromProject ( QgsProject project)

Read configuration of the labeling engine from a project.

Definition at line 31 of file qgslabelingenginesettings.cpp.

◆ searchMethod()

Q_DECL_DEPRECATED Search QgsLabelingEngineSettings::searchMethod ( ) const
inline

Which search method to use for removal collisions between labels.

Deprecated:
since QGIS 3.10 - Chain is always used.

Definition at line 90 of file qgslabelingenginesettings.h.

◆ setDefaultTextRenderFormat()

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

Sets the default text rendering format for the labels.

See also
defaultTextRenderFormat()
Since
QGIS 3.4.3

Definition at line 118 of file qgslabelingenginesettings.h.

◆ setFlag()

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

Sets whether a particual flag is enabled.

Definition at line 73 of file qgslabelingenginesettings.h.

◆ setFlags()

void QgsLabelingEngineSettings::setFlags ( Flags  flags)
inline

Sets flags of the labeling engine.

Definition at line 67 of file qgslabelingenginesettings.h.

◆ setNumCandidatePositions()

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

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

Definition at line 78 of file qgslabelingenginesettings.h.

◆ setSearchMethod()

Q_DECL_DEPRECATED void QgsLabelingEngineSettings::setSearchMethod ( Search  s)
inline

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

Deprecated:
since QGIS 3.10 - Chain is always used.

Definition at line 84 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 81 of file qgslabelingenginesettings.cpp.

◆ testFlag()

bool QgsLabelingEngineSettings::testFlag ( Flag  f) const
inline

Test whether a particular flag is enabled.

Definition at line 71 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 76 of file qgslabelingenginesettings.cpp.

◆ writeSettingsToProject()

void QgsLabelingEngineSettings::writeSettingsToProject ( QgsProject project)

Write configuration of the labeling engine to a project.

Definition at line 58 of file qgslabelingenginesettings.cpp.


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