Skip to content

Commit

Permalink
Move legs costs logic to HttpWrapper parent class.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoupey committed Jul 15, 2024
1 parent dc631cb commit 84db49b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/routing/http_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,14 @@ Matrices HttpWrapper::get_sparse_matrices(const std::string& profile,
parse_response(json_result, json_string);
this->check_response(json_result, route_locs, _route_service);

const auto [durations, distances] = get_legs_info(json_result);
assert(durations.size() == route_locs.size() - 1);
assert(durations.size() == distances.size());
const auto& legs = get_legs(json_result);
assert(legs.Size() == route_locs.size() - 1);

for (std::size_t i = 0; i < durations.size(); ++i) {
for (rapidjson::SizeType i = 0; i < legs.Size(); ++i) {
m.durations[route_locs[i].index()][route_locs[i + 1].index()] =
durations[i];
get_leg_duration(legs[i]);
m.distances[route_locs[i].index()][route_locs[i + 1].index()] =
distances[i];
get_leg_distance(legs[i]);
}

// TODO get geometry and store it.
Expand Down

0 comments on commit 84db49b

Please sign in to comment.