Remove a dead virtual method from proxy object
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / path-impl.h
1 #ifndef __DALI_INTERNAL_PATH_H__
2 #define __DALI_INTERNAL_PATH_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 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/path.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/math/matrix.h>
25 #include <dali/public-api/common/dali-vector.h>
26 #include <dali/internal/event/common/proxy-object.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33 typedef IntrusivePtr<Path> PathPtr;
34
35 /**
36  * A 3D path
37  */
38 class Path : public ProxyObject
39 {
40 public:
41
42   /**
43    * Construct a new path
44    */
45   static Path* New();
46
47   /**
48    * Constructor
49    */
50   Path();
51
52
53 protected:
54   /**
55    * virtual destructor
56    */
57   virtual ~Path();
58
59 private:
60   /**
61    * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
62    */
63   virtual void SceneObjectAdded(ProxyObject& proxy){}
64
65   /**
66    * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
67    */
68   virtual void SceneObjectRemoved(ProxyObject& proxy){}
69
70   /**
71    * @copydoc Dali::Internal::ProxyObject::Observer::ProxyDestroyed()
72    */
73   virtual void ProxyDestroyed(ProxyObject& proxy){}
74
75   /**
76    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
77    */
78   virtual unsigned int GetDefaultPropertyCount() const;
79
80   /**
81    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
82    */
83   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
84
85   /**
86    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
87    */
88   virtual const char* GetDefaultPropertyName(Property::Index index) const;
89
90   /**
91    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
92    */
93   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
94
95   /**
96    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
97    */
98   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
99
100   /**
101    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
102    */
103   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
104
105   /**
106    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
107    */
108   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
109
110   /**
111    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
112    */
113   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
114
115   /**
116    * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
117    */
118   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
119
120    /**
121    * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
122    */
123   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
124
125   /**
126    * @copydoc Dali::Internal::ProxyObject::InstallSceneObjectProperty()
127    */
128   virtual void InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index ){}
129
130   /**
131    * @copydoc Dali::Internal::ProxyObject::GetSceneObject()
132    */
133   virtual const SceneGraph::PropertyOwner* GetSceneObject() const{ return NULL; }
134
135   /**
136    * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
137    */
138   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const{ return NULL; }
139
140   /**
141    * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
142    */
143   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const{ return NULL; }
144
145 public:
146
147   /**
148    * Returns a clone to the given path
149    */
150   static Path* Clone(const Path& path);
151
152   /**
153    * @copydoc Dali::Path::AddPoint
154    */
155   void AddPoint(const Vector3& point );
156
157   /**
158    * @copydoc Dali::Path::AddControlPoint
159    */
160   void AddControlPoint(const Vector3& point );
161
162   /**
163    * @copydoc Dali::Path::GenerateControlPoints
164    */
165   void GenerateControlPoints( float curvature );
166
167   /**
168    * @copydoc Dali::Path::Sample
169    */
170   void Sample( float t, Vector3& position, Vector3& tangent ) const;
171
172   /**
173    * Sample position at point t.
174    *
175    * @param[in] progress  A floating point value between 0.0 and 1.0.
176    * @param[out] position The interpolated position at that progress.
177    */
178   Vector3 SamplePosition( float t ) const;
179
180   /**
181    * @brief Sample tangent at point t.
182    *
183    * @param[in] progress  A floating point value between 0.0 and 1.0.
184    * @param[out] tangent The interpolated tangent at that progress.
185    */
186   Vector3 SampleTangent( float t ) const;
187
188   /**
189    * @copydoc Dali::Path::GetPoint
190    */
191   Vector3& GetPoint( size_t index );
192
193   /**
194    * @copydoc Dali::Path::GetControlPoint
195    */
196   Vector3& GetControlPoint( size_t index );
197
198   /**
199    * @copydoc Dali::Path::GetPointCount
200    */
201   size_t GetPointCount() const;
202
203   /**
204    * @brief Get mPoint property
205    *
206    * @return A const reference to mPoint vector
207    */
208   const Dali::Vector<Vector3>& GetPoints() const{ return mPoint; }
209
210   /*
211    * @brief Set mPoint
212    *
213    * @param[in] p New value for mPoint property
214    */
215   void SetPoints( const Dali::Vector<Vector3>& p ){ mPoint = p; }
216
217   /**
218    * @brief Get mCotrolPoint property
219    *
220    * @return A const reference to mControlPoint vector
221    */
222   const Dali::Vector<Vector3>& GetControlPoints() const{ return mControlPoint; }
223
224   /*
225    * @brief Set mControlPoint property
226    *
227    * @param[in] p New value for mControlPoint property
228    */
229   void SetControlPoints( const Dali::Vector<Vector3>& p ){ mControlPoint = p; }
230
231 private:
232
233   /**
234    * Undefined
235    */
236   Path(const Path& p);
237
238   /**
239    * Undefined
240    */
241   Path& operator=(const Path& rhs);
242
243   /**
244    * Helper function to calculate the segment and local progress in that segment
245    * given a progress
246    *
247    * @param[in] t Progress
248    * @param[out] segment Segment for t
249    * @param[out] tLocal Local progress in the segment
250    *
251    */
252   void FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal ) const;
253
254   /**
255    * Helper function to calculate to number of segments in the path
256    */
257   unsigned int GetNumberOfSegments() const;
258
259   Dali::Vector<Vector3> mPoint;            ///< Interpolation points
260   Dali::Vector<Vector3> mControlPoint;     ///< Control points
261 };
262
263 } // Internal
264
265 // Get impl of handle
266 inline Internal::Path& GetImplementation(Dali::Path& path)
267 {
268   DALI_ASSERT_ALWAYS( path && "Path handle is empty" );
269   Dali::RefObject& object = path.GetBaseObject();
270   return static_cast<Internal::Path&>(object);
271 }
272
273 inline const Internal::Path& GetImplementation(const Dali::Path& path)
274 {
275   DALI_ASSERT_ALWAYS( path && "Path handle is empty" );
276   const Dali::RefObject& object = path.GetBaseObject();
277   return static_cast<const Internal::Path&>(object);
278 }
279
280
281 } // Dali
282
283 #endif //__DALI_INTERNAL_KEY_FRAMES_H__