public class SVGSVGElement extends SVGElement
A key interface definition is the SVGSVGElement
interface, which is the interface that corresponds to the svg element. This interface contains
various miscellaneous commonly-used utility methods, such as matrix operations
and the ability to control the time of redraw on visual rendering devices.
SVGSVGElement
extends ViewCSS
and DocumentCSS
to provide access to the computed values of
properties and the override style sheet as described in DOM
Level 2 Style [DOM2STYLE].
Modifier | Constructor and Description |
---|---|
protected |
SVGSVGElement() |
Modifier and Type | Method and Description |
---|---|
boolean |
animationsPaused()
Returns true if this SVG document fragment is in a paused state.
|
boolean |
checkEnclosure(SVGElement element,
OMSVGRect rect)
Returns true if the rendered content of the given element is entirely contained
within the supplied rectangle.
|
boolean |
checkIntersection(SVGElement element,
OMSVGRect rect)
Returns true if the rendered content of the given element intersects the
supplied rectangle.
|
OMSVGAngle |
createSVGAngle()
Creates an
OMSVGAngle object outside of
any document trees. |
OMSVGLength |
createSVGLength()
Creates an
OMSVGLength object outside of
any document trees. |
OMSVGMatrix |
createSVGMatrix()
Creates an
OMSVGMatrix object outside of
any document trees. |
OMSVGNumber |
createSVGNumber()
Creates an
OMSVGNumber object outside of
any document trees. |
OMSVGPoint |
createSVGPoint()
Creates an
OMSVGPoint object outside of
any document trees. |
OMSVGRect |
createSVGRect()
Creates an
OMSVGRect object outside of any
document trees. |
OMSVGTransform |
createSVGTransform()
Creates an
OMSVGTransform object outside
of any document trees. |
OMSVGTransform |
createSVGTransformFromMatrix(OMSVGMatrix matrix)
Creates an |
void |
deselectAll()
Unselects any selected objects, including any selections of text strings
and type-in bars.
|
void |
forceRedraw()
In rendering environments supporting interactivity, forces the user agent
to immediately redraw all regions of the viewport that require updating.
|
OMSVGRect |
getBBox()
Returns the tight bounding box in current user space (i.e., after application
of the
transform attribute, if any) on the geometry of all
contained graphics elements, exclusive of stroking, clipping, masking and
filter effects). |
String |
getContentScriptType()
Corresponds to attribute
getContentScriptType()
on the given svg element. |
String |
getContentStyleType()
Corresponds to attribute
getContentStyleType()
on the given svg element. |
OMSVGMatrix |
getCTM()
Returns the transformation matrix from current user units (i.e., after
application of the
transform attribute, if any) to the viewport
coordinate system for the ISVGLocatable.getNearestViewportElement() . |
float |
getCurrentScale()
On an outermost svg element, this attribute indicates
the current scale factor relative to the initial view to take into account
user magnification and panning operations, as described under Magnification
and panning.
|
float |
getCurrentTime()
Returns the current time in seconds relative to the start time for the
current SVG document fragment.
|
OMSVGPoint |
getCurrentTranslate()
On an outermost svg element, the corresponding translation
factor that takes into account user "magnification".
|
OMSVGViewSpec |
getCurrentView()
The definition of the initial view (i.e., before magnification and panning)
of the current innermost SVG document fragment.
|
com.google.gwt.dom.client.Element |
getElementById(String elementId)
Searches this SVG document fragment (i.e., the search is restricted to
a subset of the document tree) for an Element whose id is given by elementId.
|
com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> |
getEnclosureList(OMSVGRect rect,
SVGElement referenceElement)
Returns the list of graphics elements whose rendered content is entirely
contained within the supplied rectangle.
|
OMSVGAnimatedBoolean |
getExternalResourcesRequired()
Corresponds to attribute
ISVGExternalResourcesRequired.getExternalResourcesRequired()
on the given element. |
SVGElement |
getFarthestViewportElement()
The farthest ancestor svg element.
|
OMSVGAnimatedLength |
getHeight()
Corresponds to attribute
getHeight()
on the given svg element. |
com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> |
getIntersectionList(OMSVGRect rect,
SVGElement referenceElement)
Returns the list of graphics elements whose rendered content intersects
the supplied rectangle.
|
SVGElement |
getNearestViewportElement()
The element which established the current viewport.
|
float |
getPixelUnitToMillimeterX()
Size of a pixel units (as defined by CSS2) along the x-axis of the viewport,
which represents a unit somewhere in the range of 70dpi to 120dpi, and,
on systems that support this, might actually match the characteristics
of the target medium.
|
float |
getPixelUnitToMillimeterY()
Corresponding size of a pixel unit along the y-axis of the viewport.
|
OMSVGAnimatedPreserveAspectRatio |
getPreserveAspectRatio()
Corresponds to attribute
ISVGFitToViewBox.getPreserveAspectRatio()
on the given element. |
OMSVGStringList |
getRequiredExtensions()
Corresponds to attribute
ISVGTests.getRequiredExtensions()
on the given element. |
OMSVGStringList |
getRequiredFeatures()
Corresponds to attribute
ISVGTests.getRequiredFeatures()
on the given element. |
OMSVGMatrix |
getScreenCTM()
Returns the transformation matrix from current user units (i.e., after
application of the
transform attribute, if any) to the parent
user agent's notice of a "pixel". |
float |
getScreenPixelToMillimeterX()
User interface (UI) events in DOM Level 2 indicate the screen positions
at which the given UI event occurred.
|
float |
getScreenPixelToMillimeterY()
Corresponding size of a screen pixel along the y-axis of the viewport.
|
OMSVGStringList |
getSystemLanguage()
Corresponds to attribute
ISVGTests.getSystemLanguage()
on the given element. |
OMSVGMatrix |
getTransformToElement(SVGElement element)
Returns the transformation matrix from the user coordinate system on the
current element (after application of the
transform attribute,
if any) to the user coordinate system on parameter element (after
application of its transform attribute, if any). |
boolean |
getUseCurrentView()
The initial view (i.e., before magnification and panning) of the current
innermost SVG document fragment can be either the "standard" view (i.e.,
based on attributes on the svg element such as
svg/viewBox )
or to a "custom" view (i.e., a hyperlink into a particular view or other element - see Linking
into SVG content: URI fragments and SVG views). |
OMSVGAnimatedRect |
getViewBox()
Corresponds to attribute
ISVGFitToViewBox.getViewBox()
on the given element. |
OMSVGRect |
getViewport()
The position and size of the viewport (implicit or explicit) that corresponds
to this svg element.
|
OMSVGAnimatedLength |
getWidth()
Corresponds to attribute
getWidth()
on the given svg element. |
OMSVGAnimatedLength |
getX()
|
String |
getXmllang()
Corresponds to attribute
xml:lang on the given element. |
String |
getXmlspace()
Corresponds to attribute
xml:space on the given element. |
OMSVGAnimatedLength |
getY()
|
short |
getZoomAndPan()
Corresponds to attribute
ISVGZoomAndPan.getZoomAndPan()
on the given element. |
boolean |
hasExtension(String extension)
Returns true if the user agent supports the given extension, specified
by a URI.
|
void |
pauseAnimations()
Suspends (i.e., pauses) all currently running animations that are defined
within the SVG document fragment corresponding to this svg element, causing the animation
clock corresponding to this document fragment to stand still until it is
unpaused.
|
void |
setContentScriptType(String value)
Corresponds to attribute
getContentScriptType()
on the given svg element. |
void |
setContentStyleType(String value)
Corresponds to attribute
getContentStyleType()
on the given svg element. |
void |
setCurrentScale(float value)
On an outermost svg element, this attribute indicates
the current scale factor relative to the initial view to take into account
user magnification and panning operations, as described under Magnification
and panning.
|
void |
setCurrentTime(float seconds)
Adjusts the clock for this SVG document fragment, establishing a new current
time.
|
void |
setXmllang(String value)
Corresponds to attribute
xml:lang on the given element. |
void |
setXmlspace(String value)
Corresponds to attribute
xml:space on the given element. |
void |
setZoomAndPan(short value)
Corresponds to attribute
ISVGZoomAndPan.getZoomAndPan()
on the given element. |
int |
suspendRedraw(int maxWaitMilliseconds)
Takes a time-out value which indicates that redraw shall not occur until:
the corresponding unsuspendRedraw() call has been made,
an unsuspendRedrawAll() call has been made, or its timer
has timed out.
|
void |
unpauseAnimations()
Unsuspends (i.e., unpauses) currently running animations that are defined
within the SVG document fragment, causing the animation clock to continue
from the time at which it was suspended.
|
void |
unsuspendRedraw(int suspendHandleID)
Cancels a specified suspendRedraw() by providing a unique suspend handle
ID that was returned by a previous suspendRedraw() call.
|
void |
unsuspendRedrawAll()
Cancels all currently active suspendRedraw() method calls.
|
getClassName_, getMarkup, getOwnerSVGElement, getViewportElement, getXmlbase, setXmlbase
addClassName, as, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPreviousSiblingElement, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasClassName, hasTagName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerSafeHtml, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle, toggleClassName
appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeAllChildren, removeChild, removeFromParent, replaceChild, setNodeValue
public final OMSVGAnimatedLength getX()
public final OMSVGAnimatedLength getY()
public final OMSVGAnimatedLength getWidth()
getWidth()
on the given svg element.public final OMSVGAnimatedLength getHeight()
getHeight()
on the given svg element.public final String getContentScriptType()
getContentScriptType()
on the given svg element.public final void setContentScriptType(String value) throws com.google.gwt.core.client.JavaScriptException
getContentScriptType()
on the given svg element.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final String getContentStyleType()
getContentStyleType()
on the given svg element.public final void setContentStyleType(String value) throws com.google.gwt.core.client.JavaScriptException
getContentStyleType()
on the given svg element.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final OMSVGRect getViewport()
The position and size of the viewport (implicit or explicit) that corresponds to this svg element. When the user agent is actually rendering the content, then the position and size values represent the actual values when rendering. The position and size values are unitless values in the coordinate system of the parent element. If no parent element exists (i.e., svg element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML 'object' element), then the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL viewport, as described in the CSS2 specification.) If the parent element does not have a coordinate system, then the user agent should provide reasonable default values for this attribute.
public final float getPixelUnitToMillimeterX()
public final float getPixelUnitToMillimeterY()
public final float getScreenPixelToMillimeterX()
public final float getScreenPixelToMillimeterY()
public final boolean getUseCurrentView()
svg/viewBox
)
or to a "custom" view (i.e., a hyperlink into a particular view or other element - see Linking
into SVG content: URI fragments and SVG views). If the initial view
is the "standard" view, then this attribute is false. If the initial view
is a "custom" view, then this attribute is true.public final OMSVGViewSpec getCurrentView()
The definition of the initial view (i.e., before magnification and panning) of the current innermost SVG document fragment. The meaning depends on the situation:
ISVGFitToViewBox.getViewBox()
,
ISVGFitToViewBox.getPreserveAspectRatio()
and ISVGZoomAndPan.getZoomAndPan()
within getCurrentView()
will match the values for the corresponding DOM attributes that are
on SVGSVGElement directlyISVGViewSpec.getTransform()
and ISVGViewSpec.getViewTarget()
within getCurrentView()
will be nullISVGFitToViewBox.getViewBox()
,
ISVGFitToViewBox.getPreserveAspectRatio()
and ISVGZoomAndPan.getZoomAndPan()
within getCurrentView()
will correspond to the corresponding attributes for the given view elementISVGViewSpec.getTransform()
and ISVGViewSpec.getViewTarget()
within getCurrentView()
will
be nullISVGFitToViewBox.getViewBox()
,
ISVGFitToViewBox.getPreserveAspectRatio()
and ISVGZoomAndPan.getZoomAndPan()
within getCurrentView()
will match the values for the corresponding DOM attributes that are
on SVGSVGElement directly for the closest ancestor svg elementISVGViewSpec.getTransform()
within
getCurrentView()
will
be nullISVGViewSpec.getViewTarget()
within getCurrentView()
will represent the target of the linkISVGFitToViewBox.getViewBox()
,
ISVGFitToViewBox.getPreserveAspectRatio()
,
ISVGZoomAndPan.getZoomAndPan()
,
ISVGViewSpec.getTransform()
and
ISVGViewSpec.getViewTarget()
within
getCurrentView()
will correspond to the values from the SVG view specification fragment
identifierThe object itself and its contents are both read only.
public final float getCurrentScale()
getCurrentScale()
and getCurrentTranslate()
are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
If "magnification" is enabled (i.e., zoomAndPan="magnify"),
then the effect is as if an extra transformation were placed at the outermost
level on the SVG document fragment (i.e., outside the outermost svg element). When accessed on an svg element that is not an outermost svg element, it is undefined what behavior this attribute has.
public final void setCurrentScale(float value)
getCurrentScale()
and getCurrentTranslate()
are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
If "magnification" is enabled (i.e., zoomAndPan="magnify"),
then the effect is as if an extra transformation were placed at the outermost
level on the SVG document fragment (i.e., outside the outermost svg element). When accessed on an svg element that is not an outermost svg element, it is undefined what behavior this attribute has.
public final OMSVGPoint getCurrentTranslate()
public final int suspendRedraw(int maxWaitMilliseconds)
In environments that do not support interactivity (e.g., print media), then redraw shall not be suspended. Calls to suspendRedraw() and unsuspendRedraw() should, but need not be, made in balanced pairs.
To suspend redraw actions as a collection of SVG DOM changes occur, precede the changes to the SVG DOM with a method call similar to:
suspendHandleID = suspendRedraw(maxWaitMilliseconds);
and follow the changes with a method call similar to:
unsuspendRedraw(suspendHandleID);
Note that multiple suspendRedraw calls can be used at once and that each such method call is treated independently of the other suspendRedraw method calls.
maxWaitMilliseconds
- The amount of time in milliseconds to hold
off before redrawing the device. Values greater than 60 seconds will
be truncated down to 60 seconds.public final void unsuspendRedraw(int suspendHandleID)
suspendHandleID
- A number which acts as a unique identifier for
the desired suspendRedraw() call. The number supplied must be a value
returned from a previous call to suspendRedraw(). If an invalid handle
ID value is provided then the request to unsuspendRedraw() is silently
ignored.public final void unsuspendRedrawAll()
public final void forceRedraw()
public final void pauseAnimations()
public final void unpauseAnimations()
public final boolean animationsPaused()
public final float getCurrentTime()
public final void setCurrentTime(float seconds)
seconds
- The new current time in seconds relative to the start
time for the current SVG document fragment.public final com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> getIntersectionList(OMSVGRect rect, SVGElement referenceElement)
pointer-events
processing.rect
- The test rectangle. The values are in the initial coordinate
system
for the current svg element.referenceElement
- If not null, then any intersected element that
doesn't have the referenceElement as ancestor must not be included in
the returned NodeList.NodeList
must be implemented identically
to the NodeList
interface as defined
in DOM Level 2 Core ([DOM2], section
1.2) with the exception that the interface is not live.public final com.google.gwt.dom.client.NodeList<? extends com.google.gwt.dom.client.Node> getEnclosureList(OMSVGRect rect, SVGElement referenceElement)
pointer-events
processing.rect
- The test rectangle. The values are in the initial coordinate
system
for the current svg element.referenceElement
- If not null, then any intersected element that
doesn't have the referenceElement as ancestor must not be included in
the returned NodeList.NodeList
must be implemented
identically to the NodeList
interface
as defined in DOM Level 2 Core ([DOM2],
section 1.2) with the exception that the interface is not live.public final boolean checkIntersection(SVGElement element, OMSVGRect rect)
pointer-events
processing.element
- The element on which to perform the given test.rect
- The test rectangle. The values are in the initial coordinate
system
for the current svg element.public final boolean checkEnclosure(SVGElement element, OMSVGRect rect)
pointer-events
processing.element
- The element on which to perform the given test.rect
- The test rectangle. The values are in the initial coordinate
system
for the current svg element.public final void deselectAll()
public final OMSVGNumber createSVGNumber()
OMSVGNumber
object outside of
any document trees. The object is initialized to a value of zero.OMSVGNumber
object.public final OMSVGLength createSVGLength()
OMSVGLength
object outside of
any document trees. The object is initialized to the value of 0 user units.OMSVGLength
object.public final OMSVGAngle createSVGAngle()
OMSVGAngle
object outside of
any document trees. The object is initialized to the value 0 degrees (unitless).OMSVGAngle
object.public final OMSVGPoint createSVGPoint()
OMSVGPoint
object outside of
any document trees. The object is initialized to the point (0,0) in the
user coordinate system.OMSVGPoint
object.public final OMSVGMatrix createSVGMatrix()
OMSVGMatrix
object outside of
any document trees. The object is initialized to the identity matrix.OMSVGMatrix
object.public final OMSVGRect createSVGRect()
OMSVGRect
object outside of any
document trees. The object is initialized such that all values are set
to 0 user units.OMSVGRect
object.public final OMSVGTransform createSVGTransform()
OMSVGTransform
object outside
of any document trees. The object is initialized to an identity matrix
transform (SVG_TRANSFORM_MATRIX).OMSVGTransform
object.public final OMSVGTransform createSVGTransformFromMatrix(OMSVGMatrix matrix)
Creates an OMSVGTransform
object outside of any document trees. The object is initialized to the
given matrix transform (i.e., SVG_TRANSFORM_MATRIX). The values from the
parameter matrix are copied, the matrix parameter
is not adopted as SVGTransform::matrix.
matrix
- The transform matrix.OMSVGTransform
object.public final com.google.gwt.dom.client.Element getElementById(String elementId)
elementId
- The unique id value for an element.public final OMSVGAnimatedBoolean getExternalResourcesRequired()
ISVGExternalResourcesRequired.getExternalResourcesRequired()
on the given element. Note that the SVG DOM defines the attribute ISVGExternalResourcesRequired.getExternalResourcesRequired()
as being of type OMSVGAnimatedBoolean
, whereas
the SVG language definition says that ISVGExternalResourcesRequired.getExternalResourcesRequired()
is not animated. Because the SVG language definition states that ISVGExternalResourcesRequired.getExternalResourcesRequired()
cannot be animated, the OMSVGAnimatedBoolean.getAnimVal()
will always be the same as the OMSVGAnimatedBoolean.getBaseVal()
.public final OMSVGAnimatedRect getViewBox()
ISVGFitToViewBox.getViewBox()
on the given element.public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio()
ISVGFitToViewBox.getPreserveAspectRatio()
on the given element.public final String getXmllang()
xml:lang
on the given element.public final void setXmllang(String value) throws com.google.gwt.core.client.JavaScriptException
xml:lang
on the given element.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final String getXmlspace()
xml:space
on the given element.public final void setXmlspace(String value) throws com.google.gwt.core.client.JavaScriptException
xml:space
on the given element.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final SVGElement getNearestViewportElement()
public final SVGElement getFarthestViewportElement()
public final OMSVGRect getBBox()
transform
attribute, if any) on the geometry of all
contained graphics elements, exclusive of stroking, clipping, masking and
filter effects). Note that getBBox must return the actual bounding box
at the time the method was called, even in case the element has not yet
been rendered.OMSVGRect
object that defines
the bounding box.public final OMSVGMatrix getCTM()
transform
attribute, if any) to the viewport
coordinate system for the ISVGLocatable.getNearestViewportElement()
.OMSVGMatrix
object that defines
the CTM.public final OMSVGMatrix getScreenCTM()
transform
attribute, if any) to the parent
user agent's notice of a "pixel". For display devices, ideally this represents
a physical screen pixel. For other devices or environments where physical
pixel sizes are not known, then an algorithm similar to the CSS2 definition
of a "pixel" can be used instead. Note that null is returned if this element
is not hooked into the document tree. This method would have been more
aptly named as getClientCTM
, but the name getScreenCTM
is kept for historical reasons.OMSVGMatrix
object that defines
the given transformation matrix.public final OMSVGMatrix getTransformToElement(SVGElement element) throws com.google.gwt.core.client.JavaScriptException
transform
attribute,
if any) to the user coordinate system on parameter element (after
application of its transform
attribute, if any).element
- The target element.OMSVGMatrix
object that defines
the transformation.SVGException(SVG_MATRIX_NOT_INVERTABLE)
- Raised if the currently
defined transformation matrices make it impossible to compute the given
matrix (e.g., because one of the transformations is singular).com.google.gwt.core.client.JavaScriptException
public final OMSVGStringList getRequiredFeatures()
ISVGTests.getRequiredFeatures()
on the given element.public final OMSVGStringList getRequiredExtensions()
ISVGTests.getRequiredExtensions()
on the given element.public final OMSVGStringList getSystemLanguage()
ISVGTests.getSystemLanguage()
on the given element.public final boolean hasExtension(String extension)
extension
- The name of the extension, expressed as a URI.public final short getZoomAndPan()
ISVGZoomAndPan.getZoomAndPan()
on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
defined on this interface.public final void setZoomAndPan(short value) throws com.google.gwt.core.client.JavaScriptException
ISVGZoomAndPan.getZoomAndPan()
on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
defined on this interface.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
Copyright © 2018. All Rights Reserved.