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

graph.hpp « openlr - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 178cb3f20fddd4a80ae34c2a7e8f97daa33e76b4 (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
#pragma once

#include "routing/features_road_graph.hpp"
#include "routing/road_graph.hpp"

#include "routing_common/car_model.hpp"

#include "geometry/point2d.hpp"

#include <cstddef>
#include <map>
#include <memory>
#include <vector>

class Index;

namespace openlr
{
// TODO(mgsergio): Inherit from FeaturesRoadGraph.
class Graph
{
public:
  using Edge = routing::Edge;
  using EdgeVector = routing::FeaturesRoadGraph::TEdgeVector;
  using Junction = routing::Junction;

  Graph(Index const & index, std::shared_ptr<routing::CarModelFactory> carModelFactory);

  // Appends edges such as that edge.GetStartJunction() == junction to the |edges|.
  void GetOutgoingEdges(routing::Junction const & junction, EdgeVector & edges);
  // Appends edges such as that edge.GetEndJunction() == junction to the |edges|.
  void GetIngoingEdges(routing::Junction const & junction, EdgeVector & edges);

  // Appends edges such as that edge.GetStartJunction() == junction and edge.IsFake() == false
  // to the |edges|.
  void GetRegularOutgoingEdges(Junction const & junction, EdgeVector & edges);
  // Appends edges such as that edge.GetEndJunction() == junction and edge.IsFale() == false
  // to the |edges|.
  void GetRegularIngoingEdges(Junction const & junction, EdgeVector & edges);

  void FindClosestEdges(m2::PointD const & point, uint32_t const count,
                        std::vector<pair<Edge, Junction>> & vicinities) const;

  void AddFakeEdges(Junction const & junction,
                    std::vector<pair<Edge, Junction>> const & vicinities);

  void AddIngoingFakeEdge(Edge const & e);
  void AddOutgoingFakeEdge(Edge const & e);

  void ResetFakes() { m_graph.ResetFakes(); }

private:
  routing::FeaturesRoadGraph m_graph;
  std::map<Junction, EdgeVector> m_outgoingCache;
  std::map<Junction, EdgeVector> m_ingoingCache;
};
}  // namespace openlr