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

Method MakeWaypoint

include/engine/api/base_api.hpp:47–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46 protected:
47 util::json::Object MakeWaypoint(const PhantomNodeCandidates &candidates) const
48 {
49 // TODO: check forward/reverse
50 const auto toName = [this](const auto &phantom) {
51 return std::string(
52 facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)));
53 };
54 const auto noEmpty = [](const auto &name) { return !name.empty(); };
55
56 // At an intersection we may have multiple phantom node candidates.
57 // Combine them to represent the waypoint name.
58 std::string waypoint_name =
59 join(candidates | std::views::transform(toName) | std::views::filter(noEmpty),
60 INTERSECTION_DELIMITER);
61
62 const auto &snapped_location = candidatesSnappedLocation(candidates);
63 const auto &input_location = candidatesInputLocation(candidates);
64 if (parameters.generate_hints)
65 {
66 std::vector<SegmentHint> seg_hints(candidates.size());
67 std::transform(candidates.begin(),
68 candidates.end(),
69 seg_hints.begin(),
70 [this](const auto &phantom)
71 { return SegmentHint{phantom, facade.GetCheckSum()}; });
72
73 return json::makeWaypoint(
74 snapped_location,
75 util::coordinate_calculation::greatCircleDistance(snapped_location, input_location),
76 waypoint_name,
77 {std::move(seg_hints)});
78 }
79 else
80 {
81 return json::makeWaypoint(
82 snapped_location,
83 util::coordinate_calculation::greatCircleDistance(snapped_location, input_location),
84 waypoint_name);
85 }
86 }
87
88 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<fbresult::Waypoint>>>
89 MakeWaypoints(flatbuffers::FlatBufferBuilder *builder,

Callers

nothing calls this directly

Calls 14

joinFunction · 0.85
candidatesInputLocationFunction · 0.85
makeWaypointFunction · 0.85
greatCircleDistanceFunction · 0.85
toFloatingFunction · 0.85
ToBase64Method · 0.80
GetNameForIDMethod · 0.45
GetNameIndexMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected