blob: ef40180b9eb8aaee3e9d87848fcbbece64afbaac (
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
|
#pragma once
#include "routing/cross_mwm_index_graph.hpp"
#include "routing/edge_estimator.hpp"
#include "routing/geometry.hpp"
#include "routing/index_graph.hpp"
#include "routing/index_graph_loader.hpp"
#include "routing/segment.hpp"
#include <memory>
#include <unordered_map>
#include <vector>
namespace routing
{
class WorldGraph final
{
public:
WorldGraph(std::unique_ptr<CrossMwmIndexGraph> crossMwmGraph,
std::unique_ptr<IndexGraphLoader> loader, std::shared_ptr<EdgeEstimator> estimator);
void GetEdgeList(Segment const & segment, bool isOutgoing, bool isLeap,
std::vector<SegmentEdge> & edges);
IndexGraph & GetIndexGraph(NumMwmId numMwmId) { return m_loader->GetIndexGraph(numMwmId); }
EdgeEstimator const & GetEstimator() const { return *m_estimator; }
RoadGeometry const & GetRoadGeometry(NumMwmId mwmId, uint32_t featureId);
// Disable edges between mwms.
// Unblocking is not implemented due to YAGNI principle.
void BlockMwmBorders() { m_crossMwmGraph = nullptr; }
// Clear memory used by loaded index graphs.
void ClearIndexGraphs() { m_loader->Clear(); }
private:
void GetTwins(Segment const & s, bool isOutgoing, std::vector<SegmentEdge> & edges);
std::unique_ptr<CrossMwmIndexGraph> m_crossMwmGraph;
std::unique_ptr<IndexGraphLoader> m_loader;
std::shared_ptr<EdgeEstimator> m_estimator;
std::vector<Segment> m_twins;
};
} // namespace routing
|