Package org.apache.batik.bridge
Class SVGDocumentBridge
- java.lang.Object
-
- org.apache.batik.bridge.SVGDocumentBridge
-
- All Implemented Interfaces:
Bridge
,BridgeUpdateHandler
,DocumentBridge
,SVGContext
public class SVGDocumentBridge extends java.lang.Object implements DocumentBridge, BridgeUpdateHandler, SVGContext
Bridge class for an SVGDocument node.
-
-
Field Summary
Fields Modifier and Type Field Description protected BridgeContext
ctx
The bridge context.protected org.w3c.dom.Document
document
The document node this bridge is associated with.protected RootGraphicsNode
node
The graphics node constructed by this bridge.-
Fields inherited from interface org.apache.batik.dom.svg.SVGContext
PERCENTAGE_FONT_SIZE, PERCENTAGE_VIEWPORT_HEIGHT, PERCENTAGE_VIEWPORT_SIZE, PERCENTAGE_VIEWPORT_WIDTH
-
-
Constructor Summary
Constructors Constructor Description SVGDocumentBridge()
Constructs a new bridge the SVG document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc, RootGraphicsNode node)
Builds using the specified BridgeContext and element, the specified graphics node.RootGraphicsNode
createGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc)
Creates aGraphicsNode
according to the specified parameters.void
dispose()
Disposes this BridgeUpdateHandler and releases all resources.java.awt.geom.Rectangle2D
getBBox()
Returns the tight bounding box in current user space (i.e., after application of the transform attribute, if any) on the geometry of all contained graphics elements, exclusive of stroke-width and filter effects).java.awt.geom.AffineTransform
getCTM()
Returns the transformation matrix from current user units (i.e., after application of the transform attribute, if any) to the viewport coordinate system for the nearestViewportElement.float
getFontSize()
Returns the font-size on the associated element.java.awt.geom.AffineTransform
getGlobalTransform()
Returns the global transformation matrix from the current element to the root.Bridge
getInstance()
Returns a new instance of this bridge.java.lang.String
getLocalName()
Returns the local name of the element thisBridge
is dedicated to.java.lang.String
getNamespaceURI()
Returns the namespace URI of the element thisBridge
is dedicated to.float
getPixelToMM()
Returns the size of a px CSS unit in millimeters.float
getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.java.awt.geom.AffineTransform
getScreenTransform()
Returns the transform from the global transform space to pixels.float
getViewportHeight()
Returns the height of the viewport which directly contains the associated element.float
getViewportWidth()
Returns the width of the viewport which directly contains the associated element.void
handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animated attribute has changed.void
handleCSSEngineEvent(CSSEngineEvent evt)
Invoked when an CSSEngineEvent is fired.void
handleDOMAttrModifiedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMAttrModified' is fired.void
handleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.void
handleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.void
handleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.void
handleOtherAnimationChanged(java.lang.String type)
Invoked when an 'other' animation value has changed.void
setScreenTransform(java.awt.geom.AffineTransform at)
Sets the transform to be used from the global transform space to pixels.
-
-
-
Field Detail
-
document
protected org.w3c.dom.Document document
The document node this bridge is associated with.
-
node
protected RootGraphicsNode node
The graphics node constructed by this bridge.
-
ctx
protected BridgeContext ctx
The bridge context.
-
-
Method Detail
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Returns the namespace URI of the element thisBridge
is dedicated to. Returnsnull
, as a Document node has no namespace URI.- Specified by:
getNamespaceURI
in interfaceBridge
-
getLocalName
public java.lang.String getLocalName()
Returns the local name of the element thisBridge
is dedicated to. Returnsnull
, as a Document node has no local name.- Specified by:
getLocalName
in interfaceBridge
-
getInstance
public Bridge getInstance()
Returns a new instance of this bridge.- Specified by:
getInstance
in interfaceBridge
-
createGraphicsNode
public RootGraphicsNode createGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc)
Creates aGraphicsNode
according to the specified parameters. This is called before children have been added to the returned GraphicsNode (obviously since you construct and return it).- Specified by:
createGraphicsNode
in interfaceDocumentBridge
- Parameters:
ctx
- the bridge context to usedoc
- the document node that describes the graphics node to build- Returns:
- a graphics node that represents the specified document node
-
buildGraphicsNode
public void buildGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc, RootGraphicsNode node)
Builds using the specified BridgeContext and element, the specified graphics node. This is called after all the children of the node have been constructed and added, so it is safe to do work that depends on being able to see your children nodes in this method.- Specified by:
buildGraphicsNode
in interfaceDocumentBridge
- Parameters:
ctx
- the bridge context to usedoc
- the document node that describes the graphics node to buildnode
- the graphics node to build
-
handleDOMAttrModifiedEvent
public void handleDOMAttrModifiedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMAttrModified' is fired.- Specified by:
handleDOMAttrModifiedEvent
in interfaceBridgeUpdateHandler
-
handleDOMNodeInsertedEvent
public void handleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.- Specified by:
handleDOMNodeInsertedEvent
in interfaceBridgeUpdateHandler
-
handleDOMNodeRemovedEvent
public void handleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.- Specified by:
handleDOMNodeRemovedEvent
in interfaceBridgeUpdateHandler
-
handleDOMCharacterDataModified
public void handleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.- Specified by:
handleDOMCharacterDataModified
in interfaceBridgeUpdateHandler
-
handleCSSEngineEvent
public void handleCSSEngineEvent(CSSEngineEvent evt)
Invoked when an CSSEngineEvent is fired.- Specified by:
handleCSSEngineEvent
in interfaceBridgeUpdateHandler
-
handleAnimatedAttributeChanged
public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animated attribute has changed.- Specified by:
handleAnimatedAttributeChanged
in interfaceBridgeUpdateHandler
-
handleOtherAnimationChanged
public void handleOtherAnimationChanged(java.lang.String type)
Invoked when an 'other' animation value has changed.- Specified by:
handleOtherAnimationChanged
in interfaceBridgeUpdateHandler
-
dispose
public void dispose()
Disposes this BridgeUpdateHandler and releases all resources.- Specified by:
dispose
in interfaceBridgeUpdateHandler
-
getPixelUnitToMillimeter
public float getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.- Specified by:
getPixelUnitToMillimeter
in interfaceSVGContext
-
getPixelToMM
public float getPixelToMM()
Returns the size of a px CSS unit in millimeters. This will be removed after next release.- Specified by:
getPixelToMM
in interfaceSVGContext
- See Also:
getPixelUnitToMillimeter()
-
getBBox
public java.awt.geom.Rectangle2D getBBox()
Description copied from interface:SVGContext
Returns the tight bounding box in current user space (i.e., after application of the transform attribute, if any) on the geometry of all contained graphics elements, exclusive of stroke-width and filter effects).- Specified by:
getBBox
in interfaceSVGContext
-
getScreenTransform
public java.awt.geom.AffineTransform getScreenTransform()
Description copied from interface:SVGContext
Returns the transform from the global transform space to pixels.- Specified by:
getScreenTransform
in interfaceSVGContext
-
setScreenTransform
public void setScreenTransform(java.awt.geom.AffineTransform at)
Description copied from interface:SVGContext
Sets the transform to be used from the global transform space to pixels.- Specified by:
setScreenTransform
in interfaceSVGContext
-
getCTM
public java.awt.geom.AffineTransform getCTM()
Description copied from interface:SVGContext
Returns the transformation matrix from current user units (i.e., after application of the transform attribute, if any) to the viewport coordinate system for the nearestViewportElement.- Specified by:
getCTM
in interfaceSVGContext
-
getGlobalTransform
public java.awt.geom.AffineTransform getGlobalTransform()
Description copied from interface:SVGContext
Returns the global transformation matrix from the current element to the root.- Specified by:
getGlobalTransform
in interfaceSVGContext
-
getViewportWidth
public float getViewportWidth()
Description copied from interface:SVGContext
Returns the width of the viewport which directly contains the associated element.- Specified by:
getViewportWidth
in interfaceSVGContext
-
getViewportHeight
public float getViewportHeight()
Description copied from interface:SVGContext
Returns the height of the viewport which directly contains the associated element.- Specified by:
getViewportHeight
in interfaceSVGContext
-
getFontSize
public float getFontSize()
Description copied from interface:SVGContext
Returns the font-size on the associated element.- Specified by:
getFontSize
in interfaceSVGContext
-
-