QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
Representation of a labeling problem. More...
#include <problem.h>
Public Member Functions | |
Problem (const Problem &other)=delete | |
Problem cannot be copied. More... | |
Problem (const QgsRectangle &extent) | |
Constructor for Problem. More... | |
~Problem () | |
void | addCandidatePosition (std::unique_ptr< LabelPosition > position) |
Adds a candidate label position to the problem. More... | |
PalRtree< LabelPosition > & | allCandidatesIndex () |
Returns the index containing all label candidates. More... | |
void | chainSearch (QgsRenderContext &context) |
Test with very-large scale neighborhood. More... | |
LabelPosition * | featureCandidate (int feature, int candidate) const |
Returns the candidate corresponding to the specified feature and candidate index. More... | |
int | featureCandidateCount (int feature) const |
Returns the number of candidates generated for the feature at the specified index. More... | |
std::size_t | featureCount () const |
Returns the total number of features considered during the labeling problem. More... | |
QList< LabelPosition * > | getSolution (bool returnInactive, QList< LabelPosition * > *unlabeled=nullptr) |
Solves the labeling problem, selecting the best candidate locations for all labels and returns a list of these calculated label positions. More... | |
void | init_sol_falp () |
Problem & | operator= (const Problem &other)=delete |
Problem cannot be copied. More... | |
std::vector< std::unique_ptr< LabelPosition > > * | positionsWithNoCandidates () |
Returns a reference to the list of label positions which correspond to features with no candidates. More... | |
void | reduce () |
Friends | |
class | Pal |
Representation of a labeling problem.
Problem::Problem | ( | const QgsRectangle & | extent | ) |
Constructor for Problem.
The extent argument specifies the bounds of the incoming coordinates.
Definition at line 57 of file problem.cpp.
|
default |
|
inline |
|
inline |
void Problem::chainSearch | ( | QgsRenderContext & | context | ) |
Test with very-large scale neighborhood.
Definition at line 573 of file problem.cpp.
|
inline |
|
inline |
|
inline |
QList< LabelPosition * > Problem::getSolution | ( | bool | returnInactive, |
QList< LabelPosition * > * | unlabeled = nullptr |
||
) |
Solves the labeling problem, selecting the best candidate locations for all labels and returns a list of these calculated label positions.
If returnInactive is true
, then the best positions for ALL labels will be returned, regardless of whether these labels overlap other labels.
If the optional unlabeled list is specified, it will be filled with a list of all feature labels which could not be placed in the returned solution (e.g. due to overlaps or other constraints).
Ownership of the returned labels is not transferred - it resides with the pal object.
Definition at line 659 of file problem.cpp.
void Problem::init_sol_falp | ( | ) |
Definition at line 169 of file problem.cpp.
|
inline |
void Problem::reduce | ( | ) |
Definition at line 66 of file problem.cpp.