summaryrefslogtreecommitdiffstats
path: root/server/src/geo.cppm
diff options
context:
space:
mode:
authorRutger Broekhoff2026-08-28 22:22:24 +0200
committerRutger Broekhoff2026-08-28 22:22:24 +0200
commitb0d7600970d2fdb1eb6fff813c7336ea34d4e228 (patch)
tree051d6f80c7e332f4b31027025ae7c60c7ac70742 /server/src/geo.cppm
parent70643a9e4821bd11c3f363f1708fe420965467d1 (diff)
downloadroutemon-b0d7600970d2fdb1eb6fff813c7336ea34d4e228.tar.gz
routemon-b0d7600970d2fdb1eb6fff813c7336ea34d4e228.zip
Indent tweaks
Diffstat (limited to 'server/src/geo.cppm')
-rw-r--r--server/src/geo.cppm34
1 files changed, 17 insertions, 17 deletions
diff --git a/server/src/geo.cppm b/server/src/geo.cppm
index 9101af8..b599ad4 100644
--- a/server/src/geo.cppm
+++ b/server/src/geo.cppm
@@ -9,15 +9,15 @@ export namespace bgeo = boost::geometry;
9export namespace routemon::geo { 9export namespace routemon::geo {
10 10
11using point = 11using point =
12 bgeo::model::point<double, 2, bgeo::cs::spherical_equatorial<bgeo::degree>>; 12 bgeo::model::point<double, 2, bgeo::cs::spherical_equatorial<bgeo::degree>>;
13using linestring = bgeo::model::linestring<point>; 13using linestring = bgeo::model::linestring<point>;
14using box = bgeo::model::box<point>; 14using box = bgeo::model::box<point>;
15using stype = bgeo::srs::spheroid<double>; 15using stype = bgeo::srs::spheroid<double>;
16using vincenty_strategy = bgeo::strategy::distance::vincenty<stype>; 16using vincenty_strategy = bgeo::strategy::distance::vincenty<stype>;
17 17
18auto split_linestring_with_overlap_segments( 18auto split_linestring_with_overlap_segments(
19 linestring const& ls, double max_split_distance_m, 19 linestring const& ls, double max_split_distance_m,
20 std::vector<linestring>& append_to) -> void 20 std::vector<linestring>& append_to) -> void
21{ 21{
22 if (bgeo::is_empty(ls)) 22 if (bgeo::is_empty(ls))
23 return; 23 return;
@@ -26,23 +26,23 @@ auto split_linestring_with_overlap_segments(
26 auto current_ls_length = 0.0; 26 auto current_ls_length = 0.0;
27 auto previous = std::optional<point>{}; 27 auto previous = std::optional<point>{};
28 bgeo::for_each_point( 28 bgeo::for_each_point(
29 ls, 29 ls,
30 [&](point p) -> void 30 [&](point p) -> void
31 {
32 bgeo::append(current_ls, p);
33 if (previous)
34 { 31 {
35 auto d = bgeo::distance(*previous, p, vincenty_strategy()); 32 bgeo::append(current_ls, p);
36 current_ls_length += d; 33 if (previous)
37 if (current_ls_length > max_split_distance_m)
38 { 34 {
39 append_to.push_back(std::move(current_ls)); 35 auto d = bgeo::distance(*previous, p, vincenty_strategy());
40 current_ls = linestring{*previous, p}; 36 current_ls_length += d;
41 current_ls_length = d; 37 if (current_ls_length > max_split_distance_m)
38 {
39 append_to.push_back(std::move(current_ls));
40 current_ls = linestring{*previous, p};
41 current_ls_length = d;
42 }
42 } 43 }
43 } 44 previous = p;
44 previous = p; 45 });
45 });
46 append_to.emplace_back(std::move(current_ls)); 46 append_to.emplace_back(std::move(current_ls));
47} 47}
48 48