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
|
#pragma once
#include "routing/geometry.hpp"
#include "routing/segment.hpp"
#include "routing/traffic_stash.hpp"
#include "routing/vehicle_mask.hpp"
#include "traffic/traffic_cache.hpp"
#include "routing_common/num_mwm_id.hpp"
#include "routing_common/vehicle_model.hpp"
#include "indexer/mwm_set.hpp"
#include "geometry/point2d.hpp"
#include <memory>
namespace routing
{
class EdgeEstimator
{
public:
EdgeEstimator(double maxSpeedKMpH, double offroadSpeedKMpH);
virtual ~EdgeEstimator() = default;
double CalcHeuristic(m2::PointD const & from, m2::PointD const & to) const;
// Estimates time in seconds it takes to go from point |from| to point |to| along a leap (fake)
// edge |from|-|to| using real features.
// Note 1. The result of the method should be used if it's necessary to add a leap (fake) edge
// (|from|, |to|) in road graph.
// Note 2. The result of the method should be less or equal to CalcHeuristic(|from|, |to|).
// Note 3. It's assumed here that CalcLeapWeight(p1, p2) == CalcLeapWeight(p2, p1).
double CalcLeapWeight(m2::PointD const & from, m2::PointD const & to) const;
// Estimates time in seconds it takes to go from point |from| to point |to| along direct fake
// edge.
double CalcOffroadWeight(m2::PointD const & from, m2::PointD const & to) const;
virtual double CalcSegmentWeight(Segment const & segment, RoadGeometry const & road) const = 0;
virtual double GetUTurnPenalty() const = 0;
// The leap is the shortcut edge from mwm border enter to exit.
// Router can't use leaps on some mwms: e.g. mwm with loaded traffic data.
// Check wherether leap is allowed on specified mwm or not.
virtual bool LeapIsAllowed(NumMwmId mwmId) const = 0;
static std::shared_ptr<EdgeEstimator> Create(VehicleType vehicleType, double maxSpeedKMpH,
double offroadSpeedKMpH,
std::shared_ptr<TrafficStash>);
static std::shared_ptr<EdgeEstimator> Create(VehicleType vehicleType,
VehicleModelInterface const & vehicleModel,
std::shared_ptr<TrafficStash>);
private:
double const m_maxSpeedMPS;
double const m_offroadSpeedMPS;
};
} // namespace routing
|