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

Method GetFakeEnding

libs/routing/regions_sparse_graph.cpp:53–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53std::optional<FakeEnding> RegionsSparseGraph::GetFakeEnding(m2::PointD const & point) const
54{
55 auto const country = platform::CountryFile(m_countryFileGetterFn(point));
56 if (country.IsEmpty())
57 return {};
58 NumMwmId const mwmId = m_numMwmIds->GetId(country);
59 auto const it = m_graph.m_mwms.find(mwmId);
60 if (it == m_graph.m_mwms.end())
61 return {};
62
63 FakeEnding ending;
64
65 ending.m_originJunction = LatLonWithAltitude(mercator::ToLatLon(point), 0);
66
67 for (auto const & segmentId : it->second)
68 {
69 CrossBorderSegment const & data = GetDataById(segmentId);
70
71 bool const oneWay = false;
72 auto const & frontJunction = data.m_end.m_point;
73 auto const & backJunction = data.m_start.m_point;
74
75 auto const & projectedJunction = CalcProjectionToSegment(backJunction, frontJunction, point);
76
77 Segment const segment(data.m_start.m_numMwmId, segmentId /* featureId */, 0 /* segmentIdx */, true /* isForward */);
78
79 ending.m_projections.emplace_back(segment, oneWay, frontJunction, backJunction, projectedJunction);
80 }
81
82 return ending;
83}
84
85double GetWeight(CrossBorderSegment const & toSeg, LatLonWithAltitude const & coordFrom, NumMwmId fromMwm)
86{

Callers

nothing calls this directly

Calls 9

LatLonWithAltitudeClass · 0.85
CalcProjectionToSegmentFunction · 0.85
CountryFileClass · 0.70
ToLatLonFunction · 0.50
IsEmptyMethod · 0.45
GetIdMethod · 0.45
findMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected