[NUI] Fix build warning[CA1064]
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Path.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23
24     /// <summary>
25     /// A 3D parametric curve.<br />
26     /// Paths can be used to animate the position and orientation of actors.<br />
27     /// </summary>
28     /// <since_tizen> 3 </since_tizen>
29     public class Path : BaseHandle
30     {
31
32         /// <summary>
33         /// Creates an initialized path handle.
34         /// </summary>
35         /// <since_tizen> 3 </since_tizen>
36         public Path() : this(Interop.Path.New(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39         }
40
41         internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Path.Upcast(cPtr), cMemoryOwn)
42         {
43         }
44
45         /// <summary>
46         /// Enumeration for the Points.
47         /// </summary>
48         /// <since_tizen> 3 </since_tizen>
49         public PropertyArray Points
50         {
51             get
52             {
53                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
54                 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp);
55                 return temp;
56             }
57             set
58             {
59                 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value));
60             }
61         }
62
63         /// <summary>
64         /// Enumeration for the ControlPoints.
65         /// </summary>
66         /// <since_tizen> 3 </since_tizen>
67         public PropertyArray ControlPoints
68         {
69             get
70             {
71                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
72                 Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.ControlPoints).Get(temp);
73                 return temp;
74             }
75             set
76             {
77                 Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.ControlPoints, new Tizen.NUI.PropertyValue(value));
78             }
79         }
80
81         /// <summary>
82         /// Adds an interpolation point.
83         /// </summary>
84         /// <param name="point">The new interpolation point to be added.</param>
85         /// <since_tizen> 3 </since_tizen>
86         public void AddPoint(Position point)
87         {
88             Interop.Path.AddPoint(swigCPtr, Position.getCPtr(point));
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90         }
91
92         /// <summary>
93         /// Adds a control point.
94         /// </summary>
95         /// <param name="point">The new control point to be added.</param>
96         /// <since_tizen> 3 </since_tizen>
97         public void AddControlPoint(Vector3 point)
98         {
99             Interop.Path.AddControlPoint(swigCPtr, Vector3.getCPtr(point));
100             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101         }
102
103         /// <summary>
104         /// Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.<br />
105         /// The generating algorithm is as follows:<br />
106         /// For a given knot point K[N], find the vector that bisects K[N-1],[N] and [N],[N+1].<br />
107         /// Calculate the tangent vector by taking the normal of this bisector.<br />
108         /// The in control point is the length of the preceding segment back along this bisector multiplied by the curvature.<br />
109         /// The out control point is the length of the succeeding segment forward along this bisector multiplied by the curvature.<br />
110         /// </summary>
111         /// <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>
112         /// <since_tizen> 3 </since_tizen>
113         public void GenerateControlPoints(float curvature)
114         {
115             Interop.Path.GenerateControlPoints(swigCPtr, curvature);
116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117         }
118
119         /// <summary>
120         /// Sample path at a given progress. Calculates the position and tangent at that point of the curve.
121         /// </summary>
122         /// <param name="progress">A floating point value between 0.0 and 1.0.</param>
123         /// <param name="position">The interpolated position at that progress.</param>
124         /// <param name="tangent">The interpolated tangent at that progress.</param>
125         /// <since_tizen> 3 </since_tizen>
126         public void Sample(float progress, Vector3 position, Vector3 tangent)
127         {
128             Interop.Path.Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent));
129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130         }
131
132         /// <summary>
133         /// An accessor for the interpolation points.
134         /// </summary>
135         /// <param name="index">The index of the interpolation point.</param>
136         /// <since_tizen> 3 </since_tizen>
137         public Vector3 GetPoint(uint index)
138         {
139             Vector3 ret = new Vector3(Interop.Path.GetPoint(swigCPtr, index), false);
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141             return ret;
142         }
143
144         /// <summary>
145         /// An accessor for the control points.
146         /// </summary>
147         /// <param name="index">The index of the control point.</param>
148         /// <since_tizen> 3 </since_tizen>
149         public Vector3 GetControlPoint(uint index)
150         {
151             Vector3 ret = new Vector3(Interop.Path.GetControlPoint(swigCPtr, index), false);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         /// <summary>
157         /// Gets the number of interpolation points in the path.
158         /// </summary>
159         /// <returns>The number of interpolation points in the path.</returns>
160         /// <since_tizen> 3 </since_tizen>
161         public uint GetPointCount()
162         {
163             uint ret = Interop.Path.GetPointCount(swigCPtr);
164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165             return ret;
166         }
167
168         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj)
169         {
170             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
171         }
172
173         /// This will not be public opened.
174         [EditorBrowsable(EditorBrowsableState.Never)]
175         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
176         {
177             Interop.Path.DeletePath(swigCPtr);
178         }
179
180         internal class Property
181         {
182             internal static readonly int POINTS = Interop.Path.PointsGet();
183             internal static readonly int ControlPoints = Interop.Path.ControlPointsGet();
184         }
185     }
186 }