QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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;
bool writeEntry(const QString &scope, const QString &key, bool value)
Write a boolean entry to the project file.
void readSettingsFromProject(QgsProject *project)
Read configuration of the labeling engine from a project.
static QString encodeColor(const QColor &color)
void clear()
Returns the configuration to the defaults.
@ DrawCandidates
Whether to draw rectangles of generated candidates (good for debugging)
TextRenderFormat
Options for rendering text.
PlacementEngineVersion placementVersion() const
Returns the placement engine version, which dictates how the label placement problem is solved.
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
bool readBoolEntry(const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const
static QColor decodeColor(const QString &str)
QgsLabelingEngineSettings()
PlacementEngineVersion
Placement engine version.
void writeSettingsToProject(QgsProject *project)
Write configuration of the labeling engine to a project.
void setUnplacedLabelColor(const QColor &color)
Sets the color to use when rendering unplaced labels.
@ TextFormatAlwaysText
Always render text as text objects.
QColor unplacedLabelColor() const
Returns the color to use when rendering unplaced labels.
double readDoubleEntry(const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const
@ PlacementEngineVersion1
Version 1, matches placement from QGIS <= 3.10.1.
Search
Search methods in the PAL library to remove colliding labels (methods have different processing speed...
void setPlacementVersion(PlacementEngineVersion version)
Sets the placement engine version, which dictates how the label placement problem is solved.
@ UsePartialCandidates
Whether to use also label candidates that are partially outside of the map view.
@ DrawLabelRectOnly
Whether to only draw the label rect and not the actual label text (used for unit tests)
@ TextFormatAlwaysOutlines
Always render text using path objects (AKA outlines/curves).
@ UseAllLabels
Whether to draw all labels even if there would be collisions.
@ DrawUnplacedLabels
Whether to render unplaced labels as an indicator/warning for users.
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const