2 * Copyright (c) 2019 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.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
24 /// RelativeVector4 is a four-dimensional vector.
25 /// All values (x, y, and z) should be between [0, 1].
27 /// <since_tizen> 3 </since_tizen>
28 [Binding.TypeConverter(typeof(RelativeVector4TypeConverter))]
29 public class RelativeVector4 : Disposable
35 /// <since_tizen> 3 </since_tizen>
36 public RelativeVector4() : this(Interop.Vector4.new_Vector4__SWIG_0(), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44 /// <param name="x">The x component.</param>
45 /// <param name="y">The y component.</param>
46 /// <param name="z">The z component.</param>
47 /// <param name="w">The w component.</param>
48 /// <since_tizen> 3 </since_tizen>
49 public RelativeVector4(float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
57 /// <param name="relativeVector2">The RelativeVector2 to create this vector from.</param>
58 /// <since_tizen> 3 </since_tizen>
59 public RelativeVector4(RelativeVector2 relativeVector2) : this(Interop.Vector4.new_Vector4__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// <param name="relativeVector3">The RelativeVector3 to create this vector from.</param>
68 /// <since_tizen> 3 </since_tizen>
69 public RelativeVector4(RelativeVector3 relativeVector3) : this(Interop.Vector4.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true)
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 internal RelativeVector4(RelativeVector4ChangedCallback cb, float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal delegate void RelativeVector4ChangedCallback(float x, float y, float z, float w);
80 private RelativeVector4ChangedCallback callback = null;
85 /// <since_tizen> 3 </since_tizen>
86 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
91 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
93 Interop.Vector4.Vector4_X_set(swigCPtr, value);
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 callback?.Invoke(X, Y, Z, W);
100 float ret = Interop.Vector4.Vector4_X_get(swigCPtr);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 /// <since_tizen> 3 </since_tizen>
110 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
115 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
117 Interop.Vector4.Vector4_Y_set(swigCPtr, value);
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 callback?.Invoke(X, Y, Z, W);
124 float ret = Interop.Vector4.Vector4_Y_get(swigCPtr);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133 /// <since_tizen> 3 </since_tizen>
134 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
139 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
141 Interop.Vector4.Vector4_Z_set(swigCPtr, value);
142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 callback?.Invoke(X, Y, Z, W);
148 float ret = Interop.Vector4.Vector4_Z_get(swigCPtr);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 /// <since_tizen> 3 </since_tizen>
158 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
163 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
165 Interop.Vector4.Vector4_W_set(swigCPtr, value);
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 callback?.Invoke(X, Y, Z, W);
172 float ret = Interop.Vector4.Vector4_W_get(swigCPtr);
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 /// The addition operator.
181 /// <param name="arg1">The vector to add.</param>
182 /// <param name="arg2">The vector to add.</param>
183 /// <returns>The vector containing the result of the addition.</returns>
184 /// <since_tizen> 3 </since_tizen>
185 public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2)
187 RelativeVector4 result = arg1.Add(arg2);
192 /// The subtraction operator.
194 /// <param name="arg1">The vector to subtract.</param>
195 /// <param name="arg2">The vector to subtract.</param>
196 /// <returns>The vector containing the result of the subtraction.</returns>
197 /// <since_tizen> 3 </since_tizen>
198 public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2)
200 RelativeVector4 result = arg1.Subtract(arg2);
205 /// The multiplication operator.
207 /// <param name="arg1">The vector to multiply.</param>
208 /// <param name="arg2">The vector to multiply.</param>
209 /// <returns>The vector containing the result of the multiplication.</returns>
210 /// <since_tizen> 3 </since_tizen>
211 public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2)
213 RelativeVector4 result = arg1.Multiply(arg2);
218 /// The multiplication operator.
220 /// <param name="arg1">The vector to multiply.</param>
221 /// <param name="arg2">The float value to scale the vector.</param>
222 /// <returns>The vector containing the result of the scaling.</returns>
223 /// <since_tizen> 3 </since_tizen>
224 public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2)
226 RelativeVector4 result = arg1.Multiply(arg2);
231 /// The division operator.
233 /// <param name="arg1">The vector to divide.</param>
234 /// <param name="arg2">The vector to divide.</param>
235 /// <returns>The vector containing the result of the division.</returns>
236 /// <since_tizen> 3 </since_tizen>
237 public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2)
239 RelativeVector4 result = arg1.Divide(arg2);
244 /// The division operator.
246 /// <param name="arg1">The vector to divide.</param>
247 /// <param name="arg2">The float value to scale the vector by.</param>
248 /// <returns>The vector containing the result of the scaling.</returns>
249 /// <since_tizen> 3 </since_tizen>
250 public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2)
252 RelativeVector4 result = arg1.Divide(arg2);
258 /// <since_tizen> 3 </since_tizen>
259 public static implicit operator Vector4(RelativeVector4 relativeVector4)
261 return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W);
266 /// <since_tizen> 3 </since_tizen>
267 public static implicit operator RelativeVector4(Vector4 vec)
269 return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W);
273 /// The const array subscript operator overload. Should be 0, 1 3 or 3.
275 /// <param name="index">The subscript index.</param>
276 /// <returns>The float at the given index.</returns>
277 /// <since_tizen> 3 </since_tizen>
278 public float this[uint index]
282 return ValueOfIndex(index);
287 /// Determines whether the specified object is equal to the current object.
289 /// <param name="obj">The object to compare with the current object.</param>
290 /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
291 public override bool Equals(System.Object obj)
293 RelativeVector4 relativeVector4 = obj as RelativeVector4;
295 if (X == relativeVector4?.X && Y == relativeVector4?.Y && Z == relativeVector4?.Z && W == relativeVector4?.W)
303 /// Gets the the hash code of this RelativeVector4.
305 /// <returns>The Hash Code.</returns>
306 /// <since_tizen> 6 </since_tizen>
307 public override int GetHashCode()
309 return swigCPtr.Handle.GetHashCode();
313 /// Compares if the rhs is equal to.
315 /// <param name="rhs">The vector to compare.</param>
316 /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
317 /// <since_tizen> 3 </since_tizen>
318 public bool EqualTo(RelativeVector4 rhs)
320 bool ret = Interop.Vector4.Vector4_EqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 /// Compares if the rhs is not equal to.
328 /// <param name="rhs">The vector to compare.</param>
329 /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
330 /// <since_tizen> 3 </since_tizen>
331 public bool NotEqualTo(RelativeVector4 rhs)
333 bool ret = Interop.Vector4.Vector4_NotEqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
334 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 internal static RelativeVector4 GetRelativeVector4FromPtr(global::System.IntPtr cPtr)
342 RelativeVector4 ret = new RelativeVector4(cPtr, false);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector4 obj)
349 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
352 internal RelativeVector4(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
356 /// This will not be public opened.
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
360 Interop.Vector4.delete_Vector4(swigCPtr);
363 private RelativeVector4 Add(RelativeVector4 rhs)
365 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Add(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 private RelativeVector4 Subtract(RelativeVector4 rhs)
372 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Subtract__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 private RelativeVector4 Multiply(RelativeVector4 rhs)
379 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 private RelativeVector4 Multiply(float rhs)
386 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 private RelativeVector4 Divide(RelativeVector4 rhs)
393 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 private RelativeVector4 Divide(float rhs)
400 RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 private float ValueOfIndex(uint index)
407 float ret = Interop.Vector4.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
408 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();