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

Method MakeLegs

include/engine/api/route_api.hpp:921–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

919 const RouteParameters &parameters;
920
921 std::pair<std::vector<guidance::RouteLeg>, std::vector<guidance::LegGeometry>>
922 MakeLegs(const std::vector<PhantomEndpoints> &leg_endpoints,
923 const std::vector<std::vector<PathData>> &unpacked_path_segments,
924 const std::vector<bool> &source_traversed_in_reverse,
925 const std::vector<bool> &target_traversed_in_reverse) const
926 {
927 auto result =
928 std::make_pair(std::vector<guidance::RouteLeg>(), std::vector<guidance::LegGeometry>());
929 auto &legs = result.first;
930 auto &leg_geometries = result.second;
931 auto number_of_legs = leg_endpoints.size();
932 legs.reserve(number_of_legs);
933 leg_geometries.reserve(number_of_legs);
934
935 for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
936 {
937 const auto &phantoms = leg_endpoints[idx];
938 const auto &path_data = unpacked_path_segments[idx];
939
940 const bool reversed_source = source_traversed_in_reverse[idx];
941 const bool reversed_target = target_traversed_in_reverse[idx];
942
943 auto leg = guidance::assembleLeg(facade,
944 path_data,
945 phantoms.source_phantom,
946 phantoms.target_phantom,
947 reversed_target);
948
949 guidance::LegGeometry leg_geometry;
950
951 // Generate additional geometry data if request includes turn-by-turn steps,
952 // overview geometry or route geometry annotations.
953 // Note that overview geometry and route geometry annotations can return different
954 // results depending on whether turn-by-turn steps are also requested.
955 if (parameters.steps || parameters.annotations ||
956 parameters.overview != RouteParameters::OverviewType::False)
957 {
958
959 leg_geometry = guidance::assembleGeometry(BaseAPI::facade,
960 path_data,
961 phantoms.source_phantom,
962 phantoms.target_phantom,
963 reversed_source,
964 reversed_target);
965
966 util::Log(logDEBUG) << "Assembling steps " << std::endl;
967 if (parameters.steps)
968 {
969 leg.summary = guidance::assembleSummary(
970 facade, path_data, phantoms.target_phantom, reversed_target);
971
972 auto steps = guidance::assembleSteps(BaseAPI::facade,
973 path_data,
974 leg_geometry,
975 phantoms.source_phantom,
976 phantoms.target_phantom,
977 reversed_source,
978 reversed_target);

Callers

nothing calls this directly

Calls 15

assembleLegFunction · 0.85
assembleGeometryFunction · 0.85
LogClass · 0.85
assembleSummaryFunction · 0.85
assembleStepsFunction · 0.85
applyOverridesFunction · 0.85
trimShortSegmentsFunction · 0.85
handleRoundaboutsFunction · 0.85
collapseTurnInstructionsFunction · 0.85
anticipateLaneChangeFunction · 0.85
buildIntersectionsFunction · 0.85

Tested by

no test coverage detected