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
elementsdescription, fill, stroke, title, transform| Constructor and Description |
|---|
SvgDocument() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
add(SvgElement element) |
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. |
apply, getElementsgetFill, getStroke, getTransformgetAncestry, getContainer, getElement, getId, getViewport, setContainerpublic 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.void add(SvgElement element)
add in class SvgContainerpublic 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()
SvgGraphicdesc 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 SvgGraphicdesc of this svg elementpublic SvgFragment getFragment()
getFragment in class SvgElementpublic SvgFragment getFragment(java.lang.String id)
id - public SvgFragment[] getFragments()
public java.lang.String getTitle()
SvgGraphictitle 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 SvgGraphictitle of this svg elementpublic boolean hasFragment(java.lang.String id)
id - the id of the fragmentpublic boolean isEmpty()
SvgContainerisEmpty in class SvgContainer