Skip to content

Commit

Permalink
Revert unstable commits on 'origin/master'
Browse files Browse the repository at this point in the history
This reverts commit 797230e.
  • Loading branch information
MichaelKutzner committed Dec 19, 2024
1 parent e0150ad commit e70ef4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 55 deletions.
32 changes: 1 addition & 31 deletions include/osr/lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<way_candidate>{};
find(geo::box{query.pos_, max_match_distance}, [&](way_idx_t const way) {
auto d = geo::distance_to_polyline<way_candidate>(
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 <typename Profile>
match_t complete_match(match_t match,
bool reverse,
direction const search_dir,
bitvec<node_idx_t>& blocked) {
for (auto& wc : match) {
wc.left_ =
find_next_node<Profile>(wc, wc.query_, direction::kBackward,
wc.query_.lvl_, reverse, search_dir, blocked);
wc.right_ =
find_next_node<Profile>(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,
Expand Down Expand Up @@ -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<Profile>(wc, query, direction::kBackward, query.lvl_,
Expand Down
14 changes: 1 addition & 13 deletions include/osr/routing/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,7 @@ struct path {
template <typename Profile>
dijkstra<Profile>& get_dijkstra();

struct one_to_many_result {
one_to_many_result(std::chrono::milliseconds&& lookup_time,
std::vector<std::optional<path>>&& paths)
: lookup_time_{lookup_time}, paths_{std::move(paths)} {}

one_to_many_result(std::vector<std::optional<path>>&& paths)
: paths_{std::move(paths)} {}

std::chrono::milliseconds lookup_time_{};
std::vector<std::optional<path>> paths_;
};

one_to_many_result route(
std::vector<std::optional<path>> route(
ways const&,
lookup const&,
search_profile,
Expand Down
16 changes: 5 additions & 11 deletions src/route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -407,7 +406,7 @@ std::vector<std::optional<path>> route(
return result;
}

one_to_many_result route(
std::vector<std::optional<path>> route(
ways const& w,
lookup const& l,
search_profile const profile,
Expand All @@ -420,9 +419,8 @@ one_to_many_result route(
sharing_data const* sharing,
elevation_storage const* elevations,
std::function<bool(path const&)> const& do_reconstruct) {
auto const r =
[&]<typename Profile>(dijkstra<Profile>& d) -> one_to_many_result {
UTL_START_TIMING(lookup);
auto const r = [&]<typename Profile>(
dijkstra<Profile>& d) -> std::vector<std::optional<path>> {
auto const from_match =
l.match<Profile>(from, false, dir, max_match_distance, blocked);
if (from_match.empty()) {
Expand All @@ -431,12 +429,8 @@ one_to_many_result route(
auto const to_match = utl::to_vec(to, [&](auto&& x) {
return l.match<Profile>(x, true, dir, max_match_distance, blocked);
});
UTL_STOP_TIMING(lookup);
return one_to_many_result{
std::chrono::duration_cast<std::chrono::milliseconds>(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) {
Expand Down

0 comments on commit e70ef4c

Please sign in to comment.