From a5d95afb96eb9a3b65d82f5f84bf8e4a4fb4c8ac Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 21:12:55 +0200 Subject: clang-format C++ sources --- server/src/geo.cppm | 63 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 27 deletions(-) (limited to 'server/src/geo.cppm') diff --git a/server/src/geo.cppm b/server/src/geo.cppm index 5cdbdd9..b599ad4 100644 --- a/server/src/geo.cppm +++ b/server/src/geo.cppm @@ -8,33 +8,42 @@ export namespace bgeo = boost::geometry; export namespace routemon::geo { - using point = bgeo::model::point>; - using linestring = bgeo::model::linestring; - using box = bgeo::model::box; - using stype = bgeo::srs::spheroid; - using vincenty_strategy = bgeo::strategy::distance::vincenty; - - auto split_linestring_with_overlap_segments(linestring const& ls, double max_split_distance_m, std::vector& append_to) -> void { - if (bgeo::is_empty(ls)) - return; - - auto current_ls = linestring{}; - auto current_ls_length = 0.0; - auto previous = std::optional{}; - bgeo::for_each_point(ls, [&](point p) -> void { - bgeo::append(current_ls, p); - if (previous) { - auto d = bgeo::distance(*previous, p, vincenty_strategy()); - current_ls_length += d; - if (current_ls_length > max_split_distance_m) { - append_to.push_back(std::move(current_ls)); - current_ls = linestring{*previous, p}; - current_ls_length = d; +using point = + bgeo::model::point>; +using linestring = bgeo::model::linestring; +using box = bgeo::model::box; +using stype = bgeo::srs::spheroid; +using vincenty_strategy = bgeo::strategy::distance::vincenty; + +auto split_linestring_with_overlap_segments( + linestring const& ls, double max_split_distance_m, + std::vector& append_to) -> void +{ + if (bgeo::is_empty(ls)) + return; + + auto current_ls = linestring{}; + auto current_ls_length = 0.0; + auto previous = std::optional{}; + bgeo::for_each_point( + ls, + [&](point p) -> void + { + bgeo::append(current_ls, p); + if (previous) + { + auto d = bgeo::distance(*previous, p, vincenty_strategy()); + current_ls_length += d; + if (current_ls_length > max_split_distance_m) + { + append_to.push_back(std::move(current_ls)); + current_ls = linestring{*previous, p}; + current_ls_length = d; + } } - } - previous = p; - }); - append_to.emplace_back(std::move(current_ls)); - } + previous = p; + }); + append_to.emplace_back(std::move(current_ls)); +} } // namespace routemon::geo -- cgit v1.3