forked from organicmaps/organicmaps
[core] Added MoveBookmark function
This commit is contained in:
parent
086b440785
commit
525dcd07aa
4 changed files with 26 additions and 4 deletions
|
@ -192,6 +192,19 @@ size_t BookmarkManager::AddBookmark(size_t categoryIndex, const m2::PointD & ptO
|
|||
return (pCat->GetBookmarksCount() - 1);
|
||||
}
|
||||
|
||||
size_t BookmarkManager::MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex)
|
||||
{
|
||||
BookmarkCategory * cat = m_framework.GetBmCategory(curCatIndex);
|
||||
|
||||
Bookmark * bm = cat->GetBookmark(bmIndex);
|
||||
Bookmark bmCopy = Bookmark(*bm);
|
||||
|
||||
cat->DeleteBookmark(bmIndex);
|
||||
cat->SaveToKMLFile();
|
||||
|
||||
return m_framework.AddBookmark(newCatIndex, bmCopy);
|
||||
}
|
||||
|
||||
void BookmarkManager::ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm)
|
||||
{
|
||||
BookmarkCategory * pCat = m_categories[catIndex];
|
||||
|
|
|
@ -40,7 +40,9 @@ public:
|
|||
void LoadBookmark(string const & filePath);
|
||||
|
||||
/// Client should know where it adds bookmark
|
||||
size_t AddBookmark(size_t categoryIndex, m2::PointD const & ptOrg, BookmarkData & bm);
|
||||
size_t AddBookmark(size_t categoryIndex, BookmarkData & bm);
|
||||
/// Client should know where it moves bookmark
|
||||
size_t MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex);
|
||||
void ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm);
|
||||
|
||||
size_t LastEditedBMCategory();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "framework.hpp"
|
||||
#include "framework.hpp"
|
||||
#include "feature_processor.hpp"
|
||||
#include "drawer.hpp"
|
||||
#include "benchmark_provider.hpp"
|
||||
|
@ -341,7 +341,12 @@ size_t Framework::AddBookmark(size_t categoryIndex, const m2::PointD & ptOrg, Bo
|
|||
return m_bmManager.AddBookmark(categoryIndex, ptOrg, bm);
|
||||
}
|
||||
|
||||
void Framework::ReplaceBookmark(size_t catIndex, size_t bmIndex, const BookmarkData & bm)
|
||||
size_t Framework::MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex)
|
||||
{
|
||||
return m_bmManager.MoveBookmark(bmIndex, curCatIndex, newCatIndex);
|
||||
}
|
||||
|
||||
void Framework::ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm)
|
||||
{
|
||||
m_bmManager.ReplaceBookmark(catIndex, bmIndex, bm);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,9 @@ public:
|
|||
void LoadBookmarks();
|
||||
|
||||
/// @return Created bookmark index in category.
|
||||
size_t AddBookmark(size_t categoryIndex, m2::PointD const & ptOrg, BookmarkData & bm);
|
||||
size_t AddBookmark(size_t categoryIndex, BookmarkData & bm);
|
||||
/// @return New moved bookmark index in category.
|
||||
size_t MoveBookmark(size_t bmIndex, size_t curCatIndex, size_t newCatIndex);
|
||||
void ReplaceBookmark(size_t catIndex, size_t bmIndex, BookmarkData const & bm);
|
||||
/// @return Created bookmark category index.
|
||||
size_t AddCategory(string const & categoryName);
|
||||
|
|
Loading…
Add table
Reference in a new issue