osrm-backend/include/engine/guidance/toolkit.hpp

48 lines
1.2 KiB
C++
Raw Normal View History

#ifndef OSRM_ENGINE_GUIDANCE_TOOLKIT_HPP_
#define OSRM_ENGINE_GUIDANCE_TOOLKIT_HPP_
2016-03-01 16:30:31 -05:00
#include "extractor/guidance/turn_instruction.hpp"
#include "util/guidance/toolkit.hpp"
2016-03-01 16:30:31 -05:00
#include "util/bearing.hpp"
#include <algorithm>
2016-03-01 16:30:31 -05:00
namespace osrm
{
namespace engine
{
namespace guidance
{
using util::guidance::entersRoundabout;
using util::guidance::leavesRoundabout;
using util::guidance::staysOnRoundabout;
2016-03-01 16:30:31 -05:00
// Silent Turn Instructions are not to be mentioned to the outside world but
inline bool isSilent(const extractor::guidance::TurnInstruction instruction)
{
2016-03-03 09:36:03 -05:00
return instruction.type == extractor::guidance::TurnType::NoTurn ||
instruction.type == extractor::guidance::TurnType::Suppressed ||
2016-03-01 16:30:31 -05:00
instruction.type == extractor::guidance::TurnType::StayOnRoundabout;
}
inline extractor::guidance::DirectionModifier::Enum angleToDirectionModifier(const double bearing)
2016-03-01 16:30:31 -05:00
{
if (bearing < 135)
{
return extractor::guidance::DirectionModifier::Right;
}
if (bearing <= 225)
{
return extractor::guidance::DirectionModifier::Straight;
}
return extractor::guidance::DirectionModifier::Left;
}
} // namespace guidance
} // namespace engine
} // namespace osrm
#endif /* OSRM_ENGINE_GUIDANCE_TOOLKIT_HPP_ */