private void GetCssXmlValue() { if (_source == SvgLengthSource.Css) { ICssStyleDeclaration csd = _ownerElement.GetComputedStyle(string.Empty); CssPrimitiveLengthValue cssValue = csd.GetPropertyCssValue(_propertyName) as CssPrimitiveLengthValue; if (cssValue != null) { _cssLength = new CssAbsPrimitiveLengthValue(cssValue, _propertyName, _ownerElement); } else { throw new DomException(DomExceptionType.SyntaxErr, "Not a length value"); } } else { string baseVal = _ownerElement.GetAttribute(_propertyName); if (baseVal == null || baseVal.Length == 0) { baseVal = _defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); _cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), _propertyName, _ownerElement); } }
/// <summary> /// Creates a SvgLength value /// </summary> /// <param name="baseVal">String to be parsed into a length</param> /// <param name="ownerElement">The associated element</param> /// <param name="direction">Direction of the length, used for percentages</param> public SvgLength(string propertyName, string baseVal, SvgElement ownerElement, SvgLengthDirection direction) { this.ownerElement = ownerElement; this.direction = direction; baseVal = SvgNumber.ScientificToDec(baseVal); this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement); }
public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal, string defaultValue) : this(ownerElement, propertyName, SvgLengthSource.String, direction, defaultValue) { if (baseVal == null || baseVal.Length == 0) { baseVal = defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement); }
/// <summary> /// Creates a SvgAngle value /// </summary> /// <param name="s">The string to parse for the angle value</param> /// <param name="defaultValue">The default value for the angle.</param> /// <param name="readOnly">Specifies if the value should be read-only</param> public SvgAngle(string baseVal, string defaultValue, bool readOnly) { baseVal = baseVal.Trim(); if (baseVal.Length == 0) { baseVal = defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); _cssAngle = new CssPrimitiveAngleValue(baseVal, readOnly); _readOnly = readOnly; }
public SvgLength(string propertyName, string baseVal, string defaultValue, SvgElement ownerElement, SvgLengthDirection direction) { _ownerElement = ownerElement; _direction = direction; if (baseVal == null || baseVal.Length == 0) { baseVal = defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); _cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement); }
public SvgLength(string propertyName, SvgStyleableElement ownerElement, SvgLengthDirection direction, string defaultValue) { _ownerElement = ownerElement; _direction = direction; string baseVal = ownerElement.GetPropertyValue(propertyName); if (string.IsNullOrWhiteSpace(baseVal)) { baseVal = defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); _cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement); }
public SvgLength(string propertyName, SvgStyleableElement ownerElement, SvgLengthDirection direction, string defaultValue) { this.ownerElement = ownerElement; this.direction = direction; string baseVal = ownerElement.GetPropertyValue(propertyName); if (baseVal == null || baseVal == "") { baseVal = defaultValue; } baseVal = SvgNumber.ScientificToDec(baseVal); this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement); }