1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
20 // This file was automatically generated by SWIG (http://www.swig.org).
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
31 /// A 3D parametric curve.<br>
32 /// Paths can be used to animate position and orientation of actors.<br>
34 public class Path : BaseHandle
36 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38 internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Path_SWIGUpcast(cPtr), cMemoryOwn)
40 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj)
45 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48 protected override void Dispose(DisposeTypes type)
55 if(type == DisposeTypes.Explicit)
58 //Release your own managed resources here.
59 //You should release all of your own disposable objects here.
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.
66 if (swigCPtr.Handle != global::System.IntPtr.Zero)
71 NDalicPINVOKE.delete_Path(swigCPtr);
73 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
80 internal class Property : global::System.IDisposable
82 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
83 protected bool swigCMemOwn;
85 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
87 swigCMemOwn = cMemoryOwn;
88 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
91 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
93 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
96 //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam)
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;
107 isDisposeQueued = true;
108 DisposeQueue.Instance.Add(this);
112 public void Dispose()
114 //Throw excpetion if Dispose() is called in separate thread.
115 if (!Window.IsInstalled())
117 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
122 Dispose(DisposeTypes.Implicit);
126 Dispose(DisposeTypes.Explicit);
127 System.GC.SuppressFinalize(this);
131 protected virtual void Dispose(DisposeTypes type)
138 if(type == DisposeTypes.Explicit)
141 //Release your own managed resources here.
142 //You should release all of your own disposable objects here.
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.
149 if (swigCPtr.Handle != global::System.IntPtr.Zero)
154 NDalicPINVOKE.delete_Path_Property(swigCPtr);
156 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
161 internal Property() : this(NDalicPINVOKE.new_Path_Property(), true)
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 internal static readonly int POINTS = NDalicPINVOKE.Path_Property_POINTS_get();
167 internal static readonly int CONTROL_POINTS = NDalicPINVOKE.Path_Property_CONTROL_POINTS_get();
172 /// Creates an initialized Path handle.
174 public Path() : this(NDalicPINVOKE.Path_New(), true)
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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>
184 /// <param name="handle">Handle to an object</param>
185 public new static Path DownCast(BaseHandle handle)
187 Path ret = new Path(NDalicPINVOKE.Path_DownCast(BaseHandle.getCPtr(handle)), true);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 internal Path(Path handle) : this(NDalicPINVOKE.new_Path__SWIG_1(Path.getCPtr(handle)), true)
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 internal Path Assign(Path rhs)
199 Path ret = new Path(NDalicPINVOKE.Path_Assign(swigCPtr, Path.getCPtr(rhs)), false);
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205 /// Adds an interpolation point.
207 /// <param name="point">The new interpolation point to be added</param>
208 public void AddPoint(Position point)
210 NDalicPINVOKE.Path_AddPoint(swigCPtr, Position.getCPtr(point));
211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 /// Adds a control point.
217 /// <param name="point">The new control point to be added</param>
218 public void AddControlPoint(Vector3 point)
220 NDalicPINVOKE.Path_AddControlPoint(swigCPtr, Vector3.getCPtr(point));
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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>
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)
235 NDalicPINVOKE.Path_GenerateControlPoints(swigCPtr, curvature);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 /// Sample path at a given progress. Calculates position and tangent at that point of the curve.
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)
247 NDalicPINVOKE.Path_Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent));
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 /// Accessor for the interpolation points.
254 /// <param name="index">The index of the interpolation point</param>
255 public Vector3 GetPoint(uint index)
257 Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetPoint(swigCPtr, index), false);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 /// Accessor for the control points.
265 /// <param name="index">The index of the control point</param>
266 public Vector3 GetControlPoint(uint index)
268 Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetControlPoint(swigCPtr, index), false);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 /// Gets the number of interpolation points in the path.
276 /// <returns>The number of interpolation points in the path</returns>
277 public uint GetPointCount()
279 uint ret = NDalicPINVOKE.Path_GetPointCount(swigCPtr);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 /// Enumeration for Points
287 public PropertyArray Points
291 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
292 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp);
297 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value));
302 /// Enumeration for ControlPoints
304 public PropertyArray ControlPoints
308 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
309 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.CONTROL_POINTS).Get(temp);
314 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));