| 47 | } |
| 48 | |
| 49 | FakeEnding 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 | |
| 73 | FakeEnding MakeFakeEnding(Segment const & segment, m2::PointD const & point, IndexGraph & graph) |
| 74 | { |
no test coverage detected