-#ifndef __DALI_INTERNAL_PATH_H__
-#define __DALI_INTERNAL_PATH_H__
+#ifndef DALI_INTERNAL_PATH_H
+#define DALI_INTERNAL_PATH_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/common/dali-vector.h>
-#include <dali/internal/event/common/proxy-object.h>
+#include <dali/internal/event/common/object-impl.h>
namespace Dali
{
namespace Internal
{
-typedef IntrusivePtr<Path> PathPtr;
+using PathPtr = IntrusivePtr<Path>;
/**
* A 3D path
*/
-class Path : public ProxyObject
+class Path : public Object
{
public:
/**
* virtual destructor
*/
- virtual ~Path();
+ ~Path() override;
private:
- /**
- * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
- */
- virtual void SceneObjectAdded(ProxyObject& proxy){}
-
- /**
- * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
- */
- virtual void SceneObjectRemoved(ProxyObject& proxy){}
-
- /**
- * @copydoc Dali::Internal::ProxyObject::Observer::ProxyDestroyed()
- */
- virtual void ProxyDestroyed(ProxyObject& proxy){}
-
- /**
- * @copydoc Dali::Internal::ProxyObject::IsSceneObjectRemovable()
- */
- virtual bool IsSceneObjectRemovable() const{ return false;}
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
- */
- virtual unsigned int GetDefaultPropertyCount() const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
- */
- virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
- */
- virtual const char* GetDefaultPropertyName(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
- */
- virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
/**
- * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
+ * @copydoc Dali::Internal::Object::SetDefaultProperty()
*/
- virtual bool IsDefaultPropertyWritable(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
- */
- virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
- */
- virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
- */
- virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
- */
- virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
+ void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue) override;
/**
- * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
- */
- virtual Property::Value GetDefaultProperty( Property::Index index ) const;
-
- /**
- * @copydoc Dali::Internal::ProxyObject::InstallSceneObjectProperty()
+ * @copydoc Dali::Internal::Object::GetDefaultProperty()
*/
- virtual void InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index ){}
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetSceneObject()
- */
- virtual const SceneGraph::PropertyOwner* GetSceneObject() const{ return NULL; }
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
- */
- virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const{ return NULL; }
-
- /**
- * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
- */
- virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const{ return NULL; }
+ Property::Value GetDefaultProperty( Property::Index index ) const override;
public:
void Sample( float t, Vector3& position, Vector3& tangent ) const;
/**
+ * @brief Sample path at a given progress. Calculates position and tangent at that point of the curve
+ *
+ * @param[in] progress A floating point value between 0.0 and 1.0.
+ * @param[out] position The interpolated position at that progress.
+ * @param[out] tangent The interpolated tangent at that progress.
+ * @return true if Sample could be calculated
+ */
+ bool SampleAt( float t, Vector3& position, Vector3& tangent ) const;
+
+ /**
* Sample position at point t.
*
* @param[in] progress A floating point value between 0.0 and 1.0.
* @param[out] position The interpolated position at that progress.
+ * @return true if sample could be calculated
*/
- Vector3 SamplePosition( float t ) const;
+ bool SamplePosition( float t, Vector3& position ) const;
/**
* @brief Sample tangent at point t.
*
* @param[in] progress A floating point value between 0.0 and 1.0.
* @param[out] tangent The interpolated tangent at that progress.
+ * @return true if sample could be calculated
*/
- Vector3 SampleTangent( float t ) const;
+ bool SampleTangent( float t, Vector3& tangent ) const;
/**
* @copydoc Dali::Path::GetPoint
*/
- Vector3& GetPoint( size_t index );
+ Vector3& GetPoint( uint32_t index );
/**
* @copydoc Dali::Path::GetControlPoint
*/
- Vector3& GetControlPoint( size_t index );
+ Vector3& GetControlPoint( uint32_t index );
/**
* @copydoc Dali::Path::GetPointCount
*/
- size_t GetPointCount() const;
+ uint32_t GetPointCount() const;
+
+ /**
+ * Clears the points of the path
+ */
+ void ClearPoints();
+
+ /**
+ * Clears the control points of the path
+ */
+ void ClearControlPoints();
/**
* @brief Get mPoint property
* @param[out] tLocal Local progress in the segment
*
*/
- void FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal ) const;
+ void FindSegmentAndProgress( float t, uint32_t& segment, float& tLocal ) const;
/**
* Helper function to calculate to number of segments in the path
*/
- unsigned int GetNumberOfSegments() const;
+ uint32_t GetNumberOfSegments() const;
Dali::Vector<Vector3> mPoint; ///< Interpolation points
Dali::Vector<Vector3> mControlPoint; ///< Control points
} // Dali
-#endif //__DALI_INTERNAL_KEY_FRAMES_H__
+#endif // DALI_INTERNAL_PATH_H