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

router.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e8e0da7d9c64e3d51ccb0ca8ed092db5e511641 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once

#include "router_delegate.hpp"

#include "geometry/point2d.hpp"

#include "base/cancellable.hpp"

#include "std/function.hpp"
#include "std/string.hpp"

namespace routing
{

using TCountryFileFn = function<string(m2::PointD const &)>;

class Route;

/// Routing engine type.
enum class RouterType
{
  // @TODO It's necessary to rename Vehicle value to Car.
  Vehicle = 0,  /// For Car routing (OSRM or AStar)
  Pedestrian,   /// For A star pedestrian routing
  Bicycle,      /// For A star bicycle routing
  Taxi,         /// For taxi route calculation Vehicle routing is used.
};

string ToString(RouterType type);
RouterType FromString(string const & str);

class IRouter
{
public:
  /// Routing possible statuses enumeration.
  /// \warning  this enum has JNI mirror!
  /// \see android/src/com/mapswithme/maps/routing/ResultCodesHelper.java
  // TODO(gardster): Please check what items become obsolete now
  enum ResultCode // TODO(mgsergio) enum class
  {
    NoError = 0,
    Cancelled = 1,
    NoCurrentPosition = 2,
    InconsistentMWMandRoute = 3,
    RouteFileNotExist = 4,
    StartPointNotFound = 5,
    EndPointNotFound = 6,
    PointsInDifferentMWM = 7,
    RouteNotFound = 8,
    NeedMoreMaps = 9,
    InternalError = 10,
    FileTooOld = 11
  };

  virtual ~IRouter() {}

  /// Return unique name of a router implementation.
  virtual string GetName() const = 0;

  /// Clear all temporary buffers.
  virtual void ClearState() {}

  /// Override this function with routing implementation.
  /// It will be called in separate thread and only one function will processed in same time.
  /// @warning please support Cancellable interface calls. You must stop processing when it is true.
  ///
  /// @param startPoint point to start routing
  /// @param startDirection start direction for routers with high cost of the turnarounds
  /// @param finalPoint target point for route
  /// @param delegate callback functions and cancellation flag
  /// @param route result route
  /// @return ResultCode error code or NoError if route was initialised
  /// @see Cancellable
  virtual ResultCode CalculateRoute(m2::PointD const & startPoint,
                                    m2::PointD const & startDirection,
                                    m2::PointD const & finalPoint, RouterDelegate const & delegate,
                                    Route & route) = 0;
};

}  // namespace routing