From 70643a9e4821bd11c3f363f1708fe420965467d1 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 22:17:10 +0200 Subject: Format again --- server/src/geo.cppm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'server/src/geo.cppm') diff --git a/server/src/geo.cppm b/server/src/geo.cppm index b599ad4..9101af8 100644 --- a/server/src/geo.cppm +++ b/server/src/geo.cppm @@ -9,15 +9,15 @@ export namespace bgeo = boost::geometry; export namespace routemon::geo { using point = - bgeo::model::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 + linestring const& ls, double max_split_distance_m, + std::vector& append_to) -> void { if (bgeo::is_empty(ls)) return; @@ -26,23 +26,23 @@ auto split_linestring_with_overlap_segments( auto current_ls_length = 0.0; auto previous = std::optional{}; bgeo::for_each_point( - ls, - [&](point p) -> void + ls, + [&](point p) -> void + { + bgeo::append(current_ls, p); + if (previous) { - 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) { - 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; - } + append_to.push_back(std::move(current_ls)); + current_ls = linestring{*previous, p}; + current_ls_length = d; } - previous = p; - }); + } + previous = p; + }); append_to.emplace_back(std::move(current_ls)); } -- cgit v1.3