// THIS FILE IS PART OF SVG PROJECT
// THE SVG PROJECT IS AN OPENSOURCE LIBRARY LICENSED UNDER THE MS-PL License.
// COPYRIGHT (C) svg-net. ALL RIGHTS RESERVED.
// GITHUB: https://github.com/svg-net/SVG
namespace AntdUI.Svg
{
///
/// Represents an orientation in an Scalable Vector Graphics document.
///
public class SvgOrient
{
private bool _isAuto = true;
private float _angle;
public SvgOrient()
{
IsAuto = false;
Angle = 0;
}
public SvgOrient(bool isAuto)
{
IsAuto = isAuto;
}
public SvgOrient(float angle)
{
Angle = angle;
}
///
/// Gets the value of the unit.
///
public float Angle
{
get { return _angle; }
set
{
_angle = value;
_isAuto = false;
}
}
///
/// Gets the value of the unit.
///
public bool IsAuto
{
get { return _isAuto; }
set
{
_isAuto = value;
_angle = 0f;
}
}
///
/// Indicates whether this instance and a specified object are equal.
///
/// Another object to compare to.
///
/// true if and this instance are the same type and represent the same value; otherwise, false.
///
public override bool Equals(object obj)
{
if (obj == null) return false;
if (!(obj.GetType() == typeof(SvgOrient))) return false;
var unit = (SvgOrient)obj;
return (unit.IsAuto == IsAuto && unit.Angle == Angle);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
if (IsAuto) return "auto";
else return Angle.ToString();
}
///
/// Performs an implicit conversion from to .
///
/// The value.
/// The result of the conversion.
public static implicit operator SvgOrient(float value)
{
return new SvgOrient(value);
}
}
}