MCPcopy Create free account
hub / github.com/comaps/comaps / MakeFakeEnding

Function MakeFakeEnding

libs/routing/fake_ending.cpp:49–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49FakeEnding MakeFakeEnding(vector<Segment> const & segments, m2::PointD const & point, WorldGraph & graph)
50{
51 FakeEnding ending;
52 double averageAltitude = 0.0;
53
54 for (size_t i = 0; i < segments.size(); ++i)
55 {
56 auto const & segment = segments[i];
57
58 bool const oneWay = graph.IsOneWay(segment.GetMwmId(), segment.GetFeatureId());
59 auto const & frontJunction = graph.GetJunction(segment, true /* front */);
60 auto const & backJunction = graph.GetJunction(segment, false /* front */);
61 auto const & projectedJunction = CalcProjectionToSegment(backJunction, frontJunction, point);
62
63 ending.m_projections.emplace_back(segment, oneWay, frontJunction, backJunction, projectedJunction);
64
65 averageAltitude = (i * averageAltitude + projectedJunction.GetAltitude()) / (i + 1);
66 }
67
68 ending.m_originJunction =
69 LatLonWithAltitude(mercator::ToLatLon(point), static_cast<geometry::Altitude>(averageAltitude));
70 return ending;
71}
72
73FakeEnding MakeFakeEnding(Segment const & segment, m2::PointD const & point, IndexGraph & graph)
74{

Callers 6

MakeGateEndingsFunction · 0.70
MakeStopEndingsFunction · 0.70
AdjustRouteMethod · 0.70
SnapMethod · 0.70

Calls 10

CalcProjectionToSegmentFunction · 0.85
LatLonWithAltitudeClass · 0.85
ToLatLonFunction · 0.50
sizeMethod · 0.45
IsOneWayMethod · 0.45
GetMwmIdMethod · 0.45
GetFeatureIdMethod · 0.45
emplace_backMethod · 0.45
GetAltitudeMethod · 0.45
GetPointIdMethod · 0.45

Tested by

no test coverage detected