2016-04-18 07:41:19 -04:00
|
|
|
#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"
|
2016-07-01 05:34:44 -04:00
|
|
|
#include "util/guidance/toolkit.hpp"
|
2016-03-01 16:30:31 -05:00
|
|
|
#include "util/bearing.hpp"
|
|
|
|
|
2016-04-14 04:41:56 -04:00
|
|
|
#include <algorithm>
|
|
|
|
|
2016-03-01 16:30:31 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace engine
|
|
|
|
{
|
|
|
|
namespace guidance
|
|
|
|
{
|
|
|
|
|
2016-07-01 05:34:44 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-05-19 17:26:07 -04:00
|
|
|
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
|
|
|
|
|
2016-04-18 07:41:19 -04:00
|
|
|
#endif /* OSRM_ENGINE_GUIDANCE_TOOLKIT_HPP_ */
|