remove unused instruction types

This commit is contained in:
Moritz Kobitzsch 2016-04-18 14:57:12 +02:00 committed by Patrick Niklaus
parent d770c35245
commit 7b32d3184c
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
5 changed files with 4 additions and 72 deletions

View File

@ -67,13 +67,6 @@ class IntersectionHandler
const std::size_t begin,
const std::size_t end) const;
// Counting Turns are Essentially unseparable turns. Begin > end is a valid input
void assignCountingTurns(const EdgeID via_eid,
Intersection &intersection,
const std::size_t begin,
const std::size_t end,
const DirectionModifier modifier) const;
bool isThroughStreet(const std::size_t index, const Intersection &intersection) const;
};

View File

@ -42,16 +42,8 @@ enum TurnType // at the moment we can support 32 turn types, without increasing
NewName, // no turn, but name changes
Continue, // remain on a street
Turn, // basic turn
FirstTurn, // First of x turns
SecondTurn, // Second of x turns
ThirdTurn, // Third of x turns
FourthTurn, // Fourth of x turns
Merge, // merge onto a street
Ramp, // special turn (highway ramp exits)
FirstRamp, // first turn onto a ramp
SecondRamp, // second turn onto a ramp
ThirdRamp, // third turn onto a ramp
FourthRamp, // fourth turn onto a ramp
Fork, // fork road splitting up
EndOfRoad, // T intersection
EnterRoundabout, // Entering a small Roundabout
@ -63,7 +55,6 @@ enum TurnType // at the moment we can support 32 turn types, without increasing
EnterAndExitRotary, // Touching a rotary
ExitRotary, // Exit a rotary
StayOnRoundabout, // Continue on Either a small or a large Roundabout
Restriction, // Cross a Barrier, requires barrier penalties instead of full block
Notification // Travel Mode Changes`
};

View File

@ -34,11 +34,9 @@ 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", "no turn", "invalid", "new name", "continue", "turn",
"turn", "turn", "turn", "turn", "merge", "ramp",
"ramp", "ramp", "ramp", "ramp", "fork", "end of road",
"roundabout", "invalid", "roundabout", "invalid", "rotary", "invalid",
"rotary", "invalid", "invalid", "restriction", "notification"};
"invalid", "no turn", "invalid", "new name", "continue", "turn", "merge",
"ramp", "fork", "end of road", "roundabout", "invalid", "roundabout", "invalid",
"rotary", "invalid", "rotary", "invalid", "invalid", "notification"};
const constexpr char *waypoint_type_names[] = {"invalid", "arrive", "depart"};
// Check whether to include a modifier in the result of the API

View File

@ -297,35 +297,6 @@ void IntersectionHandler::assignTrivialTurns(const EdgeID via_eid,
getTurnDirection(intersection[index].turn.angle)};
}
void IntersectionHandler::assignCountingTurns(const EdgeID via_eid,
Intersection &intersection,
const std::size_t begin,
const std::size_t end,
const DirectionModifier modifier) const
{
const constexpr TurnType turns[] = {TurnType::FirstTurn, TurnType::SecondTurn,
TurnType::ThirdTurn, TurnType::FourthTurn};
const constexpr TurnType ramps[] = {TurnType::FirstRamp, TurnType::SecondRamp,
TurnType::ThirdRamp, TurnType::FourthRamp};
const std::size_t length = end > begin ? end - begin : begin - end;
if (length > 4)
{
util::SimpleLogger().Write(logDEBUG) << "Counting Turn assignment called for " << length
<< " turns. Supports at most four turns.";
}
// counting turns varies whether we consider left/right turns
for (std::size_t index = begin, count = 0; index != end;
count++, begin < end ? ++index : --index)
{
if (TurnType::Ramp == findBasicTurnType(via_eid, intersection[index]))
intersection[index].turn.instruction = {ramps[count], modifier};
else
intersection[index].turn.instruction = {turns[count], modifier};
}
}
bool IntersectionHandler::isThroughStreet(const std::size_t index,
const Intersection &intersection) const
{

View File

@ -538,7 +538,7 @@ Intersection TurnHandler::assignRightTurns(const EdgeID via_edge,
BOOST_ASSERT(intersection[1].entry_allowed && intersection[2].entry_allowed &&
intersection[3].entry_allowed);
// count backwards from the slightest turn
assignCountingTurns(via_edge, intersection, 3, 0, second_direction);
assignTrivialTurns(via_edge, intersection, 1, up_to);
}
else if (((first_direction == second_direction &&
angularDeviation(intersection[2].turn.angle, intersection[3].turn.angle) >=
@ -581,12 +581,6 @@ Intersection TurnHandler::assignRightTurns(const EdgeID via_edge,
assignTrivialTurns(via_edge, intersection, 1, up_to);
}
}
else if (up_to == 5)
{
// count backwards from the slightest turn
assignCountingTurns(via_edge, intersection, 4, 0, DirectionModifier::Right);
}
else
{
assignTrivialTurns(via_edge, intersection, 1, up_to);
@ -728,21 +722,6 @@ void TurnHandler::handleDistinctConflict(const EdgeID via_edge,
right.turn.instruction = {right_type, DirectionModifier::Left};
return;
}
// Both turns?
if (TurnType::Ramp != left_type && TurnType::Ramp != right_type)
{
if (left.turn.angle < STRAIGHT_ANGLE)
{
left.turn.instruction = {TurnType::FirstTurn, getTurnDirection(left.turn.angle)};
right.turn.instruction = {TurnType::SecondTurn, getTurnDirection(right.turn.angle)};
}
else
{
left.turn.instruction = {TurnType::SecondTurn, getTurnDirection(left.turn.angle)};
right.turn.instruction = {TurnType::FirstTurn, getTurnDirection(right.turn.angle)};
}
return;
}
// Shift the lesser penalty
if (getTurnDirection(left.turn.angle) == DirectionModifier::SharpLeft)
{