public class SvgDocument extends SvgContainer
The SvgDocument is the base for all svg graphics. It is used to load an svg document from an inputstream or directly from a String.
An svg document may contain one or more svg fragments, each of which can be accessed individually.
See also: http://www.w3.org/TR/SVG
Modifier and Type | Method | Description |
---|---|---|
void |
apply(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle bounds) |
Apply this svg document to the given graphics context, scaled to fit within
the given bounds.
|
java.lang.String |
getDescription() |
Returns the value of the
desc element that is a child of this svg element. |
SvgFragment |
getFragment() |
|
SvgFragment |
getFragment(java.lang.String id) |
Returns the SvgFragment element within this document that corresponds to the given id.
|
SvgFragment[] |
getFragments() |
Returns an array of all the SvgFragment elements contained by this document.
|
java.lang.String |
getTitle() |
Returns the value of the
title element that is a child of this svg element. |
boolean |
hasFragment(java.lang.String id) |
Returns true if this document contains an SvgFragment with the given id.
|
boolean |
isEmpty() |
Returns true if this list contains no elements.
|
static SvgDocument |
load(java.io.InputStream in) |
Create a new SvgDocument from the contents of the given
InputStream . |
static SvgDocument |
load(java.lang.String src) |
Create a new SvgDocument from the contents of the given
String . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply, getElements
getId
public static SvgDocument load(java.io.InputStream in)
InputStream
.in
- an InputStream
containing the svg source.public static SvgDocument load(java.lang.String src)
String
.src
- an String
containing the svg source.public void apply(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds)
gc
- the graphics contextbounds
- the bounds to which this document will be scaledpublic java.lang.String getDescription()
SvgGraphic
desc
element that is a child of this svg element.
If there is no desc
element that is a direct decendent of this element, null
is returned.getDescription
in class SvgGraphic
desc
of this svg elementpublic SvgFragment getFragment()
public SvgFragment getFragment(java.lang.String id)
id
- public SvgFragment[] getFragments()
public java.lang.String getTitle()
SvgGraphic
title
element that is a child of this svg element.
If there is no title
element that is a direct decendent of this element, null
is returned.getTitle
in class SvgGraphic
title
of this svg elementpublic boolean hasFragment(java.lang.String id)
id
- the id of the fragmentpublic boolean isEmpty()
SvgContainer
isEmpty
in class SvgContainer