From 158ff90c8afde03626280a7a7c839044d1761bed Mon Sep 17 00:00:00 2001 From: Siarhei Rachytski Date: Mon, 1 Oct 2012 12:51:35 +0300 Subject: [PATCH] added ChangeViewportTask for Viewport animation. --- map/change_viewport_task.cpp | 26 ++++++++++++++++++++++++++ map/change_viewport_task.hpp | 23 +++++++++++++++++++++++ map/map.pro | 8 ++++++-- 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 map/change_viewport_task.cpp create mode 100644 map/change_viewport_task.hpp diff --git a/map/change_viewport_task.cpp b/map/change_viewport_task.cpp new file mode 100644 index 0000000000..624e070595 --- /dev/null +++ b/map/change_viewport_task.cpp @@ -0,0 +1,26 @@ +#include "change_viewport_task.hpp" +#include "framework.hpp" + +ChangeViewportTask::ChangeViewportTask(m2::AnyRectD const & startRect, + m2::AnyRectD const & endRect, + double rotationSpeed, + Framework *framework) + : anim::AnyRectInterpolation(startRect, + endRect, + rotationSpeed, + m_outRect), + m_framework(framework) +{ +} + +void ChangeViewportTask::OnStep(double ts) +{ + anim::AnyRectInterpolation::OnStep(ts); + m_framework->GetNavigator().SetFromRect(m_outRect); +} + +void ChangeViewportTask::OnEnd(double ts) +{ + anim::AnyRectInterpolation::OnEnd(ts); + m_framework->GetNavigator().SetFromRect(m_outRect); +} diff --git a/map/change_viewport_task.hpp b/map/change_viewport_task.hpp new file mode 100644 index 0000000000..6f662169dd --- /dev/null +++ b/map/change_viewport_task.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include "../anim/anyrect_interpolation.hpp" + +class Framework; + +class ChangeViewportTask : public anim::AnyRectInterpolation +{ +private: + + Framework * m_framework; + m2::AnyRectD m_outRect; + +public: + + ChangeViewportTask(m2::AnyRectD const & startRect, + m2::AnyRectD const & endRect, + double rotationSpeed, + Framework * framework); + + void OnStep(double ts); + void OnEnd(double ts); +}; diff --git a/map/map.pro b/map/map.pro index 9de0b02079..020cd39eae 100644 --- a/map/map.pro +++ b/map/map.pro @@ -52,7 +52,8 @@ HEADERS += \ compass_arrow.hpp \ compass_filter.hpp \ animator.hpp \ - move_screen_task.hpp + move_screen_task.hpp \ + change_viewport_task.hpp \ SOURCES += \ feature_vec_model.cpp \ @@ -96,7 +97,8 @@ SOURCES += \ compass_arrow.cpp \ compass_filter.cpp \ animator.cpp \ - move_screen_task.cpp + move_screen_task.cpp \ + change_viewport_task.cpp \ !iphone*:!bada*:!android* { HEADERS += qgl_render_context.hpp @@ -117,3 +119,5 @@ SOURCES += \ + +