forked from organicmaps/organicmaps
[core] dont show red marker when we have only one search result.
This commit is contained in:
parent
4cfe3ed541
commit
063a20d481
5 changed files with 30 additions and 8 deletions
|
@ -359,6 +359,16 @@ bool BookmarkManager::UserMarksIsVisible(UserMarkContainer::Type type) const
|
|||
return FindUserMarksContainer(type)->IsVisible();
|
||||
}
|
||||
|
||||
void BookmarkManager::UserMarksSetDrawable(UserMarkContainer::Type type, bool isDrawable)
|
||||
{
|
||||
FindUserMarksContainer(type)->SetIsDrawable(isDrawable);
|
||||
}
|
||||
|
||||
void BookmarkManager::UserMarksIsDrawable(UserMarkContainer::Type type)
|
||||
{
|
||||
FindUserMarksContainer(type)->IsDrawable();
|
||||
}
|
||||
|
||||
UserMark * BookmarkManager::UserMarksAddMark(UserMarkContainer::Type type, const m2::PointD & ptOrg)
|
||||
{
|
||||
return FindUserMarksContainer(type)->GetController().CreateUserMark(ptOrg);
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
/// Additional layer methods
|
||||
void UserMarksSetVisible(UserMarkContainer::Type type, bool isVisible);
|
||||
bool UserMarksIsVisible(UserMarkContainer::Type type) const;
|
||||
void UserMarksSetDrawable(UserMarkContainer::Type type, bool isDrawable);
|
||||
void UserMarksIsDrawable(UserMarkContainer::Type type);
|
||||
UserMark * UserMarksAddMark(UserMarkContainer::Type type, m2::PointD const & ptOrg);
|
||||
void UserMarksClear(UserMarkContainer::Type type);
|
||||
UserMarkContainer::Controller & UserMarksGetController(UserMarkContainer::Type type);
|
||||
|
|
|
@ -1155,6 +1155,7 @@ void Framework::ShowSearchResult(search::Result const & res)
|
|||
UserMarkContainer::Type type = UserMarkContainer::SEARCH_MARK;
|
||||
m_bmManager.UserMarksSetVisible(type, true);
|
||||
m_bmManager.UserMarksClear(type);
|
||||
m_bmManager.UserMarksSetDrawable(type, false);
|
||||
|
||||
m_lastSearch.Clear();
|
||||
|
||||
|
@ -1241,6 +1242,7 @@ void Framework::FillSearchResultsMarks(search::Results const & results, m2::Rect
|
|||
UserMarkContainer::Type const type = UserMarkContainer::SEARCH_MARK;
|
||||
m_bmManager.UserMarksSetVisible(type, true);
|
||||
m_bmManager.UserMarksClear(type);
|
||||
m_bmManager.UserMarksSetDrawable(type, true);
|
||||
|
||||
size_t const count = results.GetCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
|
|
|
@ -120,6 +120,7 @@ UserMarkContainer::UserMarkContainer(double layerDepth, Framework & fm)
|
|||
: m_framework(fm)
|
||||
, m_controller(this)
|
||||
, m_isVisible(true)
|
||||
, m_isDrawable(true)
|
||||
, m_layerDepth(layerDepth)
|
||||
{
|
||||
}
|
||||
|
@ -132,19 +133,22 @@ UserMarkContainer::~UserMarkContainer()
|
|||
UserMark const * UserMarkContainer::FindMarkInRect(m2::AnyRectD const & rect, double & d) const
|
||||
{
|
||||
UserMark * mark = NULL;
|
||||
FindMarkFunctor f(&mark, d, rect);
|
||||
for_each(m_userMarks.begin(), m_userMarks.end(), f);
|
||||
if (IsVisible())
|
||||
{
|
||||
FindMarkFunctor f(&mark, d, rect);
|
||||
for_each(m_userMarks.begin(), m_userMarks.end(), f);
|
||||
}
|
||||
return mark;
|
||||
}
|
||||
|
||||
void UserMarkContainer::Draw(PaintOverlayEvent const & e, UserMarkDLCache * cache) const
|
||||
{
|
||||
if (m_isVisible == false)
|
||||
return;
|
||||
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
void UserMarkContainer::Clear()
|
||||
|
|
|
@ -58,6 +58,9 @@ public:
|
|||
bool IsVisible() const { return m_isVisible; }
|
||||
void SetVisible(bool isVisible) { m_isVisible = isVisible; }
|
||||
|
||||
bool IsDrawable() const { return m_isDrawable; }
|
||||
void SetIsDrawable(bool isDrawable) { m_isDrawable = isDrawable; }
|
||||
|
||||
// If not found mark on rect result is NULL
|
||||
// If mark is found in "d" return distance from rect center
|
||||
// In multiple select choose mark with min(d)
|
||||
|
@ -98,6 +101,7 @@ protected:
|
|||
private:
|
||||
Controller m_controller;
|
||||
bool m_isVisible;
|
||||
bool m_isDrawable;
|
||||
double m_layerDepth;
|
||||
vector<UserMark *> m_userMarks;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue