QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Classes | Public Member Functions | Friends | List of all members
pal::Problem Class Reference

Representation of a labeling problem. More...

#include <problem.h>

Public Member Functions

 Problem (const Problem &other)=delete
 
 Problem (const QgsRectangle &extent)
 Constructor for Problem.
 
 ~Problem ()
 
void addCandidatePosition (std::unique_ptr< LabelPosition > position)
 Adds a candidate label position to the problem.
 
PalRtree< LabelPosition > & allCandidatesIndex ()
 Returns the index containing all label candidates.
 
void chainSearch (QgsRenderContext &context)
 Test with very-large scale neighborhood.
 
LabelPositionfeatureCandidate (int feature, int candidate) const
 Returns the candidate corresponding to the specified feature and candidate index.
 
int featureCandidateCount (int feature) const
 Returns the number of candidates generated for the feature at the specified index.
 
std::size_t featureCount () const
 Returns the total number of features considered during the labeling problem.
 
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.
 
void init_sol_falp ()
 
Problemoperator= (const Problem &other)=delete
 
std::vector< std::unique_ptr< LabelPosition > > * positionsWithNoCandidates ()
 Returns a reference to the list of label positions which correspond to features with no candidates.
 
void reduce ()
 Gets called AFTER extractProblem.
 

Friends

class Pal
 

Detailed Description

Representation of a labeling problem.

Note
not available in Python bindings

Definition at line 72 of file problem.h.

Constructor & Destructor Documentation

◆ Problem() [1/2]

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.

◆ ~Problem()

Problem::~Problem ( )
default

◆ Problem() [2/2]

pal::Problem::Problem ( const Problem other)
delete

Member Function Documentation

◆ addCandidatePosition()

void Problem::addCandidatePosition ( std::unique_ptr< LabelPosition position)

Adds a candidate label position to the problem.

Parameters
positionlabel candidate position. Ownership is transferred to Problem.

Definition at line 64 of file problem.cpp.

◆ allCandidatesIndex()

PalRtree< LabelPosition > & pal::Problem::allCandidatesIndex ( )
inline

Returns the index containing all label candidates.

Definition at line 156 of file problem.h.

◆ chainSearch()

void Problem::chainSearch ( QgsRenderContext context)

Test with very-large scale neighborhood.

Definition at line 561 of file problem.cpp.

◆ featureCandidate()

LabelPosition * pal::Problem::featureCandidate ( int  feature,
int  candidate 
) const
inline

Returns the candidate corresponding to the specified feature and candidate index.

Definition at line 111 of file problem.h.

◆ featureCandidateCount()

int pal::Problem::featureCandidateCount ( int  feature) const
inline

Returns the number of candidates generated for the feature at the specified index.

Definition at line 106 of file problem.h.

◆ featureCount()

std::size_t pal::Problem::featureCount ( ) const
inline

Returns the total number of features considered during the labeling problem.

Definition at line 101 of file problem.h.

◆ getSolution()

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 644 of file problem.cpp.

◆ init_sol_falp()

void Problem::init_sol_falp ( )

Definition at line 166 of file problem.cpp.

◆ operator=()

Problem & pal::Problem::operator= ( const Problem other)
delete

◆ positionsWithNoCandidates()

std::vector< std::unique_ptr< LabelPosition > > * pal::Problem::positionsWithNoCandidates ( )
inline

Returns a reference to the list of label positions which correspond to features with no candidates.

Ownership of positions added to this list is transferred to the problem.

Definition at line 148 of file problem.h.

◆ reduce()

void Problem::reduce ( )

Gets called AFTER extractProblem.

Definition at line 71 of file problem.cpp.

Friends And Related Symbol Documentation

◆ Pal

friend class Pal
friend

Definition at line 74 of file problem.h.


The documentation for this class was generated from the following files: