QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
pal
costcalculator.h
Go to the documentation of this file.
1
/***************************************************************************
2
costcalculator.h
3
---------------------
4
begin : November 2009
5
copyright : (C) 2009 by Martin Dobias
6
email : wonder dot sk at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef COSTCALCULATOR_H
16
#define COSTCALCULATOR_H
17
18
19
#include "
palrtree.h
"
20
21
#include <QList>
22
23
#define SIP_NO_FILE
24
29
30
namespace
pal
31
{
32
class
Feats;
33
class
LabelPosition;
34
class
Pal;
35
class
FeaturePart;
36
class
PointSet;
37
42
class
CostCalculator
43
{
44
public
:
46
static
void
addObstacleCostPenalty
(
pal::LabelPosition
*lp,
pal::FeaturePart
*obstacle,
Pal
*
pal
);
47
52
static
void
calculateCandidatePolygonRingDistanceCosts
( std::vector<std::unique_ptr<pal::LabelPosition> > &lPos,
double
bbx[4],
double
bby[4] );
53
59
static
void
calculateCandidatePolygonCentroidDistanceCosts
(
pal::FeaturePart
*feature, std::vector<std::unique_ptr<pal::LabelPosition> > &lPos );
60
62
static
double
calculatePolygonRingDistance
(
LabelPosition
*candidate,
double
bbx[4],
double
bby[4] );
63
65
static
void
finalizeCandidatesCosts
(
Feats
*feat,
double
bbx[4],
double
bby[4] );
66
70
static
bool
candidateSortGrow
(
const
std::unique_ptr<pal::LabelPosition> &c1,
const
std::unique_ptr<pal::LabelPosition> &c2 );
71
};
72
79
class
CandidatePolygonRingDistanceCalculator
80
{
81
public
:
85
explicit
CandidatePolygonRingDistanceCalculator
(
LabelPosition
*candidate );
86
91
void
addRing
(
const
pal::PointSet
*ring );
92
96
double
minimumDistance
()
const
;
97
98
private
:
99
double
mPx;
100
double
mPy;
101
double
mMinDistance = std::numeric_limits<double>::max();
102
};
103
}
//namespace pal
104
105
#endif
// COSTCALCULATOR_H
pal::CandidatePolygonRingDistanceCalculator::addRing
void addRing(const pal::PointSet *ring)
Adds a ring to the calculation, updating the minimumDistance() value if the rings is closer to the ca...
Definition
costcalculator.cpp:268
pal::CandidatePolygonRingDistanceCalculator::minimumDistance
double minimumDistance() const
Returns the minimum distance between the candidate and all added rings.
Definition
costcalculator.cpp:277
pal::CandidatePolygonRingDistanceCalculator::CandidatePolygonRingDistanceCalculator
CandidatePolygonRingDistanceCalculator(LabelPosition *candidate)
Constructor for PolygonRingDistanceCalculator, for the specified label candidate.
Definition
costcalculator.cpp:263
pal::CostCalculator
Calculates label candidate costs considering different factors.
Definition
costcalculator.h:43
pal::CostCalculator::calculatePolygonRingDistance
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.
Definition
costcalculator.cpp:185
pal::CostCalculator::addObstacleCostPenalty
static void addObstacleCostPenalty(pal::LabelPosition *lp, pal::FeaturePart *obstacle, Pal *pal)
Increase candidate's cost according to its collision with passed feature.
Definition
costcalculator.cpp:35
pal::CostCalculator::finalizeCandidatesCosts
static void finalizeCandidatesCosts(Feats *feat, double bbx[4], double bby[4])
Sort candidates by costs, skip the worse ones, evaluate polygon candidates.
Definition
costcalculator.cpp:212
pal::CostCalculator::candidateSortGrow
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.
Definition
costcalculator.cpp:30
pal::CostCalculator::calculateCandidatePolygonRingDistanceCosts
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...
Definition
costcalculator.cpp:112
pal::CostCalculator::calculateCandidatePolygonCentroidDistanceCosts
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...
Definition
costcalculator.cpp:145
pal::Feats
For usage in problem solving algorithm.
Definition
util.h:57
pal::FeaturePart
Represents a part of a label feature.
Definition
feature.h:60
pal::LabelPosition
LabelPosition is a candidate feature label position.
Definition
labelposition.h:57
pal::Pal
Main Pal labeling class.
Definition
pal.h:87
pal::PointSet
The underlying raw pal geometry class.
Definition
pointset.h:76
pal
Definition
qgsdiagramrenderer.h:51
palrtree.h
Generated on
for QGIS API Documentation by
1.17.0