Package com.kitfox.svg
Class SVGDiagram
- java.lang.Object
-
- com.kitfox.svg.SVGDiagram
-
- All Implemented Interfaces:
java.io.Serializable
public class SVGDiagram extends java.lang.Object implements java.io.SerializableTop level structure in an SVG tree.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.RectangledeviceViewportThis is used by the SVGRoot to determine the width of the(package private) java.util.HashMap<java.lang.String,SVGElement>idMapprotected booleanignoreClipHeuristicIf true, no attempt will be made to discard geometry based on it being out of bounds.(package private) SVGRootrootstatic longserialVersionUID(package private) SVGUniverseuniverse(package private) java.net.URIxmlBaseURI that uniquely identifies this document.
-
Constructor Summary
Constructors Constructor Description SVGDiagram(java.net.URI xmlBase, SVGUniverse universe)Creates a new instance of SVGDiagram
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.RectanglegetDeviceViewport()SVGElementgetElement(java.lang.String name)floatgetHeight()SVGRootgetRoot()SVGUniversegetUniverse()java.awt.geom.Rectangle2DgetViewRect()java.awt.geom.Rectangle2DgetViewRect(java.awt.geom.Rectangle2D rect)Returns the viewing rectangle of this diagram in device coordinates.floatgetWidth()java.net.URIgetXMLBase()booleanignoringClipHeuristic()java.util.List<java.util.List<SVGElement>>pick(java.awt.geom.Point2D point, boolean boundingBox, java.util.List<java.util.List<SVGElement>> retVec)java.util.List<java.util.List<SVGElement>>pick(java.awt.geom.Point2D point, java.util.List<java.util.List<SVGElement>> retVec)Searches thorough the scene graph for all RenderableElements that have shapes that contain the passed point.java.util.List<java.util.List<SVGElement>>pick(java.awt.geom.Rectangle2D pickArea, boolean boundingBox, java.util.List<java.util.List<SVGElement>> retVec)java.util.List<java.util.List<SVGElement>>pick(java.awt.geom.Rectangle2D pickArea, java.util.List<java.util.List<SVGElement>> retVec)voidremoveElement(java.lang.String name)voidrender(java.awt.Graphics2D g)Draws this diagram to the passed graphics contextvoidsetDeviceViewport(java.awt.Rectangle deviceViewport)Sets the dimensions of the device being rendered into.voidsetElement(java.lang.String name, SVGElement node)voidsetIgnoringClipHeuristic(boolean ignoreClipHeuristic)voidsetRoot(SVGRoot root)voidupdateTime(double curTime)Updates all attributes in this diagram associated with a time event.
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
idMap
final java.util.HashMap<java.lang.String,SVGElement> idMap
-
root
SVGRoot root
-
universe
final SVGUniverse universe
-
deviceViewport
private java.awt.Rectangle deviceViewport
This is used by the SVGRoot to determine the width of the
-
ignoreClipHeuristic
protected boolean ignoreClipHeuristic
If true, no attempt will be made to discard geometry based on it being out of bounds. This trades potentially drawing many out of bounds shapes with having to recalculate bounding boxes every animation iteration.
-
xmlBase
final java.net.URI xmlBase
URI that uniquely identifies this document. Also used to resolve relative urls. Default base for document.
-
-
Constructor Detail
-
SVGDiagram
public SVGDiagram(java.net.URI xmlBase, SVGUniverse universe)Creates a new instance of SVGDiagram- Parameters:
xmlBase-universe-
-
-
Method Detail
-
render
public void render(java.awt.Graphics2D g) throws SVGExceptionDraws this diagram to the passed graphics context- Parameters:
g-- Throws:
SVGException
-
pick
public java.util.List<java.util.List<SVGElement>> pick(java.awt.geom.Point2D point, java.util.List<java.util.List<SVGElement>> retVec) throws SVGException
Searches thorough the scene graph for all RenderableElements that have shapes that contain the passed point. For every shape which contains the pick point, a List containing the path to the node is added to the return list. That is, the result of SVGElement.getPath() is added for each entry.- Parameters:
point-retVec-- Returns:
- the passed in list
- Throws:
SVGException
-
pick
public java.util.List<java.util.List<SVGElement>> pick(java.awt.geom.Point2D point, boolean boundingBox, java.util.List<java.util.List<SVGElement>> retVec) throws SVGException
- Throws:
SVGException
-
pick
public java.util.List<java.util.List<SVGElement>> pick(java.awt.geom.Rectangle2D pickArea, java.util.List<java.util.List<SVGElement>> retVec) throws SVGException
- Throws:
SVGException
-
pick
public java.util.List<java.util.List<SVGElement>> pick(java.awt.geom.Rectangle2D pickArea, boolean boundingBox, java.util.List<java.util.List<SVGElement>> retVec) throws SVGException
- Throws:
SVGException
-
getUniverse
public SVGUniverse getUniverse()
-
getXMLBase
public java.net.URI getXMLBase()
-
getWidth
public float getWidth()
-
getHeight
public float getHeight()
-
getViewRect
public java.awt.geom.Rectangle2D getViewRect(java.awt.geom.Rectangle2D rect)
Returns the viewing rectangle of this diagram in device coordinates.- Parameters:
rect-- Returns:
-
getViewRect
public java.awt.geom.Rectangle2D getViewRect()
-
getElement
public SVGElement getElement(java.lang.String name)
-
setElement
public void setElement(java.lang.String name, SVGElement node)
-
removeElement
public void removeElement(java.lang.String name)
-
getRoot
public SVGRoot getRoot()
-
setRoot
public void setRoot(SVGRoot root)
-
ignoringClipHeuristic
public boolean ignoringClipHeuristic()
-
setIgnoringClipHeuristic
public void setIgnoringClipHeuristic(boolean ignoreClipHeuristic)
-
updateTime
public void updateTime(double curTime) throws SVGExceptionUpdates all attributes in this diagram associated with a time event. Ie, all attributes with track information.- Parameters:
curTime-- Throws:
SVGException
-
getDeviceViewport
public java.awt.Rectangle getDeviceViewport()
-
setDeviceViewport
public void setDeviceViewport(java.awt.Rectangle deviceViewport)
Sets the dimensions of the device being rendered into. This is used by SVGRoot when its x, y, width or height parameters are specified as percentages.- Parameters:
deviceViewport-
-
-