Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2014-07-18 19:52:01 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:21:14 +0300
commit19b5c251dd41d93961bb6bd3e75a64255f281df3 (patch)
tree4659f410aae316296a00d6fd81939ed67a57dfb9 /map/user_mark_container.cpp
parent9e6014b374271ed4879e99f7aca6e0d927e7e097 (diff)
Process bookmarks in viewport rect only.
Diffstat (limited to 'map/user_mark_container.cpp')
-rw-r--r--map/user_mark_container.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/map/user_mark_container.cpp b/map/user_mark_container.cpp
index 933c05a26c..0a03eb6abc 100644
--- a/map/user_mark_container.cpp
+++ b/map/user_mark_container.cpp
@@ -131,13 +131,21 @@ UserMarkContainer::~UserMarkContainer()
Clear();
}
+template <class ToDo>
+void UserMarkContainer::ForEachInRect(m2::RectD const & rect, ToDo toDo) const
+{
+ for (size_t i = 0; i < m_userMarks.size(); ++i)
+ if (rect.IsPointInside(m_userMarks[i]->GetOrg()))
+ toDo(m_userMarks[i]);
+}
+
UserMark const * UserMarkContainer::FindMarkInRect(m2::AnyRectD const & rect, double & d) const
{
UserMark * mark = NULL;
if (IsVisible())
{
FindMarkFunctor f(&mark, d, rect);
- for_each(m_userMarks.begin(), m_userMarks.end(), f);
+ ForEachInRect(rect.GetGlobalRect(), f);
}
return mark;
}
@@ -147,8 +155,8 @@ void UserMarkContainer::Draw(PaintOverlayEvent const & e, UserMarkDLCache * cach
if (IsVisible() && IsDrawable())
{
UserMarkDLCache::Key defaultKey(GetTypeName(), graphics::EPosCenter, m_layerDepth);
- for_each(m_userMarks.begin(), m_userMarks.end(), bind(&DrawUserMark, 1.0, m_framework.GetVisualScale(),
- e, cache, defaultKey, _1));
+ ForEachInRect(e.GetClipRect(), bind(&DrawUserMark, 1.0, m_framework.GetVisualScale(),
+ e, cache, defaultKey, _1));
}
}