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

Method GetDistanceM

libs/routing/base/followed_polyline.cpp:33–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33double FollowedPolyline::GetDistanceM(Iter const & it1, Iter const & it2) const
34{
35 ASSERT(IsValid(), ());
36 ASSERT(it1.IsValid() && it2.IsValid(), ());
37 ASSERT_LESS_OR_EQUAL(it1.m_ind, it2.m_ind, ());
38 ASSERT_LESS(it1.m_ind, m_poly.GetSize(), ());
39 ASSERT_LESS(it2.m_ind, m_poly.GetSize(), ());
40
41 if (it1.m_ind == it2.m_ind)
42 return mercator::DistanceOnEarth(it1.m_pt, it2.m_pt);
43
44 return (mercator::DistanceOnEarth(it1.m_pt, m_poly.GetPoint(it1.m_ind + 1)) + m_segDistance[it2.m_ind - 1] -
45 m_segDistance[it1.m_ind] + mercator::DistanceOnEarth(m_poly.GetPoint(it2.m_ind), it2.m_pt));
46}
47
48double FollowedPolyline::GetTotalDistanceMeters() const
49{

Callers 4

GetNearestTurnMethod · 0.45
GetNextTurnMethod · 0.45
UNIT_TESTFunction · 0.45

Calls 6

ASSERTFunction · 0.85
IsValidFunction · 0.50
DistanceOnEarthFunction · 0.50
IsValidMethod · 0.45
GetSizeMethod · 0.45
GetPointMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.36