2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.ComponentModel;
25 /// A 3D parametric curve.<br />
26 /// Paths can be used to animate the position and orientation of actors.<br />
28 /// <since_tizen> 3 </since_tizen>
29 public class Path : BaseHandle
31 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34 /// Creates an initialized path handle.
36 /// <since_tizen> 3 </since_tizen>
37 public Path() : this(NDalicPINVOKE.Path_New(), true)
39 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
43 internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Path_SWIGUpcast(cPtr), cMemoryOwn)
45 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
50 /// Enumeration for the Points.
52 /// <since_tizen> 3 </since_tizen>
53 public PropertyArray Points
57 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
58 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp);
63 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value));
68 /// Enumeration for the ControlPoints.
70 /// <since_tizen> 3 </since_tizen>
71 public PropertyArray ControlPoints
75 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
76 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.CONTROL_POINTS).Get(temp);
81 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
86 /// Adds an interpolation point.
88 /// <param name="point">The new interpolation point to be added.</param>
89 /// <since_tizen> 3 </since_tizen>
90 public void AddPoint(Position point)
92 NDalicPINVOKE.Path_AddPoint(swigCPtr, Position.getCPtr(point));
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// Adds a control point.
99 /// <param name="point">The new control point to be added.</param>
100 /// <since_tizen> 3 </since_tizen>
101 public void AddControlPoint(Vector3 point)
103 NDalicPINVOKE.Path_AddControlPoint(swigCPtr, Vector3.getCPtr(point));
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 /// Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.<br />
109 /// The generating algorithm is as follows:<br />
110 /// For a given knot point K[N], find the vector that bisects K[N-1],[N] and [N],[N+1].<br />
111 /// Calculate the tangent vector by taking the normal of this bisector.<br />
112 /// The in control point is the length of the preceding segment back along this bisector multiplied by the curvature.<br />
113 /// The out control point is the length of the succeeding segment forward along this bisector multiplied by the curvature.<br />
115 /// <param name="curvature">The curvature of the spline. 0 gives straight lines between the knots, negative values means the spline contains loops, positive values up to 0.5 result in a smooth curve, positive values between 0.5 and 1 result in looped curves where the loops are not distinct (i.e., the curve appears to be non-continuous), positive values higher than 1 result in looped curves.</param>
116 /// <since_tizen> 3 </since_tizen>
117 public void GenerateControlPoints(float curvature)
119 NDalicPINVOKE.Path_GenerateControlPoints(swigCPtr, curvature);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 /// Sample path at a given progress. Calculates the position and tangent at that point of the curve.
126 /// <param name="progress">A floating point value between 0.0 and 1.0.</param>
127 /// <param name="position">The interpolated position at that progress.</param>
128 /// <param name="tangent">The interpolated tangent at that progress.</param>
129 /// <since_tizen> 3 </since_tizen>
130 public void Sample(float progress, Vector3 position, Vector3 tangent)
132 NDalicPINVOKE.Path_Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent));
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 /// An accessor for the interpolation points.
139 /// <param name="index">The index of the interpolation point.</param>
140 /// <since_tizen> 3 </since_tizen>
141 public Vector3 GetPoint(uint index)
143 Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetPoint(swigCPtr, index), false);
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 /// An accessor for the control points.
151 /// <param name="index">The index of the control point.</param>
152 /// <since_tizen> 3 </since_tizen>
153 public Vector3 GetControlPoint(uint index)
155 Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetControlPoint(swigCPtr, index), false);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// Gets the number of interpolation points in the path.
163 /// <returns>The number of interpolation points in the path.</returns>
164 /// <since_tizen> 3 </since_tizen>
165 public uint GetPointCount()
167 uint ret = NDalicPINVOKE.Path_GetPointCount(swigCPtr);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj)
174 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
180 /// <param name="type">The dispoase type</param>
181 /// <since_tizen> 3 </since_tizen>
182 protected override void Dispose(DisposeTypes type)
189 if (type == DisposeTypes.Explicit)
192 //Release your own managed resources here.
193 //You should release all of your own disposable objects here.
196 //Release your own unmanaged resources here.
197 //You should not access any managed member here except static instance.
198 //because the execution order of Finalizes is non-deterministic.
200 if (swigCPtr.Handle != global::System.IntPtr.Zero)
205 NDalicPINVOKE.delete_Path(swigCPtr);
207 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
213 internal class Property
215 internal static readonly int POINTS = NDalicPINVOKE.Path_Property_POINTS_get();
216 internal static readonly int CONTROL_POINTS = NDalicPINVOKE.Path_Property_CONTROL_POINTS_get();