All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TransportDirectedEdgeId.h
1 #pragma once
2 
3 #include "Transport.h"
4 #include "TiledGraphNode.h"
5 #include "TiledGraphEdge.h"
6 #include "TransportWay.h"
7 #include "TransportNode.h"
8 
9 #include <vector>
10 
11 namespace Eegeo
12 {
13  namespace Transport
14  {
16  {
18  : CellKey(Streaming::MortonKey(0))
19  , LocalDirectedEdgeId(-1)
20  , TransportNetworkType(TransportNetwork::TransportRoad)
21  {}
22 
24  TransportNetwork::Type transportNetworkType,
25  const Streaming::MortonKey& cellKey,
26  TransportLocalDirectedEdgeId localDirectedEdgeId
27  )
28  : CellKey(cellKey)
29  , LocalDirectedEdgeId(localDirectedEdgeId)
30  , TransportNetworkType(transportNetworkType)
31  {}
32 
34  TransportNetwork::Type transportNetworkType,
35  const Graphs::TiledGraphEdgeId& graphEdgeId
36  )
37  : CellKey(graphEdgeId.CellKey)
38  , LocalDirectedEdgeId(graphEdgeId.LocalEdgeId)
39  , TransportNetworkType(transportNetworkType)
40  {}
41 
42  Streaming::MortonKey CellKey;
43  TransportLocalDirectedEdgeId LocalDirectedEdgeId;
44  TransportNetwork::Type TransportNetworkType;
45  };
46 
47  inline bool operator == (const TransportDirectedEdgeId& lhs, const TransportDirectedEdgeId& rhs)
48  {
49  return (lhs.LocalDirectedEdgeId == rhs.LocalDirectedEdgeId) &&
50  (lhs.CellKey == rhs.CellKey) &&
51  (lhs.TransportNetworkType == rhs.TransportNetworkType);
52  }
53 
54 
56  {
57  std::size_t operator()(const TransportDirectedEdgeId& edgeId) const
58  {
59  std::size_t h1 = Eegeo::Streaming::MortonKeyHash{}(edgeId.CellKey);
60  std::size_t h2 = std::hash<int>{}(edgeId.LocalDirectedEdgeId);
61  std::size_t h3 = std::hash<int>{}(edgeId.TransportNetworkType);
62  return (h1 ^ (h2 << 1)) ^ (h3 << 1);
63  }
64  };
65  }
66 }