QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Static Public Member Functions | List of all members
pal::CostCalculator Class Reference

Calculates label candidate costs considering different factors. More...

#include <costcalculator.h>

Static Public Member Functions

static void addObstacleCostPenalty (pal::LabelPosition *lp, pal::FeaturePart *obstacle, Pal *pal)
 Increase candidate's cost according to its collision with passed feature. More...
 
static void calculateCandidatePolygonCentroidDistanceCosts (pal::FeaturePart *feature, std::vector< std::unique_ptr< pal::LabelPosition > > &lPos)
 Updates the costs for polygon label candidates by considering the distance between the candidates and the polygon centroid (i.e. More...
 
static void calculateCandidatePolygonRingDistanceCosts (std::vector< std::unique_ptr< pal::LabelPosition > > &lPos, double bbx[4], double bby[4])
 Updates the costs for polygon label candidates by considering the distance between the candidates and the nearest polygon ring (i.e. More...
 
static double calculatePolygonRingDistance (LabelPosition *candidate, double bbx[4], double bby[4])
 Calculates the distance between a label candidate and the closest ring for a polygon feature. More...
 
static bool candidateSortGrow (const std::unique_ptr< pal::LabelPosition > &c1, const std::unique_ptr< pal::LabelPosition > &c2)
 Sorts label candidates in ascending order of cost. More...
 
static void finalizeCandidatesCosts (Feats *feat, double bbx[4], double bby[4])
 Sort candidates by costs, skip the worse ones, evaluate polygon candidates. More...
 

Detailed Description

Calculates label candidate costs considering different factors.

Note
not available in Python bindings

Definition at line 38 of file costcalculator.h.

Member Function Documentation

◆ addObstacleCostPenalty()

void CostCalculator::addObstacleCostPenalty ( pal::LabelPosition lp,
pal::FeaturePart obstacle,
Pal pal 
)
static

Increase candidate's cost according to its collision with passed feature.

Definition at line 33 of file costcalculator.cpp.

◆ calculateCandidatePolygonCentroidDistanceCosts()

void CostCalculator::calculateCandidatePolygonCentroidDistanceCosts ( pal::FeaturePart feature,
std::vector< std::unique_ptr< pal::LabelPosition > > &  lPos 
)
static

Updates the costs for polygon label candidates by considering the distance between the candidates and the polygon centroid (i.e.

given labels at similar distances from polygon rings, prefer labels closer to the centroid).

Definition at line 143 of file costcalculator.cpp.

◆ calculateCandidatePolygonRingDistanceCosts()

void CostCalculator::calculateCandidatePolygonRingDistanceCosts ( std::vector< std::unique_ptr< pal::LabelPosition > > &  lPos,
double  bbx[4],
double  bby[4] 
)
static

Updates the costs for polygon label candidates by considering the distance between the candidates and the nearest polygon ring (i.e.

prefer labels closer to the pole of inaccessibility).

Definition at line 110 of file costcalculator.cpp.

◆ calculatePolygonRingDistance()

double CostCalculator::calculatePolygonRingDistance ( LabelPosition candidate,
double  bbx[4],
double  bby[4] 
)
static

Calculates the distance between a label candidate and the closest ring for a polygon feature.

Definition at line 183 of file costcalculator.cpp.

◆ candidateSortGrow()

bool CostCalculator::candidateSortGrow ( const std::unique_ptr< pal::LabelPosition > &  c1,
const std::unique_ptr< pal::LabelPosition > &  c2 
)
static

Sorts label candidates in ascending order of cost.

Definition at line 28 of file costcalculator.cpp.

◆ finalizeCandidatesCosts()

void CostCalculator::finalizeCandidatesCosts ( Feats feat,
double  bbx[4],
double  bby[4] 
)
static

Sort candidates by costs, skip the worse ones, evaluate polygon candidates.

Definition at line 210 of file costcalculator.cpp.


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