public abstract class SVGElement extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<SVGElement> |
children |
protected String |
cssClass
CSS class.
|
protected SVGDiagram |
diagram
The diagram this element belongs to
|
protected String |
id |
protected HashMap<String,StyleAttribute> |
inlineStyles
Styles defined for this elemnt via the style attribute.
|
protected SVGElement |
parent |
protected HashMap<String,StyleAttribute> |
presAttribs
Presentation attributes set for this element.
|
static long |
serialVersionUID |
static String |
SVG_NS |
protected TrackManager |
trackManager
Link to the universe we reside in
|
protected URI |
xmlBase
This element may override the URI we resolve against with an xml:base
attribute.
|
| Constructor and Description |
|---|
SVGElement()
Creates a new instance of SVGElement
|
SVGElement(String id,
String cssClass,
SVGElement parent) |
SVGElement(String id,
SVGElement parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String name,
int attribType,
String value) |
protected void |
build()
Called by internal processes to rebuild the geometry of this node from
it's presentation attributes, style attributes and animated tracks.
|
protected static GeneralPath |
buildPath(String text,
int windingRule) |
SVGElement |
getChild(int i) |
SVGElement |
getChild(String id) |
List<SVGElement> |
getChildren(List<SVGElement> retVec) |
String |
getId() |
Set<String> |
getInlineAttributes() |
int |
getNumChildren() |
SVGElement |
getParent() |
protected SVGElement |
getParentContext() |
List<SVGElement> |
getPath(List<SVGElement> retVec) |
boolean |
getPres(StyleAttribute attrib)
Copies the presentation attribute into the passed one.
|
StyleAttribute |
getPresAbsolute(String styName) |
Set<String> |
getPresentationAttributes() |
SVGRoot |
getRoot() |
boolean |
getStyle(StyleAttribute attrib) |
boolean |
getStyle(StyleAttribute attrib,
boolean recursive) |
boolean |
getStyle(StyleAttribute attrib,
boolean recursive,
boolean evalAnimation)
Copies the current style into the passed style attribute.
|
StyleAttribute |
getStyleAbsolute(String styName) |
abstract String |
getTagName() |
URI |
getXMLBase() |
boolean |
hasAttribute(String name,
int attribType) |
int |
indexOfChild(SVGElement child)
Searches children for given element.
|
double |
lerp(double t0,
double t1,
double alpha) |
void |
loaderAddChild(SVGLoaderHelper helper,
SVGElement child)
Called after the start element but before the end element to indicate
each child tag that has been processed
|
void |
loaderAddText(SVGLoaderHelper helper,
String text)
Called during load process to add text scanned within a tag
|
void |
loaderEndElement(SVGLoaderHelper helper)
Called to indicate that this tag and the tags it contains have been
completely processed, and that it should finish any load processes.
|
void |
loaderStartElement(SVGLoaderHelper helper,
Attributes attrs,
SVGElement parent)
Called during SAX load process to notify that this tag has begun the
process of being loaded
|
protected static PathCommand[] |
parsePathList(String list) |
static AffineTransform |
parseSingleTransform(String val) |
protected static AffineTransform |
parseTransform(String val) |
protected SVGElement |
popParentContext() |
protected void |
pushParentContext(SVGElement context)
Hack to allow nodes to temporarily change their parents.
|
void |
removeAttribute(String name,
int attribType) |
void |
removeChild(SVGElement child) |
void |
setAttribute(String name,
int attribType,
String value) |
protected void |
setDiagram(SVGDiagram diagram) |
void |
swapChildren(int i,
int j)
Swaps 2 elements in children.
|
abstract boolean |
updateTime(double curTime)
Updates all attributes in this diagram associated with a time event.
|
public static final long serialVersionUID
public static final String SVG_NS
protected SVGElement parent
protected final ArrayList<SVGElement> children
protected String id
protected String cssClass
protected final HashMap<String,StyleAttribute> inlineStyles
protected final HashMap<String,StyleAttribute> presAttribs
protected URI xmlBase
protected SVGDiagram diagram
protected final TrackManager trackManager
public SVGElement()
public SVGElement(String id, SVGElement parent)
public SVGElement(String id, String cssClass, SVGElement parent)
public abstract String getTagName()
public SVGElement getParent()
public List<SVGElement> getPath(List<SVGElement> retVec)
retVec - public List<SVGElement> getChildren(List<SVGElement> retVec)
retVec - - A list to add all children to. If null, a new list is
created and children of this group are added.public SVGElement getChild(String id)
id - - Id of svg element to returnpublic int indexOfChild(SVGElement child)
child - public void swapChildren(int i,
int j)
throws SVGException
i - index of first childj - index of second childSVGExceptionpublic void loaderStartElement(SVGLoaderHelper helper, Attributes attrs, SVGElement parent) throws SAXException
attrs - - Attributes of this taghelper - - An object passed to all SVG elements involved in this
build process to aid in sharing information.parent - SAXExceptionpublic void removeAttribute(String name, int attribType)
public void addAttribute(String name, int attribType, String value) throws SVGElementException
SVGElementExceptionpublic boolean hasAttribute(String name, int attribType) throws SVGElementException
SVGElementExceptionpublic Set<String> getInlineAttributes()
public Set<String> getPresentationAttributes()
public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
helper - child - SVGElementExceptionprotected void setDiagram(SVGDiagram diagram)
public void removeChild(SVGElement child) throws SVGElementException
SVGElementExceptionpublic void loaderAddText(SVGLoaderHelper helper, String text)
helper - text - public void loaderEndElement(SVGLoaderHelper helper) throws SVGParseException
helper - SVGParseExceptionprotected void build()
throws SVGException
SVGExceptionpublic URI getXMLBase()
public String getId()
protected void pushParentContext(SVGElement context)
context - protected SVGElement popParentContext()
protected SVGElement getParentContext()
public SVGRoot getRoot()
public boolean getStyle(StyleAttribute attrib) throws SVGException
SVGExceptionpublic void setAttribute(String name, int attribType, String value) throws SVGElementException
SVGElementExceptionpublic boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException
SVGExceptionpublic boolean getStyle(StyleAttribute attrib, boolean recursive, boolean evalAnimation) throws SVGException
attrib - - Attribute to write style data to. Must have it's name set
to the name of the style being queried.recursive - - If true and this object does not contain the named
style attribute, checks attributes of parents back to root until one
found.evalAnimation - SVGExceptionpublic StyleAttribute getStyleAbsolute(String styName)
styName - public boolean getPres(StyleAttribute attrib) throws SVGException
attrib - SVGExceptionpublic StyleAttribute getPresAbsolute(String styName)
styName - protected static AffineTransform parseTransform(String val) throws SVGException
SVGExceptionpublic static AffineTransform parseSingleTransform(String val) throws SVGException
SVGExceptionprotected static PathCommand[] parsePathList(String list)
protected static GeneralPath buildPath(String text, int windingRule)
public abstract boolean updateTime(double curTime)
throws SVGException
curTime - SVGExceptionpublic int getNumChildren()
public SVGElement getChild(int i)
public double lerp(double t0,
double t1,
double alpha)
Copyright © 2022. All rights reserved.