| 88 | } // namespace detail |
| 89 | |
| 90 | util::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 | |
| 122 | util::json::Object makeIntersection(const guidance::IntermediateIntersection &intersection) |
| 123 | { |
no test coverage detected