2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnimRotateAnimation.cpp
20 * @brief This file contains implementation of RotateAnimation class
22 * This file contains implementation of RotateAnimation class.
25 #include <FBaseSysLog.h>
26 #include <FBaseColHashMapT.h>
28 #include <FUiAnimRotateAnimation.h>
30 #include "FUiAnim_RotateAnimationImpl.h"
31 #include "FUiAnim_AnimationBaseImpl.h"
32 #include "FUiAnim_FloatAnimationImpl.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::Ui::Animations;
37 using namespace Tizen::Base::Collection;
40 namespace Tizen { namespace Ui { namespace Animations
43 RotateAnimation::RotateAnimation(void)
44 : _pRotateAnimationImpl(null)
48 RotateAnimation::RotateAnimation(float startValue, float endValue, long duration, AnimationInterpolatorType interpolator)
49 : FloatAnimation(startValue, endValue, duration, interpolator)
50 , _pRotateAnimationImpl(null)
52 result r = GetLastResult();
53 SysTryReturnVoidResult(NID_UI_ANIM, (_pAnimationBaseImpl), r, "[%s] Propagating.", GetErrorMessage(r));
55 _pRotateAnimationImpl = new (std::nothrow) _RotateAnimationImpl(this);
56 if (_pRotateAnimationImpl == null)
58 SysLogException(NID_UI_ANIM, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
60 delete _pFloatAnimationImpl;
61 _pFloatAnimationImpl = null;
63 delete _pAnimationBaseImpl;
64 _pAnimationBaseImpl = null;
72 RotateAnimation::~RotateAnimation(void)
74 delete _pRotateAnimationImpl;
75 _pRotateAnimationImpl = null;
78 RotateAnimation::RotateAnimation(const RotateAnimation& rotateAnimation)
79 : FloatAnimation(rotateAnimation)
80 , _pRotateAnimationImpl(null)
82 result r = GetLastResult();
83 SysTryReturnVoidResult(NID_UI_ANIM, (_pAnimationBaseImpl), r, "[%s] Propagating.", GetErrorMessage(r));
85 _pRotateAnimationImpl = new (std::nothrow) _RotateAnimationImpl(this);
86 SysTryCatch(NID_UI_ANIM, (_pRotateAnimationImpl != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
88 rotateAnimation.GetAnchor(_pRotateAnimationImpl->anchorX, _pRotateAnimationImpl->anchorY);
93 delete _pAnimationBaseImpl;
94 _pAnimationBaseImpl = null;
95 delete _pFloatAnimationImpl;
96 _pFloatAnimationImpl = null;
100 RotateAnimation::operator =(const RotateAnimation& rhs)
106 FloatAnimation::operator =(rhs);
108 rhs.GetAnchor(_pRotateAnimationImpl->anchorX, _pRotateAnimationImpl->anchorY);
115 RotateAnimation::operator ==(const RotateAnimation& rhs) const
117 if (!(FloatAnimation::operator ==(rhs)))
122 if (Float::Compare(_pRotateAnimationImpl->anchorX, rhs._pRotateAnimationImpl->anchorX) != 0 ||
123 Float::Compare(_pRotateAnimationImpl->anchorY, rhs._pRotateAnimationImpl->anchorY) != 0)
132 RotateAnimation::operator !=(const RotateAnimation& rhs) const
134 return !(*this == rhs);
138 RotateAnimation::Equals(const Tizen::Base::Object& rhs) const
140 const RotateAnimation* pRotateAnim = dynamic_cast< const RotateAnimation* >(&rhs);
141 if (pRotateAnim == null)
146 return (*this == *pRotateAnim);
150 RotateAnimation::GetHashCode(void) const
152 return (((int) GetRepeatCount()) + ((int) GetOffset()) + ((int) GetDuration()) + ((int) GetDelay()));
156 RotateAnimation::SetAnchor(float anchorX, float anchorY)
158 SysTryReturnResult(NID_UI_ANIM, (anchorX >= 0.0 && anchorX <= 1.0 && anchorY >= 0.0 && anchorY <= 1.0), E_INVALID_ARG, "Invalid argument(s) is used. anchorX = %f, anchorX= %f.", anchorX, anchorY);
160 _pRotateAnimationImpl->anchorX = anchorX;
161 _pRotateAnimationImpl->anchorY = anchorY;
167 RotateAnimation::GetAnchor(float& anchorX, float& anchorY) const
169 anchorX = _pRotateAnimationImpl->anchorX;
170 anchorY = _pRotateAnimationImpl->anchorY;
176 RotateAnimation::GetType(void) const
178 return ANIMATION_TYPE_ROTATE_ANIMATION;
181 }}} // Tizen::Ui::Animations