DALi signals refactor to remove V2 naming
[platform/core/uifw/dali-core.git] / dali / public-api / modeling / entity-animator-map.h
1 #ifndef __DALI_ENTITY_ANIMATOR_MAP_H__
2 #define __DALI_ENTITY_ANIMATOR_MAP_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21
22 // INTERNAL INCLUDES
23 #include <dali/public-api/animation/key-frames.h>
24 #include <dali/public-api/modeling/entity.h>
25
26 namespace Dali
27 {
28
29 class Entity;
30
31 class EntityAnimatorMap;
32 typedef std::vector<EntityAnimatorMap>             EntityAnimatorMapContainer; ///< Container of Entity - Animator mappings
33 typedef EntityAnimatorMapContainer::const_iterator EntityAnimatorMapIter; ///< Iterator for @ref Dali::EntityAnimatorMapContainer
34
35
36 /**
37  * @brief The entity animator map class is a mapping from an entity name to raw animation
38  * data for that entity, stored in 3 KeyFrames for position, scale and rotation.
39  */
40 class DALI_IMPORT_API EntityAnimatorMap
41 {
42 public:
43   /**
44    * @brief Constructor.
45    */
46   EntityAnimatorMap(const std::string& name);
47
48   /**
49    * @brief Destructor.
50    */
51   virtual ~EntityAnimatorMap();
52
53   /**
54    * @brief Set the entity name.
55    *
56    * @param[in] name - the entity name
57    */
58   void SetEntityName(const std::string&  name)
59   {
60     mEntityName = name;
61   }
62
63   /**
64    * @brief Get the entity name.
65    *
66    * @return the name of the entity to which this animator applies
67    */
68   const std::string& GetEntityName() const
69   {
70     return mEntityName;
71   }
72
73   /**
74    * @brief Set the animated entity.
75    *
76    * @param[in] animatedEntity The animated entity
77    */
78   void SetAnimatedEntity(Entity animatedEntity)
79   {
80     mAnimatedEntity = animatedEntity;
81   }
82
83   /**
84    * @brief Get the animated entity.
85    *
86    * @return the animated entity
87    */
88   Entity GetAnimatedEntity(void)
89   {
90     return mAnimatedEntity;
91   }
92
93   /**
94    * @brief Set the key frames for animating the entity position.
95    *
96    * @param[in] keyFrames The keyframe data
97    */
98   void SetPositionKeyFrames(KeyFrames keyFrames)
99   {
100     mPositionKeyFrames = keyFrames;
101   }
102
103   /**
104    * @brief Set the key frames for animating the entity scale.
105    *
106    * @param[in] keyFrames The keyframe data
107    */
108   void SetScaleKeyFrames(KeyFrames keyFrames)
109   {
110     mScaleKeyFrames = keyFrames;
111   }
112
113   /**
114    * @brief Set the key frames for animating the entity rotation.
115    *
116    * @param[in] keyFrames The keyframe data
117    */
118   void SetRotationKeyFrames(KeyFrames keyFrames)
119   {
120     mRotationKeyFrames = keyFrames;
121   }
122
123   /**
124    * @brief Get the keyframes for animating the entity position.
125    *
126    * @return A handle to the keyframes
127    */
128   KeyFrames GetPositionKeyFrames() const
129   {
130     return mPositionKeyFrames;
131   }
132
133   /**
134    * @brief Get the keyframes for animating the entity scale.
135    *
136    * @return A handle to the keyframes
137    */
138   KeyFrames GetScaleKeyFrames() const
139   {
140     return mScaleKeyFrames;
141   }
142
143   /**
144    * @brief Get the keyframes for animating the entity rotation.
145    *
146    * @return A handle to the keyframes
147    */
148   KeyFrames GetRotationKeyFrames() const
149   {
150     return mRotationKeyFrames;
151   }
152
153   /**
154    * @brief Set the duration of the animation on this entity.
155    *
156    * @param[in] duration - the duration in seconds.
157    */
158   void SetDuration(float duration) { mDuration = duration; }
159
160   /**
161    * @brief Get the duration of the animation on this entity.
162    *
163    * @return the duration in seconds
164    */
165   float GetDuration() const { return mDuration; }
166
167 private:
168   std::string   mEntityName;          ///< The entity name
169   Entity        mAnimatedEntity;      ///< Unused
170   float         mDuration;            ///< Duration of this animator
171
172   KeyFrames     mPositionKeyFrames;   ///< Position key frames (may be null)
173   KeyFrames     mScaleKeyFrames;      ///< Scale key frames (may be null)
174   KeyFrames     mRotationKeyFrames;   ///< Rotation key frames (may be null)
175 };
176
177
178 } // Dali
179
180 #endif // __DALI_ENTITY_ANIMATOR_MAP_H__