1111#include " midgard/util.h"
1212#include " odin/enhancedtrippath.h"
1313#include " odin/util.h"
14+ #include " tyr/serializer_constants.h"
1415#include " tyr/serializers.h"
1516#include " worker.h"
1617
@@ -578,40 +579,40 @@ json::ArrayPtr intersections(const valhalla::DirectionsLeg::Maneuver& maneuver,
578579 // reverse (left u-turn)
579580 if ((mask & kTurnLaneReverse ) &&
580581 (maneuver.type () == DirectionsLeg_Maneuver_Type_kUturnLeft)) {
581- indications->emplace_back (std::string ( " uturn " ) );
582+ indications->emplace_back (osrmconstants:: kModifierUturn );
582583 }
583584 // sharp_left
584585 if (mask & kTurnLaneSharpLeft ) {
585- indications->emplace_back (std::string ( " sharp left " ) );
586+ indications->emplace_back (osrmconstants:: kModifierSharpLeft );
586587 }
587588 // left
588589 if (mask & kTurnLaneLeft ) {
589- indications->emplace_back (std::string ( " left " ) );
590+ indications->emplace_back (osrmconstants:: kModifierLeft );
590591 }
591592 // slight_left
592593 if (mask & kTurnLaneSlightLeft ) {
593- indications->emplace_back (std::string ( " slight left " ) );
594+ indications->emplace_back (osrmconstants:: kModifierSlightLeft );
594595 }
595596 // through
596597 if (mask & kTurnLaneThrough ) {
597- indications->emplace_back (std::string ( " straight " ) );
598+ indications->emplace_back (osrmconstants:: kModifierStraight );
598599 }
599600 // slight_right
600601 if (mask & kTurnLaneSlightRight ) {
601- indications->emplace_back (std::string ( " slight right " ) );
602+ indications->emplace_back (osrmconstants:: kModifierSlightRight );
602603 }
603604 // right
604605 if (mask & kTurnLaneRight ) {
605- indications->emplace_back (std::string ( " right " ) );
606+ indications->emplace_back (osrmconstants:: kModifierRight );
606607 }
607608 // sharp_right
608609 if (mask & kTurnLaneSharpRight ) {
609- indications->emplace_back (std::string ( " sharp right " ) );
610+ indications->emplace_back (osrmconstants:: kModifierSharpRight );
610611 }
611612 // reverse (right u-turn)
612613 if ((mask & kTurnLaneReverse ) &&
613614 (maneuver.type () == DirectionsLeg_Maneuver_Type_kUturnRight)) {
614- indications->emplace_back (std::string ( " uturn " ) );
615+ indications->emplace_back (osrmconstants:: kModifierUturn );
615616 }
616617 lane->emplace (" indications" , std::move (indications));
617618 lanes->emplace_back (std::move (lane));
@@ -868,21 +869,21 @@ std::string turn_modifier(const uint32_t in_brg, const uint32_t out_brg) {
868869 auto turn_type = Turn::GetType (turn_degree);
869870 switch (turn_type) {
870871 case baldr::Turn::Type::kStraight :
871- return " straight " ;
872+ return osrmconstants:: kModifierStraight ;
872873 case baldr::Turn::Type::kSlightRight :
873- return " slight right " ;
874+ return osrmconstants:: kModifierSlightRight ;
874875 case baldr::Turn::Type::kRight :
875- return " right " ;
876+ return osrmconstants:: kModifierRight ;
876877 case baldr::Turn::Type::kSharpRight :
877- return " sharp right " ;
878+ return osrmconstants:: kModifierSharpRight ;
878879 case baldr::Turn::Type::kReverse :
879- return " uturn " ;
880+ return osrmconstants:: kModifierUturn ;
880881 case baldr::Turn::Type::kSharpLeft :
881- return " sharp left " ;
882+ return osrmconstants:: kModifierSharpLeft ;
882883 case baldr::Turn::Type::kLeft :
883- return " left " ;
884+ return osrmconstants:: kModifierLeft ;
884885 case baldr::Turn::Type::kSlightLeft :
885- return " slight left " ;
886+ return osrmconstants:: kModifierSlightLeft ;
886887 }
887888 auto num = static_cast <uint32_t >(turn_type);
888889 throw std::runtime_error (std::string (__FILE__) + " :" + std::to_string (__LINE__) +
@@ -903,47 +904,47 @@ std::string turn_modifier(const valhalla::DirectionsLeg::Maneuver& maneuver,
903904 case valhalla::DirectionsLeg_Maneuver_Type_kStayRight:
904905 case valhalla::DirectionsLeg_Maneuver_Type_kExitRight:
905906 case valhalla::DirectionsLeg_Maneuver_Type_kMergeRight:
906- return " slight right " ;
907+ return osrmconstants:: kModifierSlightRight ;
907908 case valhalla::DirectionsLeg_Maneuver_Type_kRight:
908909 case valhalla::DirectionsLeg_Maneuver_Type_kStartRight:
909910 case valhalla::DirectionsLeg_Maneuver_Type_kDestinationRight:
910- return " right " ;
911+ return osrmconstants:: kModifierRight ;
911912 case valhalla::DirectionsLeg_Maneuver_Type_kSharpRight:
912- return " sharp right " ;
913+ return osrmconstants:: kModifierSharpRight ;
913914 case valhalla::DirectionsLeg_Maneuver_Type_kUturnRight:
914915 case valhalla::DirectionsLeg_Maneuver_Type_kUturnLeft:
915916 // [TODO #1789] route ending in uturn should not set modifier=uturn
916917 if (arrive_maneuver)
917918 return " " ;
918- return " uturn " ;
919+ return osrmconstants:: kModifierUturn ;
919920 case valhalla::DirectionsLeg_Maneuver_Type_kSharpLeft:
920- return " sharp left " ;
921+ return osrmconstants:: kModifierSharpLeft ;
921922 case valhalla::DirectionsLeg_Maneuver_Type_kLeft:
922923 case valhalla::DirectionsLeg_Maneuver_Type_kStartLeft:
923924 case valhalla::DirectionsLeg_Maneuver_Type_kDestinationLeft:
924- return " left " ;
925+ return osrmconstants:: kModifierLeft ;
925926 case valhalla::DirectionsLeg_Maneuver_Type_kSlightLeft:
926927 case valhalla::DirectionsLeg_Maneuver_Type_kStayLeft:
927928 case valhalla::DirectionsLeg_Maneuver_Type_kExitLeft:
928929 case valhalla::DirectionsLeg_Maneuver_Type_kMergeLeft:
929- return " slight left " ;
930+ return osrmconstants:: kModifierSlightLeft ;
930931 case valhalla::DirectionsLeg_Maneuver_Type_kRampRight:
931932 if (Turn::GetType (GetTurnDegree (in_brg, out_brg)) == baldr::Turn::Type::kRight )
932- return " right " ;
933+ return osrmconstants:: kModifierRight ;
933934 else
934- return " slight right " ;
935+ return osrmconstants:: kModifierSlightRight ;
935936 case valhalla::DirectionsLeg_Maneuver_Type_kRampLeft:
936937 if (Turn::GetType (GetTurnDegree (in_brg, out_brg)) == baldr::Turn::Type::kLeft )
937- return " left " ;
938+ return osrmconstants:: kModifierLeft ;
938939 else
939- return " slight left " ;
940+ return osrmconstants:: kModifierSlightLeft ;
940941 case valhalla::DirectionsLeg_Maneuver_Type_kRoundaboutEnter:
941942 case valhalla::DirectionsLeg_Maneuver_Type_kRoundaboutExit:
942943 case valhalla::DirectionsLeg_Maneuver_Type_kFerryEnter:
943944 case valhalla::DirectionsLeg_Maneuver_Type_kFerryExit:
944945 return turn_modifier (in_brg, out_brg);
945946 default :
946- return " straight " ;
947+ return osrmconstants:: kModifierStraight ;
947948 }
948949}
949950
@@ -1105,7 +1106,7 @@ json::MapPtr osrm_maneuver(const valhalla::DirectionsLeg::Maneuver& maneuver,
11051106 } else if (false_node && new_name) {
11061107 maneuver_type = " new name" ;
11071108 } else {
1108- if ((modifier != " uturn " ) && (!maneuver.to_stay_on ())) {
1109+ if ((modifier != osrmconstants:: kModifierUturn ) && (!maneuver.to_stay_on ())) {
11091110 maneuver_type = " turn" ;
11101111 } else {
11111112 maneuver_type = " continue" ;
0 commit comments