org.w3c.dom.svg
Interface SVGSVGElement

All Superinterfaces:
Element, EventTarget, Node, SVGElement, SVGLocatableElement

public interface SVGSVGElement
extends SVGLocatableElement

This interface represents <svg> element in (SVG) document tree.

User Agent Transforms

The DOM attributes currentScale, currentRotate and currentTranslate are combined to form user agent transformation which is applied at the outermost level on the SVG document (i.e., outside the outermost 'svg' element) if "magnification" is enabled (i.e., zoomAndPan attribute is set to "magnify"). Their values can potentialy be modified through user-agent specific UI. User agent transformation can be obtained by multiplying matrix

 [currentScale      0       currentTranslate.x]         [cos(currentRotate) -sin(currentRotate 0]
 [     0      currentScale  currentTranslate.y]  by     [sin(currentRotate) cos(currentRotate) 0]
 [     0            0               1         ]         [         0                  0         1]
 

i.e. (translate, then scale, then rotate the coordinate system). The reference point for scale and rotate operations is the origin (0, 0).

Note: If the application does not have the necessary privilege rights to access this (SVG) content, a SecurityException may be thrown by the underlying implementation. This is applicable to all the Tree navigation and Trait acessor methods. Features such as zooming, panning and playing of animations will not be affected.


Method Summary
 SVGMatrix createSVGMatrixComponents(float a, float b, float c, float d, float e, float f)
          Creates new SVGMatrix object.
 SVGPath createSVGPath()
          Creates new SVGPath object.
 SVGRect createSVGRect()
          Creates new SVGRect object.
 SVGRGBColor createSVGRGBColor(int red, int green, int blue)
          Creates new SVGRGBColor object.
 float getCurrentRotate()
          Returns current user agent rotation angle in degrees.
 float getCurrentScale()
          Returns current user agent scale (zoom) coefficient.
 float getCurrentTime()
          Returns current animation timeline time in seconds.
 SVGPoint getCurrentTranslate()
          Current user agent translation used for scrolling or panning (The returned SVGPoint object is "live" and setting its x and y components will change user agent's translation).
 void setCurrentRotate(float value)
          Sets current user agent rotate coefficient in degrees.
 void setCurrentScale(float value)
          Sets current user agent scale (zoom) coefficient.
 void setCurrentTime(float seconds)
          Sets current animation timeline time (in seconds).
 
Methods inherited from interface org.w3c.dom.svg.SVGLocatableElement
getBBox, getScreenBBox, getScreenCTM
 
Methods inherited from interface org.w3c.dom.svg.SVGElement
getFirstElementChild, getFloatTrait, getId, getMatrixTrait, getNextElementSibling, getPathTrait, getRectTrait, getRGBColorTrait, getTrait, getTraitNS, setFloatTrait, setId, setMatrixTrait, setPathTrait, setRectTrait, setRGBColorTrait, setTrait, setTraitNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getLocalName, getNamespaceURI, getParentNode, insertBefore, removeChild
 
Methods inherited from interface org.w3c.dom.events.EventTarget
addEventListener, removeEventListener
 

Method Detail

setCurrentScale

void setCurrentScale(float value)
                     throws DOMException
Sets current user agent scale (zoom) coefficient.

Parameters:
value - the value of user agent scale coefficient to be set.
Throws:
DOMException - with error code INVALID_ACCESS_ERR if the scale value is set to zero.

getCurrentScale

float getCurrentScale()
Returns current user agent scale (zoom) coefficient. The initial value for currentScale is 1.

Returns:
the current user agent scale coefficient.

setCurrentRotate

void setCurrentRotate(float value)
Sets current user agent rotate coefficient in degrees.

Parameters:
value - the value of user agent rotate coefficient to be set.

getCurrentRotate

float getCurrentRotate()
Returns current user agent rotation angle in degrees. The initial value for currentRotate is 0.

Returns:
the current user agent rotation coefficient in degrees.

getCurrentTranslate

SVGPoint getCurrentTranslate()
Current user agent translation used for scrolling or panning (The returned SVGPoint object is "live" and setting its x and y components will change user agent's translation). The initial values for currentTranslate is SVGPoint(0,0).

Returns:
returns the current user agent translation.

getCurrentTime

float getCurrentTime()
Returns current animation timeline time in seconds.

Returns:
the current animation timeline time in seconds.

setCurrentTime

void setCurrentTime(float seconds)
Sets current animation timeline time (in seconds). This API is required to support moving forwards in timeline. The underlying implementations are normally designed to seek forward in time and setting the time backwards is not meant to play the animation backwards. Note: Moving backwards in time is a costly feature for the implementations to support.

Parameters:
seconds - the value of time to be set in seconds.

createSVGMatrixComponents

SVGMatrix createSVGMatrixComponents(float a,
                                    float b,
                                    float c,
                                    float d,
                                    float e,
                                    float f)
Creates new SVGMatrix object. This object can be used to modify value of traits which are compatible with SVGMatrix type using setMatrixTrait method. The internal representation of the matrix is as follows:

  [  a  c  e  ]
  [  b  d  f  ]
  [  0  0  1  ]
 

Parameters:
a - the 'a' component of the matrix to be set.
b - the 'b' component of the matrix to be set.
c - the 'c' component of the matrix to be set.
d - the 'd' component of the matrix to be set.
e - the 'e' component of the matrix to be set.
f - the 'f' component of the matrix to be set.
Returns:
the newly created SVGMatrix object.
See Also:
SVGMatrix

createSVGRect

SVGRect createSVGRect()
Creates new SVGRect object. This object can be used to modify value of traits which are compatible with SVGRect type using setRectTrait method. The intial values for x, y, width, height of this new SVGRect are zero.

Returns:
the newly created SVGRect object.

createSVGPath

SVGPath createSVGPath()
Creates new SVGPath object. This object can be used to modify value of traits which are compatible with SVGPath type using setPathTrait method.

Returns:
the newly created SVGPath object with empty path commands.

createSVGRGBColor

SVGRGBColor createSVGRGBColor(int red,
                              int green,
                              int blue)
                              throws SVGException
Creates new SVGRGBColor object. This object can be used to modify value of traits which are compatible with SVGRGBColor type using setRGBColorTrait method.

Parameters:
red - the red component of SVGRGBColor object.
green - the green component of SVGRGBColor object.
blue - the blue component of SVGRGBColor object.
Returns:
the newly created SVGRGBColor object with specified (r,g,b) values.
Throws:
SVGException - with error code SVG_INVALID_VALUE_ERR: if any of the parameters is not in the 0..255 range.


Copyright © 2003-2006 Nokia Corporation. See the Copyright Notice for details.