36#include <unordered_map>
50using namespace Qt::StringLiterals;
132 void removeLayer(
Layer *layer );
141 inline bool isCanceled() {
return fnIsCanceled ? fnIsCanceled( fnIsCanceledContext ) :
false; }
175 QList<LabelPosition *> solveProblem(
Problem *prob,
QgsRenderContext &context,
bool displayAll, QList<pal::LabelPosition *> *unlabeled =
nullptr );
182 void setShowPartialLabels(
bool show );
285 void setRules(
const QList< QgsAbstractLabelingEngineRule * > &rules );
293 QList< QgsAbstractLabelingEngineRule * >
rules()
const {
return mRules; }
298 std::vector< std::pair< QgsAbstractLabelProvider *, std::unique_ptr< Layer > > > mLayers;
300 QList< QgsAbstractLabelingEngineRule * > mRules;
312 int mEjChainDeg = 50;
314 double mCandListSize = 0.2;
316 unsigned int mNextCandidateId = 1;
317 mutable QHash< QPair< unsigned int, unsigned int >,
bool > mCandidateConflicts;
322 bool mShowPartialLabels = DEFAULT_SHOW_PARTIAL_LABELS;
324 double mMaxLineCandidatesPerMapUnit = 0;
325 double mMaxPolygonCandidatesPerMapUnitSquared = 0;
327 int mGlobalCandidatesLimitPoint = 0;
328 int mGlobalCandidatesLimitLine = 0;
329 int mGlobalCandidatesLimitPolygon = 0;
334 FnIsCanceled fnIsCanceled =
nullptr;
336 void *fnIsCanceledContext =
nullptr;
342 void setPopmusicR(
int r );
348 void setMinIt(
int min_it );
354 void setMaxIt(
int max_it );
360 void setTenure(
int tenure );
366 void setEjChainDeg(
int degree );
372 void setCandListSize(
double fact );
379 int getMinIt()
const;
385 int getMaxIt()
const;
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
QFlags< LabelingFlag > LabelingFlags
Flags that affect drawing and placement of labels.
LabelPlacementEngineVersion
Labeling placement engine version.
@ Version2
Version 2 (default for new projects since QGIS 3.12).
An abstract interface class for label providers.
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.
A tree node for the settings tree to help organizing and introspecting the tree.
static QgsSettingsTreeNode * sTreeRendering
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.
Qgis::LabelingFlags flags() const
Returns labeling flags.
int globalCandidatesLimitPoint() const
Returns the global candidates limit for point features, or 0 if no global limit is in effect.
static QgsSettingsTreeNode * sTreePal
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.
bool(* FnIsCanceled)(void *ctx)
Cancellation check callback function.
bool showPartialLabels() const
Returns whether partial labels should be allowed.
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
static constexpr bool DEFAULT_SHOW_PARTIAL_LABELS
Pal(Qgis::LabelingFlags flags)
Constructor for pal labeling engine.
void registerCancellationCallback(FnIsCanceled fnCanceled, void *context)
Register a function that returns whether this job has been canceled - PAL calls it during the computa...
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 satisfy.
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.