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.
21 /// An angle in radians.
23 /// <since_tizen> 3 </since_tizen>
24 public class Radian : global::System.IDisposable
29 /// <since_tizen> 3 </since_tizen>
30 protected bool swigCMemOwn;
33 /// A Flat to check if it is already disposed.
35 /// <since_tizen> 3 </since_tizen>
36 protected bool disposed = false;
38 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
40 //A Flag to check who called Dispose(). (By User or DisposeQueue)
41 private bool isDisposeQueued = false;
44 /// The default constructor, initializes to 0.
46 /// <since_tizen> 3 </since_tizen>
47 public Radian() : this(NDalicPINVOKE.new_Radian__SWIG_0(), true)
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
53 /// Creates an angle in radians.
55 /// <param name="value">The initial value in radians.</param>
56 /// <since_tizen> 3 </since_tizen>
57 public Radian(float value) : this(NDalicPINVOKE.new_Radian__SWIG_1(value), true)
59 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// Creates an angle in radians from an angle in degrees.
65 /// <param name="degree">The initial value in degrees.</param>
66 /// <since_tizen> 3 </since_tizen>
67 public Radian(Degree degree) : this(NDalicPINVOKE.new_Radian__SWIG_2(Degree.getCPtr(degree)), true)
69 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 internal Radian(global::System.IntPtr cPtr, bool cMemoryOwn)
74 swigCMemOwn = cMemoryOwn;
75 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
81 /// <since_tizen> 3 </since_tizen>
86 isDisposeQueued = true;
87 DisposeQueue.Instance.Add(this);
92 /// The value in radians.
94 /// <since_tizen> 3 </since_tizen>
99 NDalicPINVOKE.Radian_radian_set(swigCPtr, value);
100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 float ret = NDalicPINVOKE.Radian_radian_get(swigCPtr);
105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 /// <since_tizen> 3 </since_tizen>
114 public void Dispose()
116 //Throw excpetion if Dispose() is called in separate thread.
117 if (!Window.IsInstalled())
119 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
124 Dispose(DisposeTypes.Implicit);
128 Dispose(DisposeTypes.Explicit);
129 System.GC.SuppressFinalize(this);
134 /// Conversion to float.
136 /// <returns>The float value of this radian.</returns>
137 /// <since_tizen> 3 </since_tizen>
138 public float ConvertToFloat()
140 float ret = NDalicPINVOKE.Radian_ConvertToFloat(swigCPtr);
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Radian obj)
147 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
153 /// <since_tizen> 3 </since_tizen>
154 protected virtual void Dispose(DisposeTypes type)
161 if(type == DisposeTypes.Explicit)
164 //Release your own managed resources here.
165 //You should release all of your own disposable objects here.
168 //Release your own unmanaged resources here.
169 //You should not access any managed member here except static instance.
170 //because the execution order of Finalizes is non-deterministic.
172 if (swigCPtr.Handle != global::System.IntPtr.Zero)
177 NDalicPINVOKE.delete_Radian(swigCPtr);
179 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);