All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TransportTiledGraphService.h
1 #pragma once
2 
3 #include "Transport.h"
4 #include "ITransportTiledGraphService.h"
5 #include "Types.h"
6 #include "HashHelpers.h"
7 #include "Navigation.h"
8 
9 #include <unordered_map>
10 
11 namespace Eegeo
12 {
13  namespace Transport
14  {
16  {
17  public:
19  ITransportGraphChangedEvent& transportGraphChangedEvent,
20  const std::unordered_map<TransportNetwork::Type, const Eegeo::Graphs::TiledGraph&, Helpers::EnumHash>& tiledGraphs,
21  const std::unordered_map<TransportNetwork::Type, Eegeo::Graphs::TiledGraphPathfinder&, Helpers::EnumHash>& tiledGraphPathfinders,
22  const std::unordered_map<TransportNetwork::Type, const ITransportNodeBuilder&, Helpers::EnumHash>& transportNodeBuilders,
23  const std::unordered_map<TransportNetwork::Type, const ITransportDirectedEdgeBuilder&, Helpers::EnumHash>& transportDirectedEdgeBuilders,
24  const std::unordered_map<TransportNetwork::Type, const ITransportWayBuilder&, Helpers::EnumHash>& transportWayBuilders,
25  const std::unordered_map<TransportNetwork::Type, const Eegeo::Resources::Roads::Navigation::NavigationGraphRepository&, Helpers::EnumHash>& navigationGraphRepositories
26  );
27 
28  ITransportGraphChangedEvent& GetTransportGraphChangedEvent() const override { return m_transportGraphChangedEvent; }
29 
30  const Eegeo::Graphs::TiledGraph& GetTiledGraphForNetwork(TransportNetwork::Type transportNetworkType) const override;
31 
32 
33 
34  TransportPathfindResult FindShortestPath(const TransportPathfindOptions& options) override;
35 
36  bool PathfindResultExists(int pathfindResultId) override;
37 
38  const TransportPathfindResult& GetPathfindResult(int pathfindResultId) override;
39 
40  void ReleasePathfindResult(int pathfindResultId) override;
41 
42  bool NodeExists(const TransportNodeId& nodeId) const override;
43 
44  TransportNode GetNode(const TransportNodeId& nodeId) const override;
45 
46  bool DirectedEdgeExists(const TransportDirectedEdgeId& directedEdgeId) const override;
47 
48  TransportDirectedEdge GetDirectedEdge(const TransportDirectedEdgeId& directedEdgeId) const override;
49 
50  bool WayExists(const TransportWayId& wayId) const override;
51 
52  TransportWay GetWay(const TransportWayId& wayId) const override;
53 
54  std::vector<TransportNodeId> GetNodeIdsForNetwork(TransportNetwork::Type transportNetworkType) const override;
55 
56  std::vector<TransportDirectedEdgeId> GetDirectedEdgeIdsForNetwork(TransportNetwork::Type transportNetworkType) const override;
57 
58  std::vector<TransportWayId> GetWayIdsForNetwork(TransportNetwork::Type transportNetworkType) const override;
59 
60  std::vector<TransportNodeId> GetNodeIdsForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
61 
62  std::vector<TransportDirectedEdgeId> GetDirectedEdgeIdsForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
63 
64  std::vector<TransportWayId> GetWayIdsForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
65 
66  int GetNodeCountForNetwork(TransportNetwork::Type transportNetworkType) const override;
67 
68  int GetDirectedEdgeCountForNetwork(TransportNetwork::Type transportNetworkType) const override;
69 
70  int GetWayCountForNetwork(TransportNetwork::Type transportNetworkType) const override;
71 
72  int GetNodeCountForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
73 
74  int GetDirectedEdgeCountForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
75 
76  int GetWayCountForNetworkInCell(TransportNetwork::Type transportNetworkType, const Eegeo::Streaming::MortonKey& cellKey) const override;
77 
78 
79  private:
80  Graphs::TiledGraphPathfinder& GetTiledGraphPathfinderForNetwork(TransportNetwork::Type transportNetworkType) const;
81 
82  std::vector<Eegeo::dv3> BuildPathPoints(
83  const std::vector<TransportDirectedEdgeId>& pathDirectedEdgeIds,
84  const double firstEdgeParam,
85  const double lastEdgeParam
86  ) const;
87 
88  std::vector<double> BuildPathPointParams(const std::vector<Eegeo::dv3>& pathPoints) const;
89 
90  ITransportGraphChangedEvent& m_transportGraphChangedEvent;
91 
92  std::unordered_map<TransportNetwork::Type, const Eegeo::Graphs::TiledGraph&, Helpers::EnumHash> m_tiledGraphs;
93  std::unordered_map<TransportNetwork::Type, Eegeo::Graphs::TiledGraphPathfinder&, Helpers::EnumHash> m_tiledGraphPathfinders;
94 
95  const std::unordered_map<TransportNetwork::Type, const ITransportNodeBuilder&, Helpers::EnumHash> m_transportNodeBuilders;
96  const std::unordered_map<TransportNetwork::Type, const ITransportDirectedEdgeBuilder&, Helpers::EnumHash> m_transportDirectedEdgeBuilders;
97  const std::unordered_map<TransportNetwork::Type, const ITransportWayBuilder&, Helpers::EnumHash> m_transportWayBuilders;
98  const std::unordered_map<TransportNetwork::Type, const Eegeo::Resources::Roads::Navigation::NavigationGraphRepository&, Helpers::EnumHash> m_navigationGraphRepositories;
99 
100  int m_nextPathfindResultId;
101  std::unordered_map<int, TransportPathfindResult> m_pathfindResultsStore;
102  };
103  }
104 }