public class SVGUniverse extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected double |
curTime
Current time in this universe.
|
static String |
INPUTSTREAM_SCHEME |
static long |
serialVersionUID |
Constructor and Description |
---|
SVGUniverse()
Creates a new instance of SVGUniverse
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l) |
void |
clear()
Release all loaded SVG document from memory
|
SVGUniverse |
duplicate()
Uses serialization to duplicate this universe.
|
double |
getCurTime()
Returns the current animation time in milliseconds.
|
Font |
getDefaultFont() |
SVGDiagram |
getDiagram(URI xmlBase) |
SVGDiagram |
getDiagram(URI xmlBase,
boolean loadIfAbsent)
Returns the diagram that has been loaded from this root.
|
SVGElement |
getElement(URI path)
Returns the element of the document at the given URI.
|
SVGElement |
getElement(URI path,
boolean loadIfAbsent)
Looks up a href within our universe.
|
SVGElement |
getElement(URL path) |
Font |
getFont(String fontName) |
ArrayList<URI> |
getLoadedDocumentURIs()
Get list of uris of all loaded documents and subdocuments.
|
URI |
getStreamBuiltURI(String name)
Synthesize a URI for an SVGDiagram constructed from a stream.
|
boolean |
isImageDataInlineOnly() |
boolean |
isVerbose() |
URI |
loadSVG(InputStream is,
String name) |
URI |
loadSVG(InputStream is,
String name,
boolean forceLoad) |
URI |
loadSVG(Reader reader,
String name) |
URI |
loadSVG(Reader reader,
String name,
boolean forceLoad)
This routine allows you to create SVG documents from data streams that
may not necessarily have a URL to load from.
|
protected URI |
loadSVG(URI xmlBase,
InputSource is) |
URI |
loadSVG(URL docRoot) |
URI |
loadSVG(URL docRoot,
boolean forceLoad)
Loads an SVG file and all the files it references from the URL provided.
|
void |
removeDocument(URI uri)
Remove loaded document from cache.
|
void |
removePropertyChangeListener(PropertyChangeListener l) |
void |
setCurTime(double curTime) |
void |
setImageDataInlineOnly(boolean imageDataInlineOnly) |
void |
setVerbose(boolean verbose) |
void |
updateTime()
Updates all time influenced style and presentation attributes in all SVG
documents in this universe.
|
public static final long serialVersionUID
public static final String INPUTSTREAM_SCHEME
protected double curTime
public SVGUniverse()
public void addPropertyChangeListener(PropertyChangeListener l)
public void removePropertyChangeListener(PropertyChangeListener l)
public void clear()
public double getCurTime()
public void setCurTime(double curTime)
public void updateTime() throws SVGException
SVGException
public Font getDefaultFont()
public SVGElement getElement(URI path)
public SVGElement getElement(URL path)
public SVGElement getElement(URI path, boolean loadIfAbsent)
public SVGDiagram getDiagram(URI xmlBase)
public SVGDiagram getDiagram(URI xmlBase, boolean loadIfAbsent)
public URI loadSVG(URL docRoot, boolean forceLoad)
docRoot
- - URL to the location where this SVG file can be found.forceLoad
- - if true, ignore cached diagram and reloadpublic URI loadSVG(InputStream is, String name) throws IOException
IOException
public URI loadSVG(InputStream is, String name, boolean forceLoad) throws IOException
IOException
public URI loadSVG(Reader reader, String name, boolean forceLoad)
reader
- - A stream containing a valid SVG documentname
- - A unique name for this document. It will be used to construct a unique URI to refer to this document and perform resolution with relative URIs within this document.
For example, a name of "/myScene" will produce the URI svgSalamander:/myScene. "/maps/canada/toronto" will produce svgSalamander:/maps/canada/toronto. If this second document then contained the href "../uk/london", it would resolve by default to svgSalamander:/maps/uk/london. That is, SVG Salamander defines the URI scheme svgSalamander for it's own internal use and uses it for uniquely identfying documents loaded by stream.
If you need to link to documents outside of this scheme, you can either supply full hrefs (eg, href="url(http://www.kitfox.com/index.html)") or put the xml:base attribute in a tag to change the defaultbase URIs are resolved against
If a name does not start with the character '/', it will be automatically prefixed to it.
forceLoad
- - if true, ignore cached diagram and reloadpublic URI getStreamBuiltURI(String name)
name
- - Name given the document constructed from a stream.protected URI loadSVG(URI xmlBase, InputSource is)
public ArrayList<URI> getLoadedDocumentURIs()
public void removeDocument(URI uri)
uri
- public boolean isVerbose()
public void setVerbose(boolean verbose)
public SVGUniverse duplicate() throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public boolean isImageDataInlineOnly()
public void setImageDataInlineOnly(boolean imageDataInlineOnly)
imageDataInlineOnly
- the imageDataInlineOnly to setCopyright © 2011-2019 Kitfox Studios. All Rights Reserved.