Skip to content

Commit

Permalink
street side + graph side in output
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohoch committed Jan 9, 2024
1 parent a8c63de commit 7b13fd3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions include/ppr/routing/directed_edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <optional>

#include "ppr/common/enums.h"
#include "ppr/common/routing_graph.h"
#include "ppr/routing/costs.h"

Expand Down Expand Up @@ -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_; }
Expand Down
3 changes: 2 additions & 1 deletion include/ppr/routing/labels_to_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down
1 change: 1 addition & 0 deletions include/ppr/routing/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_{};
Expand Down
3 changes: 3 additions & 0 deletions src/backend/output/route_response.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_);

Expand Down

0 comments on commit 7b13fd3

Please sign in to comment.