namespace OsmXmlToRegionConverter; public class Edge { public ulong wayId { get; } public ulong neighborId { get; } public ulong neighborRegion { get; } public Edge(ulong wayId, ulong neighborId, ulong neighborRegion) { this.wayId = wayId; this.neighborId = neighborId; this.neighborRegion = neighborRegion; } public Edge(ulong wayId, Node neighborNode) { this.wayId = wayId; this.neighborId = neighborNode.id; this.neighborRegion = Coordinates.GetRegionHashCode(neighborNode.coordinates); } public const int ByteSize = sizeof(ulong) * 3; public static Edge FromBytes(byte[] bytes) { using (MemoryStream m = new MemoryStream(bytes)) { using (BinaryReader r = new BinaryReader(m)) { ulong wayId = r.ReadUInt64(); ulong neighborId = r.ReadUInt64(); ulong neighborRegion = r.ReadUInt64(); return new Edge(wayId, neighborId, neighborRegion); } } } }