Introduce on_ramp and off_ramp, deprecate ramp
This commit is contained in:
committed by
Patrick Niklaus
parent
1e6888c0d3
commit
6018fcf490
@@ -33,11 +33,31 @@ const constexpr char *modifier_names[] = {"uturn", "sharp right", "right", "s
|
||||
|
||||
// translations of TurnTypes. Not all types are exposed to the outside world.
|
||||
// invalid types should never be returned as part of the API
|
||||
const constexpr char *turn_type_names[] = {
|
||||
"invalid", "new name", "continue", "turn", "merge", "ramp",
|
||||
"fork", "end of road", "notification", "roundabout", "roundabout", "rotary",
|
||||
"rotary", "roundabout_turn", "roundabout_turn", "invalid", "invalid", "invalid",
|
||||
"invalid", "invalid", "invalid", "invalid", "invalid", "invalid"};
|
||||
const constexpr char *turn_type_names[] = {"invalid",
|
||||
"new name",
|
||||
"continue",
|
||||
"turn",
|
||||
"merge",
|
||||
"on ramp",
|
||||
"off ramp",
|
||||
"fork",
|
||||
"end of road",
|
||||
"notification",
|
||||
"roundabout",
|
||||
"roundabout",
|
||||
"rotary",
|
||||
"rotary",
|
||||
"roundabout turn",
|
||||
"roundabout turn",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid",
|
||||
"invalid"};
|
||||
|
||||
const constexpr char *waypoint_type_names[] = {"invalid", "arrive", "depart"};
|
||||
|
||||
@@ -128,7 +148,9 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
|
||||
{
|
||||
util::json::Object step_maneuver;
|
||||
if (maneuver.waypoint_type == guidance::WaypointType::None)
|
||||
{
|
||||
step_maneuver.values["type"] = detail::instructionTypeToString(maneuver.instruction.type);
|
||||
}
|
||||
else
|
||||
step_maneuver.values["type"] = detail::waypointTypeToString(maneuver.waypoint_type);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ TurnType IntersectionHandler::findBasicTurnType(const EdgeID via_edge,
|
||||
bool onto_ramp = isRampClass(out_data.road_classification.road_class);
|
||||
|
||||
if (!on_ramp && onto_ramp)
|
||||
return TurnType::Ramp;
|
||||
return TurnType::OnRamp;
|
||||
|
||||
if (in_data.name_id == out_data.name_id && in_data.name_id != INVALID_NAME_ID)
|
||||
{
|
||||
@@ -73,9 +73,9 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
|
||||
// handle travel modes:
|
||||
const auto in_mode = node_based_graph.GetEdgeData(via_edge).travel_mode;
|
||||
const auto out_mode = node_based_graph.GetEdgeData(road.turn.eid).travel_mode;
|
||||
if (type == TurnType::Ramp)
|
||||
if (type == TurnType::OnRamp)
|
||||
{
|
||||
return {TurnType::Ramp, getTurnDirection(road.turn.angle)};
|
||||
return {TurnType::OnRamp, getTurnDirection(road.turn.angle)};
|
||||
}
|
||||
|
||||
if (angularDeviation(road.turn.angle, 0) < 0.01)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "extractor/guidance/motorway_handler.hpp"
|
||||
#include "extractor/guidance/toolkit.hpp"
|
||||
|
||||
#include "util/simple_logger.hpp"
|
||||
#include "util/guidance/toolkit.hpp"
|
||||
#include "util/simple_logger.hpp"
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
@@ -92,7 +92,12 @@ operator()(const NodeID, const EdgeID via_eid, Intersection intersection) const
|
||||
// coming from motorway
|
||||
if (detail::isMotorwayClass(in_data.road_classification.road_class))
|
||||
{
|
||||
return fromMotorway(via_eid, std::move(intersection));
|
||||
intersection = fromMotorway(via_eid, std::move(intersection));
|
||||
std::for_each(intersection.begin(), intersection.end(), [](ConnectedRoad &road) {
|
||||
if (road.turn.instruction.type == TurnType::OnRamp)
|
||||
road.turn.instruction.type = TurnType::OffRamp;
|
||||
});
|
||||
return intersection;
|
||||
}
|
||||
else // coming from a ramp
|
||||
{
|
||||
@@ -246,16 +251,18 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
|
||||
else if (road.turn.angle < continue_angle)
|
||||
{
|
||||
road.turn.instruction = {
|
||||
detail::isRampClass(road.turn.eid, node_based_graph) ? TurnType::Ramp
|
||||
: TurnType::Turn,
|
||||
detail::isRampClass(road.turn.eid, node_based_graph)
|
||||
? TurnType::OffRamp
|
||||
: TurnType::Turn,
|
||||
(road.turn.angle < 145) ? DirectionModifier::Right
|
||||
: DirectionModifier::SlightRight};
|
||||
}
|
||||
else if (road.turn.angle > continue_angle)
|
||||
{
|
||||
road.turn.instruction = {
|
||||
detail::isRampClass(road.turn.eid, node_based_graph) ? TurnType::Ramp
|
||||
: TurnType::Turn,
|
||||
detail::isRampClass(road.turn.eid, node_based_graph)
|
||||
? TurnType::OffRamp
|
||||
: TurnType::Turn,
|
||||
(road.turn.angle > 215) ? DirectionModifier::Left
|
||||
: DirectionModifier::SlightLeft};
|
||||
}
|
||||
@@ -472,7 +479,7 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(isRampClass(edge_data.road_classification.road_class));
|
||||
road.turn.instruction = {TurnType::Ramp, getTurnDirection(road.turn.angle)};
|
||||
road.turn.instruction = {TurnType::OffRamp, getTurnDirection(road.turn.angle)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,18 +177,18 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
|
||||
{
|
||||
if (intersection[1].entry_allowed)
|
||||
{
|
||||
if (TurnType::Ramp != findBasicTurnType(via_edge, intersection[1]))
|
||||
if (TurnType::OnRamp != findBasicTurnType(via_edge, intersection[1]))
|
||||
intersection[1].turn.instruction = {TurnType::EndOfRoad, DirectionModifier::Right};
|
||||
else
|
||||
intersection[1].turn.instruction = {TurnType::Ramp, DirectionModifier::Right};
|
||||
intersection[1].turn.instruction = {TurnType::OnRamp, DirectionModifier::Right};
|
||||
}
|
||||
if (intersection[2].entry_allowed)
|
||||
{
|
||||
if (TurnType::Ramp != findBasicTurnType(via_edge, intersection[2]))
|
||||
if (TurnType::OnRamp != findBasicTurnType(via_edge, intersection[2]))
|
||||
|
||||
intersection[2].turn.instruction = {TurnType::EndOfRoad, DirectionModifier::Left};
|
||||
else
|
||||
intersection[2].turn.instruction = {TurnType::Ramp, DirectionModifier::Left};
|
||||
intersection[2].turn.instruction = {TurnType::OnRamp, DirectionModifier::Left};
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -220,7 +220,6 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
|
||||
|
||||
Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection intersection) const
|
||||
{
|
||||
static int fallback_count = 0;
|
||||
const std::size_t obvious_index = findObviousTurn(via_edge, intersection);
|
||||
const auto fork_range = findFork(intersection);
|
||||
std::size_t straightmost_turn = 0;
|
||||
|
||||
Reference in New Issue
Block a user