Make TurnInstructionsClass functions free standing functions

This commit is contained in:
Daniel J. Hofmann 2016-01-08 22:37:25 +01:00 committed by Patrick Niklaus
parent 03f64a6c20
commit f65dd63210
4 changed files with 42 additions and 46 deletions

View File

@ -254,7 +254,7 @@ ApiResponseGenerator<DataFacadeT>::BuildRouteSegments(const Segments &segment_li
for (const auto &segment : segment_list.Get())
{
const auto current_turn = segment.turn_instruction;
if (extractor::TurnInstructionsClass::TurnIsNecessary(current_turn) &&
if (extractor::isTurnNecessary(current_turn) &&
(extractor::TurnInstruction::EnterRoundAbout != current_turn))
{

View File

@ -47,7 +47,7 @@ inline util::json::Array AnnotateRoute(const std::vector<SegmentInformation> &ro
{
util::json::Array json_instruction_row;
extractor::TurnInstruction current_instruction = segment.turn_instruction;
if (extractor::TurnInstructionsClass::TurnIsNecessary(current_instruction))
if (extractor::isTurnNecessary(current_instruction))
{
if (extractor::TurnInstruction::EnterRoundAbout == current_instruction)
{

View File

@ -31,12 +31,8 @@ enum class TurnInstruction : unsigned char
AccessRestrictionPenalty = 129
};
struct TurnInstructionsClass
{
TurnInstructionsClass() = delete;
TurnInstructionsClass(const TurnInstructionsClass &) = delete;
static inline TurnInstruction GetTurnDirectionOfInstruction(const double angle)
// Translates between angles and their human-friendly directional representation
inline TurnInstruction getTurnDirection(const double angle)
{
if (angle >= 23 && angle < 67)
{
@ -69,7 +65,8 @@ struct TurnInstructionsClass
return TurnInstruction::UTurn;
}
static inline bool TurnIsNecessary(const TurnInstruction turn_instruction)
// Decides if a turn is needed to be done for the current instruction
inline bool isTurnNecessary(const TurnInstruction turn_instruction)
{
if (TurnInstruction::NoTurn == turn_instruction ||
TurnInstruction::StayOnRoundAbout == turn_instruction)
@ -78,7 +75,6 @@ struct TurnInstructionsClass
}
return true;
}
};
}
}

View File

@ -683,7 +683,7 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID node_u,
}
}
return TurnInstructionsClass::GetTurnDirectionOfInstruction(angle);
return getTurnDirection(angle);
}
}
}