diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-08-18 13:47:25 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:01:50 +0300 |
commit | 33fb379f22c4fd7f243cc74e2d3dd4c7b50b321e (patch) | |
tree | 1306faaacb73f4e2b6abd669479a1d50eb32e3e6 /routing/base | |
parent | 859d947f69da4d8dc53395c5441cf6138903db43 (diff) |
Return back partial distance methods.
Diffstat (limited to 'routing/base')
-rw-r--r-- | routing/base/followed_polyline.cpp | 20 | ||||
-rw-r--r-- | routing/base/followed_polyline.hpp | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/routing/base/followed_polyline.cpp b/routing/base/followed_polyline.cpp index 50cabdf9b5..55e899baf3 100644 --- a/routing/base/followed_polyline.cpp +++ b/routing/base/followed_polyline.cpp @@ -41,6 +41,26 @@ double FollowedPolyline::GetDistanceM(Iter const & it1, Iter const & it2) const MercatorBounds::DistanceOnEarth(m_poly.GetPoint(it2.m_ind), it2.m_pt)); } +double FollowedPolyline::GetTotalDistanceM() const +{ + ASSERT(IsValid(), ()); + return m_segDistance.back(); +} + +double FollowedPolyline::GetDistanceFromBeginM() const +{ + ASSERT(IsValid(), ()); + ASSERT(m_current.IsValid(), ()); + + return m_current.m_ind > 0 ? m_segDistance[m_current.m_ind] : 0.0 + + MercatorBounds::DistanceOnEarth(m_current.m_pt, m_poly.GetPoint(m_current.m_ind)); +} + +double FollowedPolyline::GetDistanceToEndM() const +{ + return GetTotalDistanceM() - GetDistanceFromBeginM(); +} + void FollowedPolyline::Swap(FollowedPolyline & rhs) { m_poly.Swap(rhs.m_poly); diff --git a/routing/base/followed_polyline.hpp b/routing/base/followed_polyline.hpp index e255f3df05..02a9d4342f 100644 --- a/routing/base/followed_polyline.hpp +++ b/routing/base/followed_polyline.hpp @@ -24,6 +24,9 @@ public: m2::PolylineD const & GetPolyline() const { return m_poly; } + double GetTotalDistanceM() const; + double GetDistanceFromBeginM() const; + double GetDistanceToEndM() const; double GetMercatorDistanceFromBegin() const; /*! \brief Return next navigation point for direction widgets. |