/*
* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.ComponentModel;
using Tizen.NUI.Binding;
namespace Tizen.NUI
{
///
/// RelativeVector4 is a four-dimensional vector.
/// All values (x, y, and z) should be between [0, 1].
///
/// 3
[Binding.TypeConverter(typeof(RelativeVector4TypeConverter))]
public class RelativeVector4 : Disposable
{
///
/// The constructor.
///
/// 3
public RelativeVector4() : this(Interop.Vector4.NewVector4(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// The constructor.
///
/// The x component.
/// The y component.
/// The z component.
/// The w component.
/// 3
public RelativeVector4(float x, float y, float z, float w) : this(Interop.Vector4.NewVector4(x, y, z, w), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// The constructor.
///
/// The RelativeVector2 to create this vector from.
/// 3
public RelativeVector4(RelativeVector2 relativeVector2) : this(Interop.Vector4.NewVector4WithVector2(RelativeVector2.getCPtr(relativeVector2)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// The constructor.
///
/// The RelativeVector3 to create this vector from.
/// 3
public RelativeVector4(RelativeVector3 relativeVector3) : this(Interop.Vector4.NewVector4WithVector3(RelativeVector3.getCPtr(relativeVector3)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal RelativeVector4(RelativeVector4ChangedCallback cb, float x, float y, float z, float w) : this(Interop.Vector4.NewVector4(x, y, z, w), true)
{
callback = cb;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal delegate void RelativeVector4ChangedCallback(float x, float y, float z, float w);
private RelativeVector4ChangedCallback callback = null;
///
/// The x component.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor.
///
///
/// // DO NOT use like the followings!
/// RelativeVector4 relativeVector4 = new RelativeVector4();
/// relativeVector4.X = 0.1f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
/// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
///
/// 3
public float X
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor")]
set
{
Interop.Vector4.XSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(X, Y, Z, W);
}
get
{
float ret = Interop.Vector4.XGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The y component.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor.
///
///
/// // DO NOT use like the followings!
/// RelativeVector4 relativeVector4 = new RelativeVector4();
/// relativeVector4.Y = 0.5f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
/// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
///
/// 3
public float Y
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor")]
set
{
Interop.Vector4.YSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(X, Y, Z, W);
}
get
{
float ret = Interop.Vector4.YGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The z component.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor.
///
///
/// // DO NOT use like the followings!
/// RelativeVector4 relativeVector4 = new RelativeVector4();
/// relativeVector4.Z = 0.9f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
/// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
///
/// 3
public float Z
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor")]
set
{
Interop.Vector4.ZSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(X, Y, Z, W);
}
get
{
float ret = Interop.Vector4.ZGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The w component.
///
///
/// The setter is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor.
///
///
/// // DO NOT use like the followings!
/// RelativeVector4 relativeVector4 = new RelativeVector4();
/// relativeVector4.W = 1.0f;
/// // USE like this
/// float x = 0.1f, y = 0.5f, z = 0.9f, w = 1.0f;
/// RelativeVector4 relativeVector4 = new RelativeVector4(x, y, z, w);
///
/// 3
public float W
{
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new RelativeVector4(...) constructor")]
set
{
Interop.Vector4.WSet(SwigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
callback?.Invoke(X, Y, Z, W);
}
get
{
float ret = Interop.Vector4.WGet(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
return ret;
}
}
///
/// The addition operator.
///
/// The vector to add.
/// The vector to add.
/// The vector containing the result of the addition.
/// 3
public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2)
{
RelativeVector4 result = arg1?.Add(arg2);
return result;
}
///
/// The subtraction operator.
///
/// The vector to subtract.
/// The vector to subtract.
/// The vector containing the result of the subtraction.
/// 3
public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2)
{
RelativeVector4 result = arg1?.Subtract(arg2);
return result;
}
///
/// The multiplication operator.
///
/// The vector to multiply.
/// The vector to multiply.
/// The vector containing the result of the multiplication.
/// 3
public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2)
{
RelativeVector4 result = arg1?.Multiply(arg2);
return result;
}
///
/// The multiplication operator.
///
/// The vector to multiply.
/// The float value to scale the vector.
/// The vector containing the result of the scaling.
/// 3
public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2)
{
RelativeVector4 result = arg1?.Multiply(arg2);
return result;
}
///
/// The division operator.
///
/// The vector to divide.
/// The vector to divide.
/// The vector containing the result of the division.
/// 3
public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2)
{
RelativeVector4 result = arg1?.Divide(arg2);
return result;
}
///
/// The division operator.
///
/// The vector to divide.
/// The float value to scale the vector by.
/// The vector containing the result of the scaling.
/// 3
public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2)
{
RelativeVector4 result = arg1?.Divide(arg2);
return result;
}
///
///
/// 3
public static implicit operator Vector4(RelativeVector4 relativeVector4)
{
if (relativeVector4 == null)
{
return null;
}
return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W);
}
///
///
/// 3
public static implicit operator RelativeVector4(Vector4 vec)
{
if (vec == null)
{
return null;
}
return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W);
}
///
/// The const array subscript operator overload. Should be 0, 1 3 or 3.
///
/// The subscript index.
/// The float at the given index.
/// 3
public float this[uint index]
{
get
{
return ValueOfIndex(index);
}
}
///
/// Determines whether the specified object is equal to the current object.
///
/// The object to compare with the current object.
/// true if the specified object is equal to the current object; otherwise, false.
public override bool Equals(System.Object obj)
{
RelativeVector4 relativeVector4 = obj as RelativeVector4;
bool equal = false;
if (X == relativeVector4?.X && Y == relativeVector4?.Y && Z == relativeVector4?.Z && W == relativeVector4?.W)
{
equal = true;
}
return equal;
}
///
/// Gets the hash code of this RelativeVector4.
///
/// The Hash Code.
/// 6
public override int GetHashCode()
{
return SwigCPtr.Handle.GetHashCode();
}
///
/// Compares if the rhs is equal to.
///
/// The vector to compare.
/// Returns true if the two vectors are equal, otherwise false.
/// 3
public bool EqualTo(RelativeVector4 rhs)
{
bool ret = Interop.Vector4.EqualTo(SwigCPtr, RelativeVector4.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Compares if the rhs is not equal to.
///
/// The vector to compare.
/// Returns true if the two vectors are not equal, otherwise false.
/// 3
public bool NotEqualTo(RelativeVector4 rhs)
{
bool ret = Interop.Vector4.NotEqualTo(SwigCPtr, RelativeVector4.getCPtr(rhs));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
///
internal static RelativeVector4 GetRelativeVector4FromPtr(global::System.IntPtr cPtr)
{
RelativeVector4 ret = new RelativeVector4(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal RelativeVector4(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.Vector4.DeleteVector4(swigCPtr);
}
private RelativeVector4 Add(RelativeVector4 rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Add(SwigCPtr, RelativeVector4.getCPtr(rhs)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private RelativeVector4 Subtract(RelativeVector4 rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Subtract(SwigCPtr, RelativeVector4.getCPtr(rhs)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private RelativeVector4 Multiply(RelativeVector4 rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Multiply(SwigCPtr, RelativeVector4.getCPtr(rhs)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private RelativeVector4 Multiply(float rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Multiply(SwigCPtr, rhs), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private RelativeVector4 Divide(RelativeVector4 rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Divide(SwigCPtr, RelativeVector4.getCPtr(rhs)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private RelativeVector4 Divide(float rhs)
{
RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Divide(SwigCPtr, rhs), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private float ValueOfIndex(uint index)
{
float ret = Interop.Vector4.ValueOfIndex(SwigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
}