Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / FUiEffects_PeSpringSurface.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18 * @file        FUiEffects_PeSpringSurface.h
19 * @brief       This is the header file for the SpringSurface class
20 */
21
22 #ifndef _FUI_EFFECTS_INTERNAL_PE_SPRINGSURFACE_H_
23 #define _FUI_EFFECTS_INTERNAL_PE_SPRINGSURFACE_H_
24 #pragma once
25
26 #include "FUiEffects_PeElementSurface.h"
27 #include "FUiEffects_PePointSurface.h"
28
29 namespace Tizen { namespace Ui { namespace Effects { namespace _PhysicsEngine
30 {
31
32 /**
33  * @class       SpringSurface
34  * @brief       Class for physical element: spring
35  *
36  * @since 2.0
37  *
38  */
39 class SpringSurface
40         : public ElementSurface
41 {
42
43 public:
44         /**
45          * SpringSurface class constructor
46          *
47          * @since 2.0
48          *
49          * @param[in]   objId           physical element's id
50          * @param[in]   stiffness       spring coefficient of rigidity
51          * @param[in]   pPoint1         pointer to connected point 1
52          * @param[in]   pPoint2         pointer to connected point 2
53          *
54          */
55         SpringSurface(
56                 long objId,
57                 float stiffness,
58                 PointSurface* pPoint1,
59                 PointSurface* pPoint2
60         );
61
62         /**
63          * Class destructor
64          *
65          * @since 2.0
66          *
67          */
68         virtual ~SpringSurface(void);
69
70         /**
71          * @brief               Gets object's type
72          * @return              enum value that corresponds to object's type
73          *
74          */
75         virtual Tizen::Ui::Effects::_Runtime::ESurface GetType(void) const;
76
77         /**
78          * Sets object into the initial state
79          *
80          * @since 2.0
81          *
82          */
83         virtual void Initialize(void);
84
85         /**
86          * Performs simulation step with given delta time
87          *
88          * @since 2.0
89          *
90          * @param[in]   timeStep        simulation time step
91          *
92          */
93         virtual void Calculate(float timeStep);
94
95         /**
96          * Gets element property value
97          *
98          * @since 2.0
99          *
100          * @return              struct that contains property type and value
101          * @param[in]   property enum value for necessary property
102          *
103          */
104         virtual Tizen::Ui::Effects::_Runtime::PropertyCast GetProperty(
105                 Tizen::Ui::Effects::_Runtime::ElementProperty property
106         ) const;
107
108         /**
109          * Sets element bool property values
110          *
111          * @since 2.0
112          *
113          * @return              true if set successful, false if failed
114          * @param[in]   property        property name
115          * @param[in]   boolValue       new bool value for property
116          *
117          */
118         virtual bool SetProperty(
119                 Tizen::Ui::Effects::_Runtime::ElementProperty property,
120                 bool boolValue
121         );
122
123         /**
124          * Sets element numeric property values
125          *
126          * @since 2.0
127          *
128          * @return              true if set successful, false if failed
129          * @param[in]   property                property name
130          * @param[in]   numericValue    new numeric value for property
131          *
132          */
133         virtual bool SetProperty(
134                 Tizen::Ui::Effects::_Runtime::ElementProperty property,
135                 LUA_NUMBER numericValue
136         );
137
138         /**
139          * Sets element vector property values
140          *
141          * @since 2.0
142          *
143          * @return              true if set successful, false if failed
144          * @param[in]   property                property name
145          * @param[in]   vectorValue     new vector value for property
146          *
147          */
148         virtual bool SetProperty(
149                 Tizen::Ui::Effects::_Runtime::ElementProperty property,
150                 const Tizen::Ui::Effects::_Utils::Vec3f& vectorValue
151         );
152
153 protected:
154
155 private:
156         // internal init method
157         void InitSpring(void);
158
159 public:
160
161 protected:
162
163 private:
164         // initial values
165         const float __stiffnessInit;    // Initial spring coefficient of rigidity
166
167         // simulation values
168         float __restLength;                     // Length of the unstrained spring
169         float __stiffness;                      // Spring coefficient of rigidity
170
171         // points that are connected by spring
172         PointSurface* __pPoint1;
173         PointSurface* __pPoint2;
174
175 };      // SpringSurface
176
177 } } } } // Tizen::Ui::Effects::_PhysicsEngine
178
179 #endif //_FUI_EFFECTS_INTERNAL_PE_SPRINGSURFACE_H_