All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RangeSolver.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Routes.h"
7 #include "MortonKey.h"
8 #include "SolverConfig.h"
9 #include "SolverRange.h"
10 #include <vector>
11 
12 namespace Eegeo
13 {
14  namespace Routes
15  {
16  namespace Fitting
17  {
18  namespace NavGraphConforming
19  {
21  {
22  public:
23  RangeSolver(const SolverConfig& config,
24  SolverNodeAllocator& nodeAllocator,
25  const Streaming::MortonKey& key,
26  const std::vector<const CandidateSet*>& candidatesSets);
27  virtual ~RangeSolver();
28 
29  virtual bool TrySolve(std::vector<ConformerSolution>& out_solutions);
30 
31  static void DestroySolutions(const std::vector<ConformerSolution>& solutions);
32 
33 
34  private:
35  void BuildSolverRanges(std::vector<SolverRange>& solverRanges) const;
36  bool TrySolveRange(const SolverRange& range, std::vector<const Candidate*>& rangeSolution);
37  bool ContainsRailOrRoadWithoutCandidate(const std::vector<SolverRange>& solverRanges) const;
38  bool RangeContainsRoadOrRail(const SolverRange& solverRange) const;
39  void LogCandidateSets() const;
40  void AddUnfittedSolutionsForRange(const SolverRange& solverRange, std::vector<ConformerSolution>& out_solutions) const;
41 
42  typedef std::vector<Candidate*> TCandidatesInner;
43  typedef std::vector<const CandidateSet*> TCandidatesOuter;
44 
45  const SolverConfig m_config;
46 
47  const TCandidatesOuter& m_candidateSets;
48  const Streaming::MortonKey m_key;
49  SolverNodeAllocator& m_nodeAllocator;
50  };
51  }
52  }
53  }
54 }