From e70ef4c7ae6e28a47b2d7dca353c8c9fffbae14b Mon Sep 17 00:00:00 2001 From: Michael Kutzner <174690291+MichaelKutzner@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:51:46 +0100 Subject: [PATCH] Revert unstable commits on 'origin/master' This reverts commit 797230efdb2fa40f2444c20e048bdbe24f67bbb2. --- include/osr/lookup.h | 32 +------------------------------- include/osr/routing/route.h | 14 +------------- src/route.cc | 16 +++++----------- 3 files changed, 7 insertions(+), 55 deletions(-) diff --git a/include/osr/lookup.h b/include/osr/lookup.h index 9773188..a3fc2cb 100644 --- a/include/osr/lookup.h +++ b/include/osr/lookup.h @@ -77,37 +77,6 @@ struct lookup { return cista::mmap{(p_ / file).generic_string().c_str(), mode_}; } - match_t get_raw_match(location const& query, - double const max_match_distance) { - auto way_candidates = std::vector{}; - find(geo::box{query.pos_, max_match_distance}, [&](way_idx_t const way) { - auto d = geo::distance_to_polyline( - query.pos_, ways_.way_polylines_[way]); - if (d.dist_to_way_ < max_match_distance) { - d.way_ = way; - way_candidates.emplace_back(d); - } - }); - utl::sort(way_candidates); - return way_candidates; - } - - template - match_t complete_match(match_t match, - bool reverse, - direction const search_dir, - bitvec& blocked) { - for (auto& wc : match) { - wc.left_ = - find_next_node(wc, wc.query_, direction::kBackward, - wc.query_.lvl_, reverse, search_dir, blocked); - wc.right_ = - find_next_node(wc, wc.query_, direction::kForward, - wc.query_.lvl_, reverse, search_dir, blocked); - } - return match; - } - match_t match(location const& query, bool const reverse, direction const search_dir, @@ -159,6 +128,7 @@ struct lookup { query.pos_, ways_.way_polylines_[way]); if (d.dist_to_way_ < max_match_distance) { auto& wc = way_candidates.emplace_back(std::move(d)); + wc.query_ = query; wc.way_ = way; wc.left_ = find_next_node(wc, query, direction::kBackward, query.lvl_, diff --git a/include/osr/routing/route.h b/include/osr/routing/route.h index 45258b9..9e50536 100644 --- a/include/osr/routing/route.h +++ b/include/osr/routing/route.h @@ -45,19 +45,7 @@ struct path { template dijkstra& get_dijkstra(); -struct one_to_many_result { - one_to_many_result(std::chrono::milliseconds&& lookup_time, - std::vector>&& paths) - : lookup_time_{lookup_time}, paths_{std::move(paths)} {} - - one_to_many_result(std::vector>&& paths) - : paths_{std::move(paths)} {} - - std::chrono::milliseconds lookup_time_{}; - std::vector> paths_; -}; - -one_to_many_result route( +std::vector> route( ways const&, lookup const&, search_profile, diff --git a/src/route.cc b/src/route.cc index 255c8cc..3d0bffe 100644 --- a/src/route.cc +++ b/src/route.cc @@ -6,7 +6,6 @@ #include "boost/thread/tss.hpp" #include "utl/concat.h" -#include "utl/timing.h" #include "utl/to_vec.h" #include "utl/verify.h" @@ -407,7 +406,7 @@ std::vector> route( return result; } -one_to_many_result route( +std::vector> route( ways const& w, lookup const& l, search_profile const profile, @@ -420,9 +419,8 @@ one_to_many_result route( sharing_data const* sharing, elevation_storage const* elevations, std::function const& do_reconstruct) { - auto const r = - [&](dijkstra& d) -> one_to_many_result { - UTL_START_TIMING(lookup); + auto const r = [&]( + dijkstra& d) -> std::vector> { auto const from_match = l.match(from, false, dir, max_match_distance, blocked); if (from_match.empty()) { @@ -431,12 +429,8 @@ one_to_many_result route( auto const to_match = utl::to_vec(to, [&](auto&& x) { return l.match(x, true, dir, max_match_distance, blocked); }); - UTL_STOP_TIMING(lookup); - return one_to_many_result{ - std::chrono::duration_cast(lookup_stop - - lookup_start), - route(w, d, from, to, from_match, to_match, max, dir, blocked, sharing, - elevations, do_reconstruct)}; + return route(w, d, from, to, from_match, to_match, max, dir, blocked, + sharing, elevations, do_reconstruct); }; switch (profile) {