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.
22 /// An angle in degrees.<br />
23 /// This reduces ambiguity when using methods which accept angles in degrees or radians.<br />
25 public class Degree : global::System.IDisposable
27 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 protected bool swigCMemOwn;
33 internal Degree(global::System.IntPtr cPtr, bool cMemoryOwn)
35 swigCMemOwn = cMemoryOwn;
36 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
39 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Degree obj)
41 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
44 //A Flag to check who called Dispose(). (By User or DisposeQueue)
45 private bool isDisposeQueued = false;
47 /// A Flat to check if it is already disposed.
49 protected bool disposed = false;
54 /// <since_tizen> 3 </since_tizen>
59 isDisposeQueued = true;
60 DisposeQueue.Instance.Add(this);
67 /// <since_tizen> 3 </since_tizen>
70 //Throw excpetion if Dispose() is called in separate thread.
71 if (!Window.IsInstalled())
73 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
78 Dispose(DisposeTypes.Implicit);
82 Dispose(DisposeTypes.Explicit);
83 System.GC.SuppressFinalize(this);
90 /// <since_tizen> 3 </since_tizen>
91 protected virtual void Dispose(DisposeTypes type)
98 if(type == DisposeTypes.Explicit)
101 //Release your own managed resources here.
102 //You should release all of your own disposable objects here.
105 //Release your own unmanaged resources here.
106 //You should not access any managed member here except static instance.
107 //because the execution order of Finalizes is non-deterministic.
109 if (swigCPtr.Handle != global::System.IntPtr.Zero)
114 NDalicPINVOKE.delete_Degree(swigCPtr);
116 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
124 /// <since_tizen> 3 </since_tizen>
125 public Degree() : this(NDalicPINVOKE.new_Degree__SWIG_0(), true)
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 /// Creates an angle in degrees.
133 /// <param name="value">The initial value in degrees.</param>
134 /// <since_tizen> 3 </since_tizen>
135 public Degree(float value) : this(NDalicPINVOKE.new_Degree__SWIG_1(value), true)
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Creates an angle in degrees from a radian.
143 /// <param name="value">The initial value in radians.</param>
144 /// <since_tizen> 3 </since_tizen>
145 public Degree(Radian value) : this(NDalicPINVOKE.new_Degree__SWIG_2(Radian.getCPtr(value)), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 /// The value of degree.
153 /// <since_tizen> 3 </since_tizen>
158 NDalicPINVOKE.Degree_degree_set(swigCPtr, value);
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 float ret = NDalicPINVOKE.Degree_degree_get(swigCPtr);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();