All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TransportWayId.h
1 #pragma once
2 
3 #include "Transport.h"
4 #include "Graphs.h"
5 #include "MortonKey.h"
6 
7 namespace Eegeo
8 {
9  namespace Transport
10  {
12  {
14  : CellKey(Streaming::MortonKey(0))
15  , LocalWayId(-1)
16  , TransportNetworkType(TransportNetwork::TransportRoad)
17  {}
18 
20  TransportNetwork::Type transportNetworkType,
21  const Streaming::MortonKey& cellKey,
22  Graphs::TiledGraphEdgeAttributesId localAttributesId
23  )
24  : CellKey(cellKey)
25  , LocalWayId(localAttributesId)
26  , TransportNetworkType(transportNetworkType)
27  {}
28 
29  Streaming::MortonKey CellKey;
30  Graphs::TiledGraphEdgeAttributesId LocalWayId;
31  TransportNetwork::Type TransportNetworkType;
32  };
33 
34  inline bool operator == (const TransportWayId& lhs, const TransportWayId& rhs)
35  {
36  return (lhs.LocalWayId == rhs.LocalWayId) &&
37  (lhs.CellKey == rhs.CellKey) &&
38  (lhs.TransportNetworkType == rhs.TransportNetworkType);
39  }
40 
41 
43  {
44  std::size_t operator()(const TransportWayId& wayId) const
45  {
46  std::size_t h1 = Eegeo::Streaming::MortonKeyHash{}(wayId.CellKey);
47  std::size_t h2 = std::hash<int>{}(wayId.LocalWayId);
48  std::size_t h3 = std::hash<int>{}(wayId.TransportNetworkType);
49  return (h1 ^ (h2 << 1)) ^ (h3 << 1);
50  }
51  };
52  }
53 }