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
|
#pragma once
#include "routing/directions_engine.hpp"
#include "routing/loaded_path_segment.hpp"
#include "routing/turn_candidate.hpp"
#include "routing_common/num_mwm_id.hpp"
#include "indexer/index.hpp"
#include <map>
#include <memory>
namespace routing
{
class BicycleDirectionsEngine : public IDirectionsEngine
{
public:
struct AdjacentEdges
{
explicit AdjacentEdges(size_t ingoingTurnsCount = 0) : m_ingoingTurnsCount(ingoingTurnsCount) {}
bool IsAlmostEqual(AdjacentEdges const & rhs) const;
turns::TurnCandidates m_outgoingTurns;
size_t m_ingoingTurnsCount;
};
using AdjacentEdgesMap = std::map<SegmentRange, AdjacentEdges>;
BicycleDirectionsEngine(Index const & index, std::shared_ptr<NumMwmIds> numMwmIds);
// IDirectionsEngine override:
bool Generate(RoadGraphBase const & graph, vector<Junction> const & path,
my::Cancellable const & cancellable, Route::TTurns & turns,
Route::TStreets & streetNames, vector<Junction> & routeGeometry,
vector<Segment> & segments) override;
private:
Index::FeaturesLoaderGuard & GetLoader(MwmSet::MwmId const & id);
void LoadPathAttributes(FeatureID const & featureId, LoadedPathSegment & pathSegment);
void GetSegmentRangeAndAdjacentEdges(IRoadGraph::TEdgeVector const & outgoingEdges,
Edge const & inEdge, uint32_t startSegId, uint32_t endSegId,
SegmentRange & segmentRange,
turns::TurnCandidates & outgoingTurns);
/// \brief The method gathers sequence of segments according to IsJoint() method
/// and fills |m_adjacentEdges| and |m_pathSegments|.
void FillPathSegmentsAndAdjacentEdgesMap(RoadGraphBase const & graph,
std::vector<Junction> const & path,
IRoadGraph::TEdgeVector const & routeEdges,
my::Cancellable const & cancellable);
void GetEdges(RoadGraphBase const & graph, Junction const & currJunction,
bool isCurrJunctionFinish, IRoadGraph::TEdgeVector & outgoing,
IRoadGraph::TEdgeVector & ingoing);
AdjacentEdgesMap m_adjacentEdges;
TUnpackedPathSegments m_pathSegments;
Index const & m_index;
std::shared_ptr<NumMwmIds> m_numMwmIds;
std::unique_ptr<Index::FeaturesLoaderGuard> m_loader;
};
} // namespace routing
|