MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / makeStepManeuver

Function makeStepManeuver

src/engine/api/json_factory.cpp:90–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88} // namespace detail
89
90util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
91{
92 util::json::Object step_maneuver;
93
94 std::string maneuver_type;
95
96 if (maneuver.waypoint_type == guidance::WaypointType::None)
97 maneuver_type = osrm::guidance::instructionTypeToString(maneuver.instruction.type);
98 else
99 maneuver_type = detail::waypointTypeToString(maneuver.waypoint_type);
100
101 // These invalid responses should never happen: log if they do happen
102 BOOST_ASSERT_MSG(maneuver_type != "invalid", "unexpected invalid maneuver type");
103
104 step_maneuver.values.emplace("type", std::move(maneuver_type));
105
106 if (detail::isValidModifier(maneuver))
107 step_maneuver.values.emplace(
108 "modifier",
109 osrm::guidance::instructionModifierToString(maneuver.instruction.direction_modifier));
110
111 step_maneuver.values.emplace("location", detail::coordinateToLonLat(maneuver.location));
112 step_maneuver.values.emplace("bearing_before",
113 detail::roundAndClampBearing(maneuver.bearing_before));
114 step_maneuver.values.emplace("bearing_after",
115 detail::roundAndClampBearing(maneuver.bearing_after));
116 if (maneuver.exit != 0)
117 step_maneuver.values.emplace("exit", maneuver.exit);
118
119 return step_maneuver;
120}
121
122util::json::Object makeIntersection(const guidance::IntermediateIntersection &intersection)
123{

Callers 1

makeRouteStepFunction · 0.85

Calls 7

instructionTypeToStringFunction · 0.85
waypointTypeToStringFunction · 0.85
isValidModifierFunction · 0.85
coordinateToLonLatFunction · 0.85
roundAndClampBearingFunction · 0.85
emplaceMethod · 0.45

Tested by

no test coverage detected