Class: QgsLabelingEngineSettings¶
- class qgis.core.QgsLabelingEngineSettings¶
Bases:
sip.wrapper
Stores global configuration for labeling engine
New in version 3.0:
Methods
Returns the configuration to the defaults
Returns the default text rendering format for the labels.
Gets flags of the labeling engine
Returns the maximum number of line label candidate positions per centimeter.
Returns the maximum number of polygon label candidate positions per centimeter squared.
Gets number of candidate positions that will be generated for each label feature.
Returns the placement engine version, which dictates how the label placement problem is solved.
Read configuration of the labeling engine from a project
Which search method to use for removal collisions between labels
Sets the default text rendering
format
for the labels.Sets whether a particual flag is enabled
Sets flags of the labeling engine
Sets the maximum number of line label
candidates
per centimeter.Sets the maximum number of polygon label
candidates
per centimeter squared.Sets the number of candidate positions that will be generated for each label feature.
Sets the placement engine
version
, which dictates how the label placement problem is solved.Used to set which search method to use for removal collisions between labels
Sets the
color
to use when rendering unplaced labels.Test whether a particular flag is enabled
Returns the color to use when rendering unplaced labels.
Write configuration of the labeling engine to a project
Attributes
- Chain = 0¶
- DrawCandidates = 32¶
- DrawLabelRectOnly = 16¶
- DrawUnplacedLabels = 64¶
- Falp = 4¶
- class Flag¶
Bases:
int
- class Flags¶
- class Flags(Union[QgsLabelingEngineSettings.Flags, QgsLabelingEngineSettings.Flag]) None
- class Flags(QgsLabelingEngineSettings.Flags) None
Bases:
sip.wrapper
- class PlacementEngineVersion¶
Bases:
int
- PlacementEngineVersion1 = 0¶
- PlacementEngineVersion2 = 1¶
- Popmusic_Chain = 2¶
- Popmusic_Tabu = 1¶
- Popmusic_Tabu_Chain = 3¶
- RenderOutlineLabels = 8¶
- class Search¶
Bases:
int
- UseAllLabels = 2¶
- UsePartialCandidates = 4¶
- clear(self)¶
Returns the configuration to the defaults
- defaultTextRenderFormat(self) QgsRenderContext.TextRenderFormat ¶
Returns the default text rendering format for the labels.
See also
New in version 3.4.3.
- Return type
- flags(self) QgsLabelingEngineSettings.Flags ¶
Gets flags of the labeling engine
- Return type
- maximumLineCandidatesPerCm(self) float ¶
Returns the maximum number of line label candidate positions per centimeter.
See also
New in version 3.12.
- Return type
float
- maximumPolygonCandidatesPerCmSquared(self) float ¶
Returns the maximum number of polygon label candidate positions per centimeter squared.
New in version 3.12.
- Return type
float
- numCandidatePositions(self) Tuple[int, int, int] ¶
Gets number of candidate positions that will be generated for each label feature.
Deprecated since version QGIS: 3.12 use maximumPolygonCandidatesPerCmSquared() and maximumLineCandidatesPerCm() instead.
- Return type
Tuple[int, int, int]
- placementVersion(self) QgsLabelingEngineSettings.PlacementEngineVersion ¶
Returns the placement engine version, which dictates how the label placement problem is solved.
See also
New in version 3.10.2.
- Return type
- readSettingsFromProject(self, project: QgsProject)¶
Read configuration of the labeling engine from a project
- Parameters
project (QgsProject) –
- searchMethod(self) QgsLabelingEngineSettings.Search ¶
Which search method to use for removal collisions between labels
Deprecated since version QGIS: 3.10 - Chain is always used.
- Return type
- setDefaultTextRenderFormat(self, format: QgsRenderContext.TextRenderFormat)¶
Sets the default text rendering
format
for the labels.See also
New in version 3.4.3.
- Parameters
format (QgsRenderContext.TextRenderFormat) –
- setFlag(self, f: QgsLabelingEngineSettings.Flag, enabled: bool = True)¶
Sets whether a particual flag is enabled
- Parameters
enabled (bool = True) –
- setFlags(self, flags: Union[QgsLabelingEngineSettings.Flags, QgsLabelingEngineSettings.Flag])¶
Sets flags of the labeling engine
- Parameters
flags (Union[QgsLabelingEngineSettings.Flags) –
- setMaximumLineCandidatesPerCm(self, candidates: float)¶
Sets the maximum number of line label
candidates
per centimeter.See also
New in version 3.12.
- Parameters
candidates (float) –
- setMaximumPolygonCandidatesPerCmSquared(self, candidates: float)¶
Sets the maximum number of polygon label
candidates
per centimeter squared.New in version 3.12.
- Parameters
candidates (float) –
- setNumCandidatePositions(self, candPoint: int, candLine: int, candPolygon: int)¶
Sets the number of candidate positions that will be generated for each label feature.
Deprecated since version QGIS: 3.12 use setMaximumPolygonCandidatesPerCmSquared() and setMaximumLineCandidatesPerCm() instead.
- Parameters
candPoint (int) –
candLine (int) –
candPolygon (int) –
- setPlacementVersion(self, version: QgsLabelingEngineSettings.PlacementEngineVersion)¶
Sets the placement engine
version
, which dictates how the label placement problem is solved.See also
New in version 3.10.2.
- Parameters
version (QgsLabelingEngineSettings.PlacementEngineVersion) –
- setSearchMethod(self, s: QgsLabelingEngineSettings.Search)¶
Used to set which search method to use for removal collisions between labels
Deprecated since version QGIS: 3.10 - Chain is always used.
- Parameters
- setUnplacedLabelColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the
color
to use when rendering unplaced labels.See also
New in version 3.10.
- Parameters
color (Union[QColor) –
- testFlag(self, f: QgsLabelingEngineSettings.Flag) bool ¶
Test whether a particular flag is enabled
- Parameters
- Return type
bool
- unplacedLabelColor(self) QColor ¶
Returns the color to use when rendering unplaced labels.
See also
New in version 3.10.
- Return type
QColor
- writeSettingsToProject(self, project: QgsProject)¶
Write configuration of the labeling engine to a project
- Parameters
project (QgsProject) –