sync with devel/master branch
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Path.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     /// <summary>
31     /// A 3D parametric curve.<br>
32     /// Paths can be used to animate position and orientation of actors.<br>
33     /// </summary> 
34     public class Path : BaseHandle
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Path_SWIGUpcast(cPtr), cMemoryOwn)
39         {
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41         }
42
43         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj)
44         {
45             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46         }
47
48         protected override void Dispose(DisposeTypes type)
49         {
50             if(disposed)
51             {
52                 return;
53             }
54
55             if(type == DisposeTypes.Explicit)
56             {
57                 //Called by User
58                 //Release your own managed resources here.
59                 //You should release all of your own disposable objects here.
60             }
61
62             //Release your own unmanaged resources here.
63             //You should not access any managed member here except static instance.
64             //because the execution order of Finalizes is non-deterministic.
65
66             if (swigCPtr.Handle != global::System.IntPtr.Zero)
67             {
68                 if (swigCMemOwn)
69                 {
70                     swigCMemOwn = false;
71                     NDalicPINVOKE.delete_Path(swigCPtr);
72                 }
73                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74             }
75
76             base.Dispose(type);
77         }
78
79
80         internal class Property : global::System.IDisposable
81         {
82             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
83             protected bool swigCMemOwn;
84
85             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
86             {
87                 swigCMemOwn = cMemoryOwn;
88                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
89             }
90
91             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
92             {
93                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
94             }
95
96             //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) 
97
98             //A Flag to check who called Dispose(). (By User or DisposeQueue)
99             private bool isDisposeQueued = false;
100             //A Flat to check if it is already disposed.
101             protected bool disposed = false;
102
103             ~Property()
104             {
105                 if(!isDisposeQueued)
106                 {
107                     isDisposeQueued = true;
108                     DisposeQueue.Instance.Add(this);
109                 }
110             }
111
112             public void Dispose()
113             {
114                 //Throw excpetion if Dispose() is called in separate thread.
115                 if (!Window.IsInstalled())
116                 {
117                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
118                 }
119
120                 if (isDisposeQueued)
121                 {
122                     Dispose(DisposeTypes.Implicit);
123                 }
124                 else
125                 {
126                     Dispose(DisposeTypes.Explicit);
127                     System.GC.SuppressFinalize(this);
128                 }
129             }
130
131             protected virtual void Dispose(DisposeTypes type)
132             {
133                 if (disposed)
134                 {
135                     return;
136                 }
137
138                 if(type == DisposeTypes.Explicit)
139                 {
140                     //Called by User
141                     //Release your own managed resources here.
142                     //You should release all of your own disposable objects here.
143                 }
144
145                 //Release your own unmanaged resources here.
146                 //You should not access any managed member here except static instance.
147                 //because the execution order of Finalizes is non-deterministic.
148
149                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
150                 {
151                     if (swigCMemOwn)
152                     {
153                         swigCMemOwn = false;
154                         NDalicPINVOKE.delete_Path_Property(swigCPtr);
155                     }
156                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
157                 }
158                 disposed = true;
159             }
160
161             internal Property() : this(NDalicPINVOKE.new_Path_Property(), true)
162             {
163                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             }
165
166             internal static readonly int POINTS = NDalicPINVOKE.Path_Property_POINTS_get();
167             internal static readonly int CONTROL_POINTS = NDalicPINVOKE.Path_Property_CONTROL_POINTS_get();
168
169         }
170
171         /// <summary>
172         /// Creates an initialized Path handle.
173         /// </summary>
174         public Path() : this(NDalicPINVOKE.Path_New(), true)
175         {
176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177
178         }
179         /// <summary>
180         /// Downcasts a handle to Path handle.<br>
181         /// If handle points to a Path object, the downcast produces valid handle.<br>
182         /// If not, the returned handle is left uninitialized.<br>
183         /// </summary>
184         /// <param name="handle">Handle to an object</param>
185         public new static Path DownCast(BaseHandle handle)
186         {
187             Path ret = new Path(NDalicPINVOKE.Path_DownCast(BaseHandle.getCPtr(handle)), true);
188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189             return ret;
190         }
191
192         internal Path(Path handle) : this(NDalicPINVOKE.new_Path__SWIG_1(Path.getCPtr(handle)), true)
193         {
194             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195         }
196
197         internal Path Assign(Path rhs)
198         {
199             Path ret = new Path(NDalicPINVOKE.Path_Assign(swigCPtr, Path.getCPtr(rhs)), false);
200             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201             return ret;
202         }
203
204         /// <summary>
205         /// Adds an interpolation point.
206         /// </summary>
207         /// <param name="point">The new interpolation point to be added</param>
208         public void AddPoint(Position point)
209         {
210             NDalicPINVOKE.Path_AddPoint(swigCPtr, Position.getCPtr(point));
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212         }
213
214         /// <summary>
215         /// Adds a control point.
216         /// </summary>
217         /// <param name="point">The new control point to be added</param>
218         public void AddControlPoint(Vector3 point)
219         {
220             NDalicPINVOKE.Path_AddControlPoint(swigCPtr, Vector3.getCPtr(point));
221             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222         }
223
224         /// <summary>
225         /// Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.<br>
226         /// The generating algorithm is as follows:<br>
227         /// For a given knot point K[N], find the vector that bisects K[N-1],[N] and [N],[N+1].<br>
228         /// Calculate the tangent vector by taking the normal of this bisector.<br>
229         /// The in control point is the length of the preceding segment back along this bisector multiplied by the curvature.<br>
230         /// The out control point is the length of the succeeding segment forward along this bisector multiplied by the curvature.<br>
231         /// </summary>
232         /// <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>
233         public void GenerateControlPoints(float curvature)
234         {
235             NDalicPINVOKE.Path_GenerateControlPoints(swigCPtr, curvature);
236             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237         }
238
239         /// <summary>
240         /// Sample path at a given progress. Calculates position and tangent at that point of the curve.
241         /// </summary>
242         /// <param name="progress">A floating point value between 0.0 and 1.0</param>
243         /// <param name="position">The interpolated position at that progress</param>
244         /// <param name="tangent">The interpolated tangent at that progress</param>
245         public void Sample(float progress, Vector3 position, Vector3 tangent)
246         {
247             NDalicPINVOKE.Path_Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent));
248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249         }
250
251         /// <summary>
252         /// Accessor for the interpolation points.
253         /// </summary>
254         /// <param name="index">The index of the interpolation point</param>
255         public Vector3 GetPoint(uint index)
256         {
257             Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetPoint(swigCPtr, index), false);
258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259             return ret;
260         }
261
262         /// <summary>
263         /// Accessor for the control points.
264         /// </summary>
265         /// <param name="index">The index of the control point</param>  
266         public Vector3 GetControlPoint(uint index)
267         {
268             Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetControlPoint(swigCPtr, index), false);
269             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270             return ret;
271         }
272
273         /// <summary>
274         /// Gets the number of interpolation points in the path.
275         /// </summary>
276         /// <returns>The number of interpolation points in the path</returns>
277         public uint GetPointCount()
278         {
279             uint ret = NDalicPINVOKE.Path_GetPointCount(swigCPtr);
280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281             return ret;
282         }
283
284         /// <summary>
285         /// Enumeration for Points
286         /// </summary>
287         public PropertyArray Points
288         {
289             get
290             {
291                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
292                 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp);
293                 return temp;
294             }
295             set
296             {
297                 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value));
298             }
299         }
300
301         /// <summary>
302         /// Enumeration for ControlPoints
303         /// </summary>
304         public PropertyArray ControlPoints
305         {
306             get
307             {
308                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
309                 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.CONTROL_POINTS).Get(temp);
310                 return temp;
311             }
312             set
313             {
314                 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
315             }
316         }
317
318     }
319
320 }