forked from organicmaps/organicmaps
Keep scale and timestamp when editing (replacing) bookmark in category.
This commit is contained in:
parent
ad977f5b33
commit
6788854710
2 changed files with 14 additions and 7 deletions
|
@ -27,16 +27,23 @@ void BookmarkCategory::ReplaceBookmark(size_t index, Bookmark const & bm)
|
|||
ASSERT_LESS ( index, m_bookmarks.size(), () );
|
||||
if (index < m_bookmarks.size())
|
||||
{
|
||||
Bookmark * p = new Bookmark(bm);
|
||||
AssignPrivateParams(index, *p);
|
||||
|
||||
delete m_bookmarks[index];
|
||||
m_bookmarks[index] = new Bookmark(bm);
|
||||
m_bookmarks[index] = p;
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkCategory::AssignTimeStamp(size_t index, Bookmark & bm) const
|
||||
void BookmarkCategory::AssignPrivateParams(size_t index, Bookmark & bm) const
|
||||
{
|
||||
ASSERT_LESS ( index, m_bookmarks.size(), () );
|
||||
if (index < m_bookmarks.size())
|
||||
bm.SetTimeStamp(m_bookmarks[index]->GetTimeStamp());
|
||||
{
|
||||
Bookmark const * p = m_bookmarks[index];
|
||||
bm.SetTimeStamp(p->GetTimeStamp());
|
||||
bm.SetScale(p->GetScale());
|
||||
}
|
||||
}
|
||||
|
||||
BookmarkCategory::~BookmarkCategory()
|
||||
|
|
|
@ -58,6 +58,10 @@ class BookmarkCategory : private noncopyable
|
|||
/// Stores file name from which category was loaded
|
||||
string m_file;
|
||||
|
||||
/// This function is called when bookmark is editing or replacing.
|
||||
/// We need to assign private params to the newly created bookmark from the old one.
|
||||
void AssignPrivateParams(size_t index, Bookmark & bm) const;
|
||||
|
||||
public:
|
||||
BookmarkCategory(string const & name) : m_name(name), m_visible(true) {}
|
||||
~BookmarkCategory();
|
||||
|
@ -68,10 +72,6 @@ public:
|
|||
//@{
|
||||
void AddBookmark(Bookmark const & bm);
|
||||
void ReplaceBookmark(size_t index, Bookmark const & bm);
|
||||
|
||||
/// This function is called when bookmark is editing or replacing.
|
||||
/// We need to assign times to the newly created bookmark from the old one.
|
||||
void AssignTimeStamp(size_t index, Bookmark & bm) const;
|
||||
//@}
|
||||
|
||||
void SetVisible(bool isVisible) { m_visible = isVisible; }
|
||||
|
|
Loading…
Add table
Reference in a new issue