22 : mFlags( UsePartialCandidates )
34 mSearchMethod =
static_cast< Search >( prj->
readNumEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/SearchMethod" ),
static_cast< int >(
Chain ), &saved ) );
35 mMaxLineCandidatesPerCm = prj->
readDoubleEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesLinePerCM" ), 5, &saved );
36 mMaxPolygonCandidatesPerCmSquared = prj->
readDoubleEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesPolygonPerCM" ), 2.5, &saved );
39 if ( prj->
readBoolEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/ShowingCandidates" ),
false, &saved ) ) mFlags |=
DrawCandidates;
41 if ( prj->
readBoolEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/ShowingAllLabels" ),
false, &saved ) ) mFlags |=
UseAllLabels;
47 if ( !prj->
readBoolEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/DrawOutlineLabels" ),
true ) )
50 const int projectTextFormat = prj->
readNumEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/TextFormat" ), -1 );
51 if ( projectTextFormat >= 0 )
61 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/SearchMethod" ),
static_cast< int >( mSearchMethod ) );
62 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesLinePerCM" ), mMaxLineCandidatesPerCm );
63 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/CandidatesPolygonPerCM" ), mMaxPolygonCandidatesPerCmSquared );
65 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/ShowingCandidates" ), mFlags.testFlag(
DrawCandidates ) );
68 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/ShowingAllLabels" ), mFlags.testFlag(
UseAllLabels ) );
71 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/TextFormat" ),
static_cast< int >( mDefaultTextRenderFormat ) );
75 project->
writeEntry( QStringLiteral(
"PAL" ), QStringLiteral(
"/PlacementEngineVersion" ), mPlacementVersion );
80 return mUnplacedLabelColor;
90 return mPlacementVersion;
void writeSettingsToProject(QgsProject *project)
Write configuration of the labeling engine to a project.
QgsLabelingEngineSettings()
@ 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.
@ DrawUnplacedLabels
Whether to render unplaced labels as an indicator/warning for users.
@ 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)
Search
Search methods in the PAL library to remove colliding labels (methods have different processing speed...
QColor unplacedLabelColor() const
Returns the color to use when rendering unplaced labels.
PlacementEngineVersion
Placement engine version.
@ PlacementEngineVersion1
Version 1, matches placement from QGIS <= 3.10.1.
void clear()
Returns the configuration to the defaults.
void setUnplacedLabelColor(const QColor &color)
Sets the color to use when rendering unplaced labels.
PlacementEngineVersion placementVersion() const
Returns the placement engine version, which dictates how the label placement problem is solved.
void setPlacementVersion(PlacementEngineVersion version)
Sets 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.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
Reads a string from the specified scope and key.
bool readBoolEntry(const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const
Reads a boolean from the specified scope and key.
double readDoubleEntry(const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const
Reads a double from the specified scope and key.
bool writeEntry(const QString &scope, const QString &key, bool value)
Write a boolean value to the project file.
TextRenderFormat
Options for rendering text.
@ TextFormatAlwaysText
Always render text as text objects.
@ TextFormatAlwaysOutlines
Always render text using path objects (AKA outlines/curves).
static QColor decodeColor(const QString &str)
static QString encodeColor(const QColor &color)