diff --git a/map/framework.cpp b/map/framework.cpp index 98c0399fda..596144293a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1502,6 +1502,23 @@ bool Framework::GetVisiblePOI(m2::PointD const & pxPoint, m2::PointD & pxPivot, return false; } +Framework::BookmarkOrPoi Framework::GetBookmarkOrPoi(m2::PointD const & pxPoint, m2::PointD & pxPivot, AddressInfo & info, BookmarkAndCategory & bmCat) +{ + bmCat = GetBookmark(pxPoint); + if (IsValid(bmCat)) + return Framework::BOOKMARK; + if (GetVisiblePOI(pxPoint, pxPivot, info)) + { + //We need almost the exact position of the bookmark, parameter 0.1 resolves the error in 2 pixels + bmCat = GetBookmark(pxPivot, 0.1); + if (IsValid(bmCat)) + return Framework::BOOKMARK; + else + return Framework::POI; + } + return Framework::NOTHING_FOUND; +} + Animator & Framework::GetAnimator() { return m_animator; diff --git a/map/framework.hpp b/map/framework.hpp index ed81997519..392df939e3 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -346,6 +346,15 @@ private: public: bool GetVisiblePOI(m2::PointD const & pxPoint, m2::PointD & pxPivot, AddressInfo & info) const; + enum BookmarkOrPoi + { + NOTHING_FOUND = 0, + BOOKMARK = 1, + POI = 2 + }; + + BookmarkOrPoi GetBookmarkOrPoi(m2::PointD const & pxPoint, m2::PointD & pxPivot, AddressInfo & info, BookmarkAndCategory & bmCat); + virtual void BeginPaint(shared_ptr const & e); /// Function for calling from platform dependent-paint function. virtual void DoPaint(shared_ptr const & e);