com.aspose.html.dom.svg.datatypes

Class SVGLength

  • All Implemented Interfaces:
    com.aspose.html.internal.ms.System.IDisposable


    @DOMObjectAttribute
     @DOMNameAttribute(name="SVGLength")
    public class SVGLength
    extends SVGValueType

    The SVGLength interface corresponds to the length basic data type. An SVGLength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

    • Constructor Detail

      • SVGLength

        public SVGLength(IBrowsingContext context)

        Initializes a new instance of the SVGLength class.

        Parameters:
        context - The context.
      • SVGLength

        public SVGLength(IBrowsingContext context,
                         float value,
                         int unitType)

        Initializes a new instance of the SVGLength class.

        Parameters:
        context - The context.
        value - The value.
        unitType - Type of the unit.
    • Method Detail

      • getUnitType

        @DOMNameAttribute(name="unitType")
        public int getUnitType()

        The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.

        Value: The type of the unit.
      • getValue

        @DOMNameAttribute(name="value")
        public float getValue()

        The value as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value.
      • setValue

        @DOMNameAttribute(name="value")
        public void setValue(float value)

        The value as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value.
      • getValueInSpecifiedUnits

        @DOMNameAttribute(name="valueInSpecifiedUnits")
        public float getValueInSpecifiedUnits()

        The value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value in specified units.
      • setValueInSpecifiedUnits

        @DOMNameAttribute(name="valueInSpecifiedUnits")
        public void setValueInSpecifiedUnits(float value)

        The value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value in specified units.
      • getValueAsString

        @DOMNameAttribute(name="valueAsString")
        public String getValueAsString()

        The value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.SYNTAX_ERR Raised if the assigned string cannot be parsed as a valid length.
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value as string.
      • setValueAsString

        @DOMNameAttribute(name="valueAsString")
        public void setValueAsString(String value)

        The value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.

        Throws:
        DOMException - Code DOMException.SYNTAX_ERR Raised if the assigned string cannot be parsed as a valid length.
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only. Value: The value as string.
      • newValueSpecifiedUnits

        @DOMNameAttribute(name="newValueSpecifiedUnits")
        public void newValueSpecifiedUnits(int unitType,
                                                                                             float valueInSpecifiedUnits)

        Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.

        Parameters:
        unitType - The unit type for the value.
        valueInSpecifiedUnits - The new value..
        Throws:
        DOMException - Code DOMException.NOT_SUPPORTED_ERR Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only.
      • convertToSpecifiedUnits

        @DOMNameAttribute(name="convertToSpecifiedUnits")
        public void convertToSpecifiedUnits(int unitType)

        Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueInSpecifiedUnits and valueAsString might be modified as a result of this method. For example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then the unitType would be changed to SVG_LENGTHTYPE_MM, valueInSpecifiedUnits would be changed to the numeric value 5 and valueAsString would be changed to "5mm".

        Parameters:
        unitType - The unit type to switch to (e.g., SVG_LENGTHTYPE_MM).
        Throws:
        DOMException - Code DOMException.NOT_SUPPORTED_ERR Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
        DOMException - Code DOMException.NO_MODIFICATION_ALLOWED_ERR Raised when the length corresponds to a read only attribute or when the object itself is read only.
      • deepClone

        public Object deepClone()

        Creates a new object that is a copy of the current instance.

        Specified by:
        deepClone in class SVGValueType
        Returns:
        A new object that is a copy of this instance.