Removed visibility serialisation for bookmarks, added method to show only one bookmark category at once

This commit is contained in:
Alex Zolotarev 2012-09-26 13:27:26 +03:00 committed by Alex Zolotarev
parent 03423c4e03
commit e92cfddf34
3 changed files with 13 additions and 2 deletions

View file

@ -279,7 +279,8 @@ void BookmarkCategory::SaveToKML(ostream & s)
s << kmlHeader;
s << " <name>" << GetName() <<"</name>\n";
s << " <visibility>" << (IsVisible() ? "1" : "0") <<"</visibility>\n";
// Do not save bookmarks visibility. It is dynamic runtime property.
// s << " <visibility>" << (IsVisible() ? "1" : "0") <<"</visibility>\n";
for (size_t i = 0; i < m_bookmarks.size(); ++i)
{

View file

@ -359,6 +359,15 @@ bool Framework::DeleteBmCategory(size_t index)
else return false;
}
void Framework::SetVisibleBmCategory(string const & name)
{
for (size_t i = 0; i < m_bookmarks.size(); ++i)
{
BookmarkCategory * cat = m_bookmarks[i];
cat->SetVisible(cat->GetName() == name);
}
}
BookmarkAndCategory Framework::GetBookmark(m2::PointD pt) const
{
// @TODO Refactor. Why bookmarks can't be retrieved? Change pixel point to global point.

View file

@ -168,12 +168,13 @@ public:
void AddBookmark(string const & category, Bookmark const & bm);
inline size_t GetBmCategoriesCount() const { return m_bookmarks.size(); }
BookmarkCategory * GetBmCategory(size_t index) const;
/// Find or create new category by name.
BookmarkCategory * GetBmCategory(string const & name);
/// Delete bookmarks category with all bookmarks
/// @return true if category was deleted
bool DeleteBmCategory(size_t index);
/// Makes given category visible and hides all other categories
void SetVisibleBmCategory(string const & name);
/// Get bookmark by touch.
/// @param[in] pixPt Coordinates of touch point in pixels.