Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Jul 19, 2024
1 parent 25d2194 commit 0868126
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
10 changes: 3 additions & 7 deletions exe/backend/src/http_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,10 @@ struct http_server::impl {
handle_routing<car>(req, cb, from, to, max, direction);
break;
case search_profile::kCarParking:
handle_routing<car_parking<false>>(req, cb, from, to,
max, direction);
handle_routing<car_parking<false>>(req, cb, from, to, max, direction);
break;
case search_profile::kCarParkingWheelchair:
handle_routing<car_parking<true>>(req, cb, from, to,
max, direction);
handle_routing<car_parking<true>>(req, cb, from, to, max, direction);
break;
default: throw utl::fail("not implemented");
}
Expand Down Expand Up @@ -227,9 +225,7 @@ struct http_server::impl {
{waypoints[3].as_double(), waypoints[2].as_double()});

auto gj = geojson_writer{.w_ = w_};
l_.find(min, max, [&](way_idx_t const w) {
gj.write_way(w);
});
l_.find(min, max, [&](way_idx_t const w) { gj.write_way(w); });

switch (profile) {
case search_profile::kFoot:
Expand Down
20 changes: 13 additions & 7 deletions include/osr/routing/profiles/car_parking.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ struct car_parking {
return out << "(node=" << w.node_to_osm_[n_]
<< ", level=" << to_float(lvl_) << ", dir=" << to_str(dir_)
<< ", way=" << w.way_osm_idx_[w.r_->node_ways_[n_][way_]]
<< ", type=" << node_type_to_str(type_)
<< ")";
<< ", type=" << node_type_to_str(type_) << ")";
}

static constexpr node invalid() noexcept { return node{}; }
Expand Down Expand Up @@ -207,7 +206,8 @@ struct car_parking {
node_idx_t const n,
level_t const lvl,
Fn&& f) {
foot::resolve_all(w, n, lvl, [&](foot::node const neighbor) { f(to_node(neighbor)); });
foot::resolve_all(w, n, lvl,
[&](foot::node const neighbor) { f(to_node(neighbor)); });
car::resolve_all(w, n, lvl, [&](car::node const neighbor) {
auto const p = w.way_properties_[w.node_ways_[n][neighbor.way_]];
auto const node_level = lvl == level_t::invalid() ? p.from_level() : lvl;
Expand Down Expand Up @@ -241,9 +241,12 @@ struct car_parking {
distance_t const dist, way_idx_t const way,
std::uint16_t const from, std::uint16_t const to) {
auto const way_prop = w.way_properties_[way];
auto const target_level = way_prop.from_level() == n.lvl_ ? way_prop.to_level() : way_prop.from_level();
fn(to_node(neighbor, target_level), cost + (n.is_car_node() ? 0 : kSwitchPenalty),
dist, way, from, to);
auto const target_level = way_prop.from_level() == n.lvl_
? way_prop.to_level()
: way_prop.from_level();
fn(to_node(neighbor, target_level),
cost + (n.is_car_node() ? 0 : kSwitchPenalty), dist, way, from,
to);
});
}
}
Expand All @@ -259,7 +262,10 @@ struct car_parking {
search_dir == direction::kForward
? car::resolve_start_node(w, way, n, lvl, search_dir,
[&](car::node const n) {
auto const node_level = lvl == level_t::invalid() ? way_properties.from_level() : lvl;
auto const node_level =
lvl == level_t::invalid()
? way_properties.from_level()
: lvl;
f(to_node(n, node_level));
})
: foot::resolve_start_node(w, way, n, lvl, search_dir,
Expand Down
14 changes: 8 additions & 6 deletions include/osr/routing/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,10 @@ std::optional<path> route(ways const& w,
for (auto const& start : from_match) {
for (auto const* nc : {&start.left_, &start.right_}) {
if (nc->valid() && nc->cost_ < max) {
Profile::resolve_start_node(
*w.r_, start.way_, nc->node_, from.lvl_, dir,
[&](auto const node) { d.add_start({node, nc->cost_}); });
Profile::resolve_start_node(*w.r_, start.way_, nc->node_, from.lvl_,
dir, [&](auto const node) {
d.add_start({node, nc->cost_});
});
}
}

Expand Down Expand Up @@ -340,9 +341,10 @@ std::vector<std::optional<path>> route(ways const& w,
for (auto const& start : from_match) {
for (auto const* nc : {&start.left_, &start.right_}) {
if (nc->valid() && nc->cost_ < max) {
Profile::resolve_start_node(
*w.r_, start.way_, nc->node_, from.lvl_, dir,
[&](auto const node) { d.add_start({node, nc->cost_}); });
Profile::resolve_start_node(*w.r_, start.way_, nc->node_, from.lvl_,
dir, [&](auto const node) {
d.add_start({node, nc->cost_});
});
}
}

Expand Down

0 comments on commit 0868126

Please sign in to comment.