Dali 3D User Interface Engine
path-impl.h
Go to the documentation of this file.
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
27 
28 namespace Dali
29 {
30 
31 namespace Internal
32 {
34 
38 class Path : public Object
39 {
40 public:
41 
45  static Path* New();
46 
50  Path();
51 
52 
53 protected:
57  virtual ~Path();
58 
59 private:
63  virtual void SceneObjectAdded(Object& object){}
64 
68  virtual void SceneObjectRemoved(Object& object){}
69 
73  virtual void ObjectDestroyed(Object& object){}
74 
78  virtual unsigned int GetDefaultPropertyCount() const;
79 
83  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
84 
88  virtual const char* GetDefaultPropertyName(Property::Index index) const;
89 
93  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
94 
98  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
99 
103  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
104 
108  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
109 
114 
118  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
119 
123  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
124 
128  virtual const SceneGraph::PropertyOwner* GetSceneObject() const{ return NULL; }
129 
133  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const{ return NULL; }
134 
138  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const{ return NULL; }
139 
140 public:
141 
145  static Path* Clone(const Path& path);
146 
150  void AddPoint(const Vector3& point );
151 
155  void AddControlPoint(const Vector3& point );
156 
160  void GenerateControlPoints( float curvature );
161 
165  void Sample( float t, Vector3& position, Vector3& tangent ) const;
166 
175  bool SampleAt( float t, Vector3& position, Vector3& tangent ) const;
176 
184  bool SamplePosition( float t, Vector3& position ) const;
185 
193  bool SampleTangent( float t, Vector3& tangent ) const;
194 
198  Vector3& GetPoint( size_t index );
199 
203  Vector3& GetControlPoint( size_t index );
204 
208  size_t GetPointCount() const;
209 
213  void ClearPoints();
214 
218  void ClearControlPoints();
219 
225  const Dali::Vector<Vector3>& GetPoints() const{ return mPoint; }
226 
227  /*
228  * @brief Set mPoint
229  *
230  * @param[in] p New value for mPoint property
231  */
232  void SetPoints( const Dali::Vector<Vector3>& p ){ mPoint = p; }
233 
240 
241  /*
242  * @brief Set mControlPoint property
243  *
244  * @param[in] p New value for mControlPoint property
245  */
247 
248 private:
249 
253  Path(const Path& p);
254 
258  Path& operator=(const Path& rhs);
259 
269  void FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal ) const;
270 
274  unsigned int GetNumberOfSegments() const;
275 
278 };
279 
280 } // Internal
281 
282 // Get impl of handle
284 {
285  DALI_ASSERT_ALWAYS( path && "Path handle is empty" );
286  Dali::RefObject& object = path.GetBaseObject();
287  return static_cast<Internal::Path&>(object);
288 }
289 
290 inline const Internal::Path& GetImplementation(const Dali::Path& path)
291 {
292  DALI_ASSERT_ALWAYS( path && "Path handle is empty" );
293  const Dali::RefObject& object = path.GetBaseObject();
294  return static_cast<const Internal::Path&>(object);
295 }
296 
297 
298 } // Dali
299 
300 #endif //__DALI_INTERNAL_KEY_FRAMES_H__
Dali Docs Home
Read more about Dali