Beispiel #1
0
        public void FromString(string s)
        {
            int i = s.LastIndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });

            if (i == -1)
            {
                return;
            }

            _num = int.Parse(s.Substring(0, i + 1), System.Globalization.CultureInfo.InvariantCulture);

            switch (s.Substring(i + 1))
            {
            case "grad":
                _type = SvgAngleType.SVG_ANGLETYPE_GRAD;
                break;

            case "rad":
                _type = SvgAngleType.SVG_ANGLETYPE_RAD;
                break;

            case "deg":
                _type = SvgAngleType.SVG_ANGLETYPE_DEG;
                break;

            case "":
                _type = SvgAngleType.SVG_ANGLETYPE_UNSPECIFIED;
                break;

            default:
                throw new SvgException("Invalid SvgAngle", s);
            }
        }
Beispiel #2
0
        public void FromString(string s)
        {
            int num = s.LastIndexOfAny(new char[]
            {
                '0',
                '1',
                '2',
                '3',
                '4',
                '5',
                '6',
                '7',
                '8',
                '9'
            });

            if (num != -1)
            {
                this._num = (float)int.Parse(s.Substring(0, num + 1), CultureInfo.InvariantCulture);
                string text = s.Substring(num + 1);
                if (text != null)
                {
                    if (text == "grad")
                    {
                        this._type = SvgAngleType.SVG_ANGLETYPE_GRAD;
                        return;
                    }
                    if (text == "rad")
                    {
                        this._type = SvgAngleType.SVG_ANGLETYPE_RAD;
                        return;
                    }
                    if (text == "deg")
                    {
                        this._type = SvgAngleType.SVG_ANGLETYPE_DEG;
                        return;
                    }
                    if (text == "")
                    {
                        this._type = SvgAngleType.SVG_ANGLETYPE_UNSPECIFIED;
                        return;
                    }
                }
                throw new SvgException("Invalid SvgAngle", s);
            }
        }
Beispiel #3
0
        public void FromString(string s)
        {
            int i = s.LastIndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' });
            if (i == -1)
                return;

            _num = int.Parse(s.Substring(0, i + 1));

            switch (s.Substring(i + 1)) {
                case "grad":
                    _type = SvgAngleType.SVG_ANGLETYPE_GRAD;
                    break;
                case "rad":
                    _type = SvgAngleType.SVG_ANGLETYPE_RAD;
                    break;
                case "deg":
                    _type = SvgAngleType.SVG_ANGLETYPE_DEG;
                    break;
                case "":
                    _type = SvgAngleType.SVG_ANGLETYPE_UNSPECIFIED;
                    break;
                default:
                    throw new SvgException("Invalid SvgAngle", s);
            }
        }
Beispiel #4
0
 public SvgAngle(float num, SvgAngleType type)
 {
     _num = num;
     _type = type;
 }
Beispiel #5
0
 public SvgAngle(float num, SvgAngleType type)
 {
     Value = num;
     Type  = type;
 }
Beispiel #6
0
 /// <summary>
 ///  Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
 /// </summary>
 /// <param name="unitType">The unitType for the angle value (e.g., SvgAngleTypeDEG).</param>
 /// <param name="valueInSpecifiedUnits">The angle value</param>
 public void NewValueSpecifiedUnits(SvgAngleType unitType, double valueInSpecifiedUnits)
 {
     cssAngle.SetFloatValue((CssPrimitiveType)unitType, valueInSpecifiedUnits);
 }
Beispiel #7
0
 /// <summary>
 ///  Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueAsSpecified and valueAsString might be modified as a result of this method.
 /// </summary>
 /// <param name="unitType">The unitType to switch to (e.g., SvgAngleTypeDEG).</param>
 public void ConvertToSpecifiedUnits(SvgAngleType unitType)
 {
     double newValue = cssAngle.GetFloatValue((CssPrimitiveType)unitType);
     cssAngle.SetFloatValue((CssPrimitiveType)unitType, newValue);
 }
Beispiel #8
0
 internal SvgAngle(SvgAngleType unitType, float value)
 {
     this.UnitType = unitType;
     this.Value    = value;
 }
 /// <summary>
 ///  Reset the value as a number with an associated unitType, thereby replacing the values
 ///  for all of the attributes on the object.
 /// </summary>
 /// <param name="unitType">The unitType for the angle value (e.g., SvgAngleTypeDEG).</param>
 /// <param name="valueInSpecifiedUnits">The angle value</param>
 public void NewValueSpecifiedUnits(SvgAngleType unitType, double valueInSpecifiedUnits)
 {
     _cssAngle.SetFloatValue((CssPrimitiveType)unitType, valueInSpecifiedUnits);
 }
Beispiel #10
0
 public void NewValueSpecifiedUnits(SvgAngleType unitType, double valueInSpecifiedUnits) { }
Beispiel #11
0
 public void ConvertToSpecifiedUnits(SvgAngleType unitType)
 {
 }
Beispiel #12
0
 public void NewValueSpecifiedUnits(SvgAngleType unitType, double valueInSpecifiedUnits)
 {
 }
Beispiel #13
0
 public SvgAngle(float num, SvgAngleType type)
 {
     _num  = num;
     _type = type;
 }
Beispiel #14
0
 public SvgAngle(double num, SvgAngleType type)
     : this((float)num, type)
 {
 }
        /// <summary>
        ///  Preserve the same underlying stored value, but reset the stored unit identifier to the given
        ///  unitType. Object attributes unitType, valueAsSpecified and valueAsString might be modified
        ///  as a result of this method.
        /// </summary>
        /// <param name="unitType">The unitType to switch to (e.g., SvgAngleTypeDEG).</param>
        public void ConvertToSpecifiedUnits(SvgAngleType unitType)
        {
            double newValue = _cssAngle.GetFloatValue((CssPrimitiveType)unitType);

            _cssAngle.SetFloatValue((CssPrimitiveType)unitType, newValue);
        }
Beispiel #16
0
 public SvgAngle(float num, SvgAngleType type)
 {
     this._num  = num;
     this._type = type;
 }
Beispiel #17
0
 public void ConvertToSpecifiedUnits(SvgAngleType unitType) { }
Beispiel #18
0
 public SvgAngle(double num, SvgAngleType type)
     : this((float)num, type)
 {
 }