All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Candidate.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Routes.h"
6 #include "Types.h"
7 
8 namespace Eegeo
9 {
10  namespace Routes
11  {
12  namespace Fitting
13  {
14  namespace NavGraphConforming
15  {
16  struct Candidate
17  {
18  public:
19  Candidate()
20  : m_candidateSet(NULL)
21  , m_roadFittingInfo(NULL)
22  , m_cost(0.f)
23  , m_splineParamAtClosestPoint(0.f)
24  , m_directionFromTo(false)
25  {
26 
27  }
28 
29  Candidate(const CandidateSet* candidateSet,
30  const NavGraphRoadFittingInfo* roadFittingInfo,
31  float cost,
32  float splineParamAtClosestPoint,
33  bool directionFromTo)
34  : m_candidateSet(candidateSet)
35  , m_roadFittingInfo(roadFittingInfo)
36  , m_cost(cost)
37  , m_splineParamAtClosestPoint(splineParamAtClosestPoint)
38  , m_directionFromTo(directionFromTo)
39  {
40 
41  }
42 
43  void FixupCandidateSet(const CandidateSet* candidateSet)
44  {
45  Eegeo_ASSERT(m_candidateSet == NULL);
46  m_candidateSet = candidateSet;
47  }
48 
49  const CandidateSet* GetCandidateSet() const { return m_candidateSet; }
50  const NavGraphRoadFittingInfo* GetRoadFittingInfo() const { return m_roadFittingInfo; }
51  float GetCost() const { return m_cost; }
52  float GetSplineParamAtClosestPoint() const { return m_splineParamAtClosestPoint; }
53  bool GetDirectionFromTo() const { return m_directionFromTo; }
54 
55  static inline bool OrderByCostPtr(const Candidate* a, const Candidate* b)
56  {
57  return a->m_cost < b->m_cost;
58  }
59 
60  private:
61  const CandidateSet* m_candidateSet;
62  const NavGraphRoadFittingInfo* m_roadFittingInfo;
63  float m_cost;
64  float m_splineParamAtClosestPoint;
65  bool m_directionFromTo;
66  };
67  }
68  }
69  }
70 }