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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
module;
#include <boost/geometry.hpp>
#include <boost/json.hpp>
export module routemon:api;
import std;
import :datex2;
import :geo;
import :gpx;
import :log;
import :time;
import :trace;
namespace {
namespace chrono = std::chrono;
namespace json = boost::json;
namespace views = std::views;
} // namespace <anonymous>
export
namespace routemon::api {
struct relevant_road_closure {
std::vector<geo::linestring> relevant_lss;
};
auto tag_invoke(json::value_from_tag, json::value& jv, relevant_road_closure const& clo) -> void;
struct relevant_situation {
std::string id;
std::optional<geo::point> location;
std::vector<std::string> comments;
std::vector<relevant_road_closure> relevant_road_closures;
};
auto tag_invoke(json::value_from_tag, json::value& jv, relevant_situation const& sit) -> void;
struct track_segment {
geo::linestring points;
};
auto tag_invoke(json::value_from_tag, json::value& jv, track_segment const& seg) -> void;
struct track {
std::vector<track_segment> segments;
};
auto tag_invoke(json::value_from_tag, json::value& jv, track const& track) -> void;
struct process_gpx_result {
std::vector<track> tracks;
std::vector<relevant_situation> relevant_situations;
};
auto tag_invoke(json::value_from_tag, json::value& jv, process_gpx_result const& res) -> void;
struct sysinfo {
time::timestamp using_publication_of;
};
auto tag_invoke(json::value_from_tag, json::value& jv, sysinfo const& info) -> void;
class handler {
using lse_index_value = std::tuple<geo::box, std::shared_ptr<geo::linestring>, std::shared_ptr<datex2::road_closure>>;
using p_index_value = std::pair<geo::point, std::shared_ptr<datex2::road_closure>>;
using lse_index = bgeo::index::rtree<lse_index_value, bgeo::index::quadratic<16>>;
using p_index = bgeo::index::rtree<p_index_value, bgeo::index::quadratic<16>>;
log::logger l_;
datex2::situation_publication pub_;
lse_index lse_index_;
p_index p_index_;
public:
explicit handler(log::logger const& l, datex2::situation_publication pub);
auto process_gpx(gpx::file&& gpx_file) -> std::optional<process_gpx_result>;
auto sysinfo() -> sysinfo;
};
} // namespace routemon::api
|