Pass edge-based node segregated flag to the post processing routine.

This commit is contained in:
vng
2017-10-19 13:56:47 +00:00
committed by Michael Krasnyk
parent ac5e095d17
commit ec7e58e10e
9 changed files with 89 additions and 8 deletions
+1
View File
@@ -177,6 +177,7 @@ class RouteAPI : public BaseAPI
leg.steps = guidance::anticipateLaneChange(std::move(leg.steps));
leg.steps = guidance::buildIntersections(std::move(leg.steps));
leg.steps = guidance::suppressShortNameSegments(std::move(leg.steps));
leg.steps = guidance::suppressSegregated(std::move(leg.steps));
leg.steps = guidance::assignRelativeLocations(std::move(leg.steps),
leg_geometry,
phantoms.source_phantom,
@@ -56,6 +56,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const auto source_node_id = source_traversed_in_reverse ? source_node.reverse_segment_id.id
: source_node.forward_segment_id.id;
const auto source_name_id = facade.GetNameIndex(source_node_id);
bool is_segregated = facade.IsSegregated(source_node_id);
const auto source_mode = facade.GetTravelMode(source_node_id);
auto source_classes = facade.GetClasses(facade.GetClassData(source_node_id));
@@ -127,6 +128,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
intersection.classes = facade.GetClasses(path_point.classes);
steps.push_back(RouteStep{step_name_id,
is_segregated,
name.to_string(),
ref.to_string(),
pronunciation.to_string(),
@@ -147,10 +149,12 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
if (leg_data_index + 1 < leg_data.size())
{
step_name_id = leg_data[leg_data_index + 1].name_id;
is_segregated = leg_data[leg_data_index + 1].is_segregated;
}
else
{
step_name_id = facade.GetNameIndex(target_node_id);
is_segregated = facade.IsSegregated(target_node_id);
}
// extract bearings
@@ -206,6 +210,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
intersection.classes = facade.GetClasses(facade.GetClassData(target_node_id));
BOOST_ASSERT(duration >= 0);
steps.push_back(RouteStep{step_name_id,
is_segregated,
facade.GetNameForID(step_name_id).to_string(),
facade.GetRefForID(step_name_id).to_string(),
facade.GetPronunciationForID(step_name_id).to_string(),
@@ -249,6 +254,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const EdgeWeight duration = std::max(0, target_duration - source_duration);
steps.push_back(RouteStep{source_name_id,
is_segregated,
facade.GetNameForID(source_name_id).to_string(),
facade.GetRefForID(source_name_id).to_string(),
facade.GetPronunciationForID(source_name_id).to_string(),
@@ -290,6 +296,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
BOOST_ASSERT(!leg_geometry.locations.empty());
steps.push_back(RouteStep{target_name_id,
facade.IsSegregated(target_node_id),
facade.GetNameForID(target_name_id).to_string(),
facade.GetRefForID(target_name_id).to_string(),
facade.GetPronunciationForID(target_name_id).to_string(),
@@ -140,6 +140,8 @@ void combineRouteSteps(RouteStep &step_at_turn_location,
// alias for suppressing a step, using CombineRouteStep with NoModificationStrategy only
void suppressStep(RouteStep &step_at_turn_location, RouteStep &step_after_turn_location);
std::vector<RouteStep> suppressSegregated(std::vector<RouteStep> steps);
} /* namespace guidance */
} /* namespace osrm */
} /* namespace osrm */
+3
View File
@@ -60,6 +60,7 @@ inline IntermediateIntersection getInvalidIntersection()
struct RouteStep
{
unsigned name_id;
bool is_segregated;
std::string name;
std::string ref;
std::string pronunciation;
@@ -164,6 +165,8 @@ inline RouteStep &RouteStep::ElongateBy(const RouteStep &following_step)
following_step.intersections.begin(),
following_step.intersections.end());
is_segregated = false;
return *this;
}
+2
View File
@@ -27,6 +27,8 @@ struct PathData
NodeID turn_via_node;
// name of the street that leads to the turn
unsigned name_id;
// segregated edge-based node that leads to the turn
bool is_segregated;
// weight that is traveled on the segment until the turn is reached
// including the turn weight, if one exists
EdgeWeight weight_until_turn;
@@ -164,6 +164,9 @@ void annotatePath(const FacadeT &facade,
const auto turn_id = edge_data.turn_id; // edge-based graph edge index
const auto node_id = *node_from; // edge-based graph node index
const auto name_index = facade.GetNameIndex(node_id);
const bool is_segregated = facade.IsSegregated(node_id);
if (is_segregated)
util::Log() << "111 Segregated node";
const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id);
const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id);
const auto classes = facade.GetClassData(node_id);
@@ -193,6 +196,7 @@ void annotatePath(const FacadeT &facade,
{
unpacked_path.push_back(PathData{id_vector[segment_idx + 1],
name_index,
is_segregated,
weight_vector[segment_idx],
0,
duration_vector[segment_idx],
@@ -266,6 +270,7 @@ void annotatePath(const FacadeT &facade,
unpacked_path.push_back(
PathData{id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1],
facade.GetNameIndex(target_node_id),
facade.IsSegregated(target_node_id),
weight_vector[segment_idx],
0,
duration_vector[segment_idx],