adjust testscases for collapse of use lane
This commit is contained in:
@@ -68,8 +68,8 @@ inline bool hasValidLanes(const guidance::Intersection &intersection)
|
||||
|
||||
std::string instructionTypeToString(const TurnType::Enum type)
|
||||
{
|
||||
static_assert(sizeof(turn_type_names)/sizeof(turn_type_names[0]) >= TurnType::MaxTurnType,
|
||||
"Some turn types has not string representation.");
|
||||
static_assert(sizeof(turn_type_names) / sizeof(turn_type_names[0]) >= TurnType::MaxTurnType,
|
||||
"Some turn types has not string representation.");
|
||||
return turn_type_names[static_cast<std::size_t>(type)];
|
||||
}
|
||||
|
||||
@@ -99,15 +99,17 @@ util::json::Array lanesFromIntersection(const guidance::Intersection &intersecti
|
||||
|
||||
std::string instructionModifierToString(const DirectionModifier::Enum modifier)
|
||||
{
|
||||
static_assert(sizeof(modifier_names)/sizeof(modifier_names[0]) >= DirectionModifier::MaxDirectionModifier,
|
||||
"Some direction modifiers has not string representation.");
|
||||
static_assert(sizeof(modifier_names) / sizeof(modifier_names[0]) >=
|
||||
DirectionModifier::MaxDirectionModifier,
|
||||
"Some direction modifiers has not string representation.");
|
||||
return modifier_names[static_cast<std::size_t>(modifier)];
|
||||
}
|
||||
|
||||
std::string waypointTypeToString(const guidance::WaypointType waypoint_type)
|
||||
{
|
||||
static_assert(sizeof(waypoint_type_names)/sizeof(waypoint_type_names[0]) >= static_cast<size_t>(guidance::WaypointType::MaxWaypointType),
|
||||
"Some waypoint types has not string representation.");
|
||||
static_assert(sizeof(waypoint_type_names) / sizeof(waypoint_type_names[0]) >=
|
||||
static_cast<size_t>(guidance::WaypointType::MaxWaypointType),
|
||||
"Some waypoint types has not string representation.");
|
||||
return waypoint_type_names[static_cast<std::size_t>(waypoint_type)];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "util/guidance/toolkit.hpp"
|
||||
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "engine/guidance/toolkit.hpp"
|
||||
#include "engine/guidance/post_processing.hpp"
|
||||
#include "engine/guidance/toolkit.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#include <unordered_set>
|
||||
@@ -80,7 +80,8 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
|
||||
// where lanes in the turn fan in but for example the overall lanes at that location
|
||||
// fan out, we would have to know the asymmetric mapping of lanes. This is currently
|
||||
// not possible at the moment. In the following we implement a heuristic instead.
|
||||
const LaneID current_num_all_lanes = current.intersections.front().lane_description.size();
|
||||
const LaneID current_num_all_lanes =
|
||||
current.intersections.front().lane_description.size();
|
||||
const LaneID current_num_lanes_right_of_turn = current_lanes.first_lane_from_the_right;
|
||||
const LaneID current_num_lanes_left_of_turn =
|
||||
current_num_all_lanes -
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "engine/guidance/post_processing.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
|
||||
#include "engine/guidance/assemble_steps.hpp"
|
||||
#include "engine/guidance/lane_processing.hpp"
|
||||
@@ -408,8 +408,11 @@ void collapseTurnAt(std::vector<RouteStep> &steps,
|
||||
if (bearingsAreReversed(
|
||||
util::bearing::reverseBearing(getBearing(true, one_back_step)),
|
||||
getBearing(false, current_step)))
|
||||
{
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Continue;
|
||||
steps[one_back_index].maneuver.instruction.direction_modifier =
|
||||
DirectionModifier::UTurn;
|
||||
}
|
||||
}
|
||||
else if (TurnType::Merge == one_back_step.maneuver.instruction.type &&
|
||||
current_step.maneuver.instruction.type !=
|
||||
@@ -550,8 +553,6 @@ RouteStep elongate(RouteStep step, const RouteStep &by_step)
|
||||
return step;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Post processing can invalidate some instructions. For example StayOnRoundabout
|
||||
// is turned into exit counts. These instructions are removed by the following function
|
||||
|
||||
@@ -764,22 +765,23 @@ std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps)
|
||||
else
|
||||
{
|
||||
// Handle possible u-turns between highways that look like slip-roads
|
||||
if (steps[getPreviousIndex(one_back_index)].name_id == steps[step_index].name_id &&
|
||||
steps[step_index].name_id != EMPTY_NAMEID)
|
||||
{
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Turn;
|
||||
}
|
||||
if (compatible(one_back_step, current_step))
|
||||
{
|
||||
// Turn Types in the response depend on whether we find the same road name
|
||||
// (sliproad indcating a u-turn) or if we are turning onto a different road, in
|
||||
// which case we use a turn.
|
||||
if (steps[getPreviousIndex(one_back_index)].name_id ==
|
||||
steps[step_index].name_id &&
|
||||
steps[step_index].name_id != EMPTY_NAMEID)
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Continue;
|
||||
else
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Turn;
|
||||
|
||||
steps[one_back_index] =
|
||||
elongate(std::move(steps[one_back_index]), steps[step_index]);
|
||||
|
||||
steps[one_back_index].name_id = steps[step_index].name_id;
|
||||
steps[one_back_index].name = steps[step_index].name;
|
||||
steps[one_back_index].maneuver.instruction.type = TurnType::Turn;
|
||||
// the turn lanes for this turn are on the sliproad itself, so we have to
|
||||
// remember them
|
||||
steps[one_back_index].intersections.front().lanes =
|
||||
@@ -1202,7 +1204,8 @@ std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps)
|
||||
{
|
||||
// count intersections. We cannot use exit, since intersections can follow directly
|
||||
// after a roundabout
|
||||
steps[last_valid_instruction] = elongate(std::move(steps[last_valid_instruction]), step);
|
||||
steps[last_valid_instruction] =
|
||||
elongate(std::move(steps[last_valid_instruction]), step);
|
||||
step.maneuver.instruction = TurnInstruction::NO_TURN();
|
||||
}
|
||||
else if (!isSilent(instruction))
|
||||
|
||||
Reference in New Issue
Block a user