diff options
author | vng <viktor.govako@gmail.com> | 2012-10-10 20:05:27 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:45:08 +0300 |
commit | 12b8678ae3dfe15fe92a5c7590e8e7032d41d8fc (patch) | |
tree | 45cbd1f73266649998f8822331d993254bf47f09 /map/bookmark.hpp | |
parent | 79c59a474a84752ada349261c158dc23db9f1863 (diff) |
Save bookmarks viewport scale when adding.
Diffstat (limited to 'map/bookmark.hpp')
-rw-r--r-- | map/bookmark.hpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/map/bookmark.hpp b/map/bookmark.hpp index b40ac4a5d8..ed52a83cdb 100644 --- a/map/bookmark.hpp +++ b/map/bookmark.hpp @@ -14,8 +14,8 @@ class Bookmark { m2::PointD m_org; string m_name; - /// Now it stores bookmark color - string m_type; + string m_type; ///< Now it stores bookmark color (category style). + double m_scale; ///< Viewport scale. -1.0 - is a default value (no scale set). public: Bookmark() {} @@ -26,9 +26,12 @@ public: m2::PointD GetOrg() const { return m_org; } string const & GetName() const { return m_name; } - /// Now it returns bookmark color + /// @return Now its a bookmark color. string const & GetType() const { return m_type; } m2::RectD GetViewport() const { return m2::RectD(m_org, m_org); } + + double GetScale() const { return m_scale; } + void SetScale(double scale) { m_scale = scale; } }; class BookmarkCategory : private noncopyable @@ -45,32 +48,43 @@ public: void ClearBookmarks(); - void AddBookmark(Bookmark const & bm); + /// @name This function are called from Framework only. + //@{ + void AddBookmark(Bookmark const & bm, double scale); + void ReplaceBookmark(size_t index, Bookmark const & bm, double scale); + //@} void SetVisible(bool isVisible) { m_visible = isVisible; } bool IsVisible() const { return m_visible; } + void SetName(string const & name) { m_name = name; } string GetName() const { return m_name; } string GetFileName() const { return m_file; } inline size_t GetBookmarksCount() const { return m_bookmarks.size(); } + Bookmark const * GetBookmark(size_t index) const; /// @param[in] distance in metres between orgs /// @returns -1 or index of found bookmark int GetBookmark(m2::PointD const org, double const squareDistance) const; + void DeleteBookmark(size_t index); - void ReplaceBookmark(size_t index, Bookmark const & bm); + /// @name This fuctions are public for unit tests only. + /// You don't need to call them from client code. + //@{ void LoadFromKML(ReaderPtr<Reader> const & reader); void SaveToKML(ostream & s); + + /// Uses the same file name from which was loaded, or + /// creates unique file name on first save and uses it every time. + bool SaveToKMLFile(); + /// @return 0 in the case of error static BookmarkCategory * CreateFromKMLFile(string const & file); - /// Uses the same file name from which was loaded, or - /// creates unique file name on first save and uses it every time - /// @param[in] path directory name where to save - bool SaveToKMLFileAtPath(string const & path); static string GenerateUniqueFileName(const string & path, string const & name); + //@} }; /// <category index, bookmark index> |