blob: d19a728e35b32e459ba929c4915285b80e9d9420 (
plain)
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
|
#pragma once
#include "generator/osm_element.hpp"
#include "coding/file_writer.hpp"
#include "coding/read_write_utils.hpp"
#include "coding/reader.hpp"
#include "geometry/latlon.hpp"
#include <vector>
namespace generator
{
struct MiniRoundaboutInfo
{
MiniRoundaboutInfo() = default;
explicit MiniRoundaboutInfo(OsmElement const & element);
MiniRoundaboutInfo(uint64_t id, ms::LatLon const & coord, std::vector<uint64_t> && ways);
uint64_t m_id = 0;
ms::LatLon m_coord;
std::vector<uint64_t> m_ways;
};
std::vector<MiniRoundaboutInfo> ReadMiniRoundabouts(std::string const & filePath);
template <typename Src>
MiniRoundaboutInfo ReadMiniRoundabout(Src & src)
{
MiniRoundaboutInfo rb;
rb.m_id = ReadPrimitiveFromSource<uint64_t>(src);
rb.m_coord.m_lat = ReadPrimitiveFromSource<double>(src);
rb.m_coord.m_lon = ReadPrimitiveFromSource<double>(src);
rw::ReadVectorOfPOD(src, rb.m_ways);
return rb;
}
template <typename Dst>
void WriteMiniRoundabout(Dst & dst, MiniRoundaboutInfo const & rb)
{
if (rb.m_ways.empty())
return;
dst.Write(&rb.m_id, sizeof(rb.m_id));
dst.Write(&rb.m_coord.m_lat, sizeof(rb.m_coord.m_lat));
dst.Write(&rb.m_coord.m_lon, sizeof(rb.m_coord.m_lon));
rw::WriteVectorOfPOD(dst, rb.m_ways);
}
} // namespace generator
|