diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-05-16 17:31:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:15:41 +0300 |
commit | 751657cf725436fd5ed74b5f70a6afa80be436c1 (patch) | |
tree | 55497beb3776f42c8e0eda9aa859959f41482953 /map/bookmark.cpp | |
parent | e9f7e1d796d22ba2fab598ab2cd7e3d18d34f010 (diff) |
[core] create new bookmark animation
Diffstat (limited to 'map/bookmark.cpp')
-rw-r--r-- | map/bookmark.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/map/bookmark.cpp b/map/bookmark.cpp index d9e08b81a7..ece60bade1 100644 --- a/map/bookmark.cpp +++ b/map/bookmark.cpp @@ -1,5 +1,12 @@ #include "bookmark.hpp" #include "track.hpp" +#include "anim_phase_chain.hpp" + +#include "framework.hpp" + +#include "../anim/controller.hpp" + +#include "../base/scope_guard.hpp" #include "../graphics/depth_constants.hpp" @@ -19,6 +26,22 @@ #include "../std/algorithm.hpp" #include "../std/auto_ptr.hpp" +graphics::DisplayList * Bookmark::GetDisplayList(UserMarkDLCache * cache) const +{ + return cache->FindUserMark(UserMarkDLCache::Key(GetType(), graphics::EPosAbove, GetContainer()->GetDepth())); +} + +double Bookmark::GetAnimScaleFactor() const +{ + return m_animScaleFactor; +} + +shared_ptr<anim::Task> Bookmark::CreateAnimTask(Framework & fm) +{ + m_animScaleFactor = 0.0; + return CreateDefaultPinAnim(fm, m_animScaleFactor); +} + void BookmarkCategory::AddTrack(Track & track) { m_tracks.push_back(track.CreatePersistent()); @@ -49,6 +72,7 @@ void BookmarkCategory::ReplaceBookmark(size_t index, BookmarkData const & bm) BookmarkCategory::BookmarkCategory(const string & name, Framework & framework) : base_t(graphics::bookmarkDepth, framework) , m_name(name) + , m_blockAnimation(false) { } @@ -493,8 +517,31 @@ string BookmarkCategory::GetDefaultType() return s_arrSupportedColors[0]; } +namespace +{ + struct AnimBlockGuard + { + public: + AnimBlockGuard(bool & block) + : m_block(block) + { + m_block = true; + } + + ~AnimBlockGuard() + { + m_block = false; + } + + private: + bool & m_block; + }; +} + bool BookmarkCategory::LoadFromKML(ReaderPtr<Reader> const & reader) { + AnimBlockGuard g(m_blockAnimation); + ReaderSource<ReaderPtr<Reader> > src(reader); KMLParser parser(*this); if (ParseXML(src, parser, true)) @@ -746,7 +793,10 @@ string BookmarkCategory::GenerateUniqueFileName(const string & path, string name UserMark * BookmarkCategory::AllocateUserMark(m2::PointD const & ptOrg) { - return new Bookmark(ptOrg, this); + Bookmark * b = new Bookmark(ptOrg, this); + if (!m_blockAnimation) + m_framework.GetAnimController()->AddTask(b->CreateAnimTask(m_framework)); + return b; } bool BookmarkCategory::SaveToKMLFile() |