diff --git a/include/ppr/routing/directed_edge.h b/include/ppr/routing/directed_edge.h index 23a7b35..8fab40f 100644 --- a/include/ppr/routing/directed_edge.h +++ b/include/ppr/routing/directed_edge.h @@ -2,6 +2,7 @@ #include +#include "ppr/common/enums.h" #include "ppr/common/routing_graph.h" #include "ppr/routing/costs.h" @@ -44,6 +45,18 @@ struct directed_edge { } } + side_type side() const { + if (fwd_) { + return edge_->side_; + } else { + switch (edge_->side_) { + case side_type::LEFT: return side_type::RIGHT; + case side_type::RIGHT: return side_type::LEFT; + default: return edge_->side_; + } + } + } + std::uint16_t level() const { return edge_info_->level_; } bool in_area() const { return edge_info_->area_; } diff --git a/include/ppr/routing/labels_to_route.h b/include/ppr/routing/labels_to_route.h index d3a0070..c295bac 100644 --- a/include/ppr/routing/labels_to_route.h +++ b/include/ppr/routing/labels_to_route.h @@ -34,7 +34,8 @@ route::edge to_route_edge(Label const* label, routing_graph_data const& rg) { .stroller_ = ei->stroller_, .step_count_ = ei->step_count_, .marked_crossing_detour_ = ei->marked_crossing_detour_, - .side_ = e->side_, + .side_ = de.side(), + .graph_side_ = e->side_, .elevation_up_ = de.elevation_up(), .elevation_down_ = de.elevation_down(), .level_ = ei->level_, diff --git a/include/ppr/routing/route.h b/include/ppr/routing/route.h index 6db8d79..8058d61 100644 --- a/include/ppr/routing/route.h +++ b/include/ppr/routing/route.h @@ -35,6 +35,7 @@ struct route { std::uint8_t step_count_{0}; std::int32_t marked_crossing_detour_{0}; side_type side_{side_type::CENTER}; + side_type graph_side_{side_type::CENTER}; elevation_diff_t elevation_up_{0}; elevation_diff_t elevation_down_{0}; std::int16_t level_{}; diff --git a/src/backend/output/route_response.cc b/src/backend/output/route_response.cc index c567775..7f2f684 100644 --- a/src/backend/output/route_response.cc +++ b/src/backend/output/route_response.cc @@ -133,6 +133,9 @@ void write_edge(Writer& writer, route::edge const& e) { writer.String("side"); writer.String(side_type_str(e.side_)); + writer.String("graph_side"); + writer.String(side_type_str(e.graph_side_)); + writer.String("osm_way_id"); writer.Int64(e.osm_way_id_);