[NUI] Fix build warning CA1062 (#2234)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Camera.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.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20
21 namespace Tizen.NUI
22 {
23     /// This will be released at Tizen.NET API Level 6, so currently this would be used as inhouse API.
24     [EditorBrowsable(EditorBrowsableState.Never)]
25     public class Camera : View
26     {
27
28         internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.CameraActor.CameraActor_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
38         {
39             Interop.CameraActor.delete_CameraActor(swigCPtr);
40         }
41
42         internal class Property
43         {
44             internal static readonly int TYPE = Interop.CameraActor.CameraActor_Property_TYPE_get();
45             internal static readonly int PROJECTION_MODE = Interop.CameraActor.CameraActor_Property_PROJECTION_MODE_get();
46             internal static readonly int FIELD_OF_VIEW = Interop.CameraActor.CameraActor_Property_FIELD_OF_VIEW_get();
47             internal static readonly int ASPECT_RATIO = Interop.CameraActor.CameraActor_Property_ASPECT_RATIO_get();
48             internal static readonly int NEAR_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_NEAR_PLANE_DISTANCE_get();
49             internal static readonly int FAR_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_FAR_PLANE_DISTANCE_get();
50             internal static readonly int LEFT_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_LEFT_PLANE_DISTANCE_get();
51             internal static readonly int RIGHT_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_RIGHT_PLANE_DISTANCE_get();
52             internal static readonly int TOP_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_TOP_PLANE_DISTANCE_get();
53             internal static readonly int BOTTOM_PLANE_DISTANCE = Interop.CameraActor.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get();
54             internal static readonly int TARGET_POSITION = Interop.CameraActor.CameraActor_Property_TARGET_POSITION_get();
55             internal static readonly int PROJECTION_MATRIX = Interop.CameraActor.CameraActor_Property_PROJECTION_MATRIX_get();
56             internal static readonly int VIEW_MATRIX = Interop.CameraActor.CameraActor_Property_VIEW_MATRIX_get();
57             internal static readonly int INVERT_Y_AXIS = Interop.CameraActor.CameraActor_Property_INVERT_Y_AXIS_get();
58         }
59
60         public Camera() : this(Interop.CameraActor.CameraActor_New__SWIG_0(), true)
61         {
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63         }
64
65         public Camera(Vector2 size) : this(Interop.CameraActor.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         public static Camera DownCast(BaseHandle handle)
71         {
72             if (handle == null)
73             {
74                 throw new global::System.ArgumentNullException(nameof(handle));
75             }
76             Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera;
77             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78             return ret;
79         }
80
81         public Camera(Camera copy) : this(Interop.CameraActor.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true)
82         {
83             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84         }
85
86         public Camera Assign(Camera rhs)
87         {
88             Camera ret = new Camera(Interop.CameraActor.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false);
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90             return ret;
91         }
92
93         public void SetType(CameraType type)
94         {
95             Interop.CameraActor.CameraActor_SetType(swigCPtr, (int)type);
96             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97         }
98
99         public new CameraType GetType()
100         {
101             CameraType ret = (CameraType)Interop.CameraActor.CameraActor_GetType(swigCPtr);
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104         }
105
106         public void SetProjectionMode(ProjectionMode mode)
107         {
108             Interop.CameraActor.CameraActor_SetProjectionMode(swigCPtr, (int)mode);
109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110         }
111
112         public ProjectionMode GetProjectionMode()
113         {
114             ProjectionMode ret = (ProjectionMode)Interop.CameraActor.CameraActor_GetProjectionMode(swigCPtr);
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116             return ret;
117         }
118
119         public void SetFieldOfView(float fieldOfView)
120         {
121             Interop.CameraActor.CameraActor_SetFieldOfView(swigCPtr, fieldOfView);
122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123         }
124
125         public float GetFieldOfView()
126         {
127             float ret = Interop.CameraActor.CameraActor_GetFieldOfView(swigCPtr);
128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129             return ret;
130         }
131
132         public void SetAspectRatio(float aspectRatio)
133         {
134             Interop.CameraActor.CameraActor_SetAspectRatio(swigCPtr, aspectRatio);
135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136         }
137
138         public float GetAspectRatio()
139         {
140             float ret = Interop.CameraActor.CameraActor_GetAspectRatio(swigCPtr);
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142             return ret;
143         }
144
145         public void SetNearClippingPlane(float nearClippingPlane)
146         {
147             Interop.CameraActor.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane);
148             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149         }
150
151         public float GetNearClippingPlane()
152         {
153             float ret = Interop.CameraActor.CameraActor_GetNearClippingPlane(swigCPtr);
154             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155             return ret;
156         }
157
158         public void SetFarClippingPlane(float farClippingPlane)
159         {
160             Interop.CameraActor.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane);
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162         }
163
164         public float GetFarClippingPlane()
165         {
166             float ret = Interop.CameraActor.CameraActor_GetFarClippingPlane(swigCPtr);
167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168             return ret;
169         }
170
171         public void SetTargetPosition(Vector3 targetPosition)
172         {
173             Interop.CameraActor.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition));
174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175         }
176
177         public Vector3 GetTargetPosition()
178         {
179             Vector3 ret = new Vector3(Interop.CameraActor.CameraActor_GetTargetPosition(swigCPtr), true);
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181             return ret;
182         }
183
184         public void SetInvertYAxis(bool invertYAxis)
185         {
186             Interop.CameraActor.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis);
187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188         }
189
190         public bool GetInvertYAxis()
191         {
192             bool ret = Interop.CameraActor.CameraActor_GetInvertYAxis(swigCPtr);
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194             return ret;
195         }
196
197         public void SetPerspectiveProjection(Vector2 size)
198         {
199             Interop.CameraActor.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size));
200             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201         }
202
203         public void SetOrthographicProjection(Vector2 size)
204         {
205             Interop.CameraActor.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size));
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207         }
208
209         public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far)
210         {
211             Interop.CameraActor.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far);
212             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213         }
214
215         public string Type
216         {
217             get
218             {
219                 string temp;
220                 GetProperty(Camera.Property.TYPE).Get(out temp);
221                 return temp;
222             }
223             set
224             {
225                 SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value));
226             }
227         }
228         public string ProjectionMode
229         {
230             get
231             {
232                 string temp;
233                 GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp);
234                 return temp;
235             }
236             set
237             {
238                 SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value));
239             }
240         }
241         public float FieldOfView
242         {
243             get
244             {
245                 float temp = 0.0f;
246                 GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp);
247                 return temp;
248             }
249             set
250             {
251                 SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value));
252             }
253         }
254         public float AspectRatio
255         {
256             get
257             {
258                 float temp = 0.0f;
259                 GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp);
260                 return temp;
261             }
262             set
263             {
264                 SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value));
265             }
266         }
267         public float NearPlaneDistance
268         {
269             get
270             {
271                 float temp = 0.0f;
272                 GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp);
273                 return temp;
274             }
275             set
276             {
277                 SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
278             }
279         }
280         public float FarPlaneDistance
281         {
282             get
283             {
284                 float temp = 0.0f;
285                 GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp);
286                 return temp;
287             }
288             set
289             {
290                 SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
291             }
292         }
293         public float LeftPlaneDistance
294         {
295             get
296             {
297                 float temp = 0.0f;
298                 GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp);
299                 return temp;
300             }
301             set
302             {
303                 SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
304             }
305         }
306         public float RightPlaneDistance
307         {
308             get
309             {
310                 float temp = 0.0f;
311                 GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp);
312                 return temp;
313             }
314             set
315             {
316                 SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
317             }
318         }
319         public float TopPlaneDistance
320         {
321             get
322             {
323                 float temp = 0.0f;
324                 GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp);
325                 return temp;
326             }
327             set
328             {
329                 SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
330             }
331         }
332         public float BottomPlaneDistance
333         {
334             get
335             {
336                 float temp = 0.0f;
337                 GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp);
338                 return temp;
339             }
340             set
341             {
342                 SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value));
343             }
344         }
345         public Vector3 TargetPosition
346         {
347             get
348             {
349                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
350                 GetProperty(Camera.Property.TARGET_POSITION).Get(temp);
351                 return temp;
352             }
353             set
354             {
355                 SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value));
356             }
357         }
358         internal Matrix ProjectionMatrix
359         {
360             get
361             {
362                 Matrix temp = new Matrix();
363                 GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp);
364                 return temp;
365             }
366         }
367         internal Matrix ViewMatrix
368         {
369             get
370             {
371                 Matrix temp = new Matrix();
372                 GetProperty(Camera.Property.VIEW_MATRIX).Get(temp);
373                 return temp;
374             }
375         }
376         public bool InvertYAxis
377         {
378             get
379             {
380                 bool temp = false;
381                 GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp);
382                 return temp;
383             }
384             set
385             {
386                 SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value));
387             }
388         }
389     }
390 }