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

edge_estimator.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42fa90647549a7c634c2dabf276870062341fcca (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
#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 maxWeightSpeedKMpH, 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 CalcSegmentETA(Segment const & segment, RoadGeometry const & road) const = 0;
  virtual double GetUTurnPenalty() const = 0;

  static std::shared_ptr<EdgeEstimator> Create(VehicleType vehicleType, double maxWeighSpeedKMpH,
                                               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_maxWeightSpeedMpS;
  double const m_offroadSpeedMpS;
};
}  // namespace routing