QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include "rtree.hpp"
19 
20 namespace pal
21 {
22  class Feats;
23 
25  {
26  public:
28  static void addObstacleCostPenalty( LabelPosition* lp, PointSet* feat );
29 
30  static void setPolygonCandidatesCost( int nblp, LabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
31 
33  static void setCandidateCostFromPolygon( LabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
34 
36  static int finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
37  };
38 
47  {
48  LabelPosition *lp;
49  double px, py;
50  double dist;
51  bool ok;
52 
53  public:
55 
56  void update( PointSet *pset );
57 
58  double getCost();
59 
61  };
62 }
63 
64 #endif // COSTCALCULATOR_H
static void setCandidateCostFromPolygon(LabelPosition *lp, RTree< PointSet *, double, 2, double > *obstacles, double bbx[4], double bby[4])
Set cost to the smallest distance between lPos's centroid and a polygon stored in geoetry field...
static void setPolygonCandidatesCost(int nblp, LabelPosition **lPos, int max_p, RTree< PointSet *, double, 2, double > *obstacles, double bbx[4], double bby[4])
static void addObstacleCostPenalty(LabelPosition *lp, PointSet *feat)
increase candidate's cost according to its collision with passed feature
void update(PointSet *pset)
For usage in problem solving algorithm.
Definition: util.h:59
static int finalizeCandidatesCosts(Feats *feat, int max_p, RTree< PointSet *, double, 2, double > *obstacles, double bbx[4], double bby[4])
sort candidates by costs, skip the worse ones, evaluate polygon candidates
LabelPosition is a candidate feature label position.
Definition: labelposition.h:54
PolygonCostCalculator(LabelPosition *lp)
Data structure to compute polygon's candidates costs.