Welcome to mirror list, hosted at ThFree Co, Russian Federation.

astar_router.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e61906bca3b51845c0fad14873981acb8bb677e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include "routing/directions_engine.hpp"
#include "routing/edge_estimator.hpp"
#include "routing/road_graph.hpp"
#include "routing/router.hpp"
#include "routing/vehicle_model.hpp"

#include "indexer/index.hpp"

#include "std/shared_ptr.hpp"
#include "std/unique_ptr.hpp"
#include "std/vector.hpp"

namespace routing
{
class IndexGraph;

class AStarRouter
{
public:
  AStarRouter(string const & name, Index const & index,
              shared_ptr<VehicleModelFactory> vehicleModelFactory,
              shared_ptr<EdgeEstimator> estimator, unique_ptr<IDirectionsEngine> directionsEngine);

  string const & GetName() const { return m_name; }

  IRouter::ResultCode CalculateRoute(MwmSet::MwmId const & mwmId, m2::PointD const & startPoint,
                                     m2::PointD const & startDirection,
                                     m2::PointD const & finalPoint, RouterDelegate const & delegate,
                                     Route & route);

private:
  IRouter::ResultCode DoCalculateRoute(MwmSet::MwmId const & mwmId, m2::PointD const & startPoint,
                                       m2::PointD const & startDirection,
                                       m2::PointD const & finalPoint,
                                       RouterDelegate const & delegate, Route & route);
  bool FindClosestEdge(MwmSet::MwmId const & mwmId, m2::PointD const & point,
                       Edge & closestEdge) const;
  bool LoadIndex(MwmSet::MwmId const & mwmId, string const & country, IndexGraph & graph);

  string m_name;
  Index const & m_index;
  unique_ptr<IRoadGraph> m_roadGraph;
  shared_ptr<VehicleModelFactory> m_vehicleModelFactory;
  shared_ptr<EdgeEstimator> m_estimator;
  unique_ptr<IDirectionsEngine> m_directionsEngine;
};

unique_ptr<AStarRouter> CreateCarAStarBidirectionalRouter(Index & index);
}  // namespace routing