46#include <unordered_map>
121 void removeLayer(
Layer *layer );
123 typedef bool ( *FnIsCanceled )(
void *ctx );
126 void registerCancellationCallback( FnIsCanceled fnCanceled,
void *context );
129 inline bool isCanceled() {
return fnIsCanceled ? fnIsCanceled( fnIsCanceledContext ) :
false; }
163 QList<LabelPosition *> solveProblem(
Problem *prob,
QgsRenderContext &context,
bool displayAll, QList<pal::LabelPosition *> *unlabeled =
nullptr );
170 void setShowPartialLabels(
bool show );
177 bool showPartialLabels()
const;
271 void setRules(
const QList< QgsAbstractLabelingEngineRule * > &rules );
279 QList< QgsAbstractLabelingEngineRule * >
rules()
const {
return mRules; }
283 std::unordered_map< QgsAbstractLabelProvider *, std::unique_ptr< Layer > > mLayers;
285 QList< QgsAbstractLabelingEngineRule * > mRules;
297 int mEjChainDeg = 50;
299 double mCandListSize = 0.2;
301 unsigned int mNextCandidateId = 1;
302 mutable QHash< QPair< unsigned int, unsigned int >,
bool > mCandidateConflicts;
307 bool mShowPartialLabels =
true;
309 double mMaxLineCandidatesPerMapUnit = 0;
310 double mMaxPolygonCandidatesPerMapUnitSquared = 0;
312 int mGlobalCandidatesLimitPoint = 0;
313 int mGlobalCandidatesLimitLine = 0;
314 int mGlobalCandidatesLimitPolygon = 0;
319 FnIsCanceled fnIsCanceled =
nullptr;
321 void *fnIsCanceledContext =
nullptr;
327 void setPopmusicR(
int r );
333 void setMinIt(
int min_it );
339 void setMaxIt(
int max_it );
345 void setTenure(
int tenure );
351 void setEjChainDeg(
int degree );
357 void setCandListSize(
double fact );
364 int getMinIt()
const;
370 int getMaxIt()
const;
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
LabelPlacementEngineVersion
Labeling placement engine version.
@ Version2
Version 2 (default for new projects since QGIS 3.12)
The QgsAbstractLabelProvider class is an interface class.
Abstract base class for labeling engine rules.
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
An integer settings entry.
QgsSettingsTreeNode is a tree node for the settings tree to help organizing and introspecting the tre...
QgsSettingsTreeNode * createChildNode(const QString &key)
Creates a normal tree node It will return the existing child node if it exists at the given key.
static QgsSettingsTreeNode * sTreeRendering
Main class to handle feature.
LabelPosition is a candidate feature label position.
A set of features which influence the labeling process.
double maximumLineCandidatesPerMapUnit() const
Returns the maximum number of line label candidate positions per map unit.
int globalCandidatesLimitPoint() const
Returns the global candidates limit for point features, or 0 if no global limit is in effect.
double maximumPolygonCandidatesPerMapUnitSquared() const
Returns the maximum number of polygon label candidate positions per map unit squared.
void setMaximumPolygonCandidatesPerMapUnitSquared(double candidates)
Sets the maximum number of polygon label candidates per map unit squared.
int globalCandidatesLimitLine() const
Returns the global candidates limit for line features, or 0 if no global limit is in effect.
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitLines
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitPoints
static const QgsSettingsEntryInteger * settingsRenderingLabelCandidatesLimitPolygons
void setMaximumLineCandidatesPerMapUnit(double candidates)
Sets the maximum number of line label candidates per map unit.
bool isCanceled()
Check whether the job has been canceled.
Pal(const Pal &other)=delete
int globalCandidatesLimitPolygon() const
Returns the global candidates limit for polygon features, or 0 if no global limit is in effect.
Pal & operator=(const Pal &other)=delete
QList< QgsAbstractLabelingEngineRule * > rules() const
Returns the rules which the labeling solution must satisify.
Representation of a labeling problem.
SearchMethod
Search method to use.
@ FALP
Only initial solution.
@ POPMUSIC_TABU
Is a little bit better than CHAIN but slower.
@ POPMUSIC_CHAIN
Is slower and best than TABU, worse and faster than TABU_CHAIN.
@ CHAIN
Is the worst but fastest method.
@ POPMUSIC_TABU_CHAIN
Is the best but slowest.