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.- Version:
- $Id: SVGDocumentBridge.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description protected BridgeContextctxThe bridge context.protected org.w3c.dom.DocumentdocumentThe document node this bridge is associated with.protected RootGraphicsNodenodeThe 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 voidbuildGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc, RootGraphicsNode node)Builds using the specified BridgeContext and element, the specified graphics node.RootGraphicsNodecreateGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc)Creates aGraphicsNodeaccording to the specified parameters.voiddispose()Disposes this BridgeUpdateHandler and releases all resources.java.awt.geom.Rectangle2DgetBBox()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.AffineTransformgetCTM()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.floatgetFontSize()Returns the font-size on the associated element.java.awt.geom.AffineTransformgetGlobalTransform()Returns the global transformation matrix from the current element to the root.BridgegetInstance()Returns a new instance of this bridge.java.lang.StringgetLocalName()Returns the local name of the element thisBridgeis dedicated to.java.lang.StringgetNamespaceURI()Returns the namespace URI of the element thisBridgeis dedicated to.floatgetPixelToMM()Returns the size of a px CSS unit in millimeters.floatgetPixelUnitToMillimeter()Returns the size of a px CSS unit in millimeters.java.awt.geom.AffineTransformgetScreenTransform()Returns the transform from the global transform space to pixels.floatgetViewportHeight()Returns the height of the viewport which directly contains the associated element.floatgetViewportWidth()Returns the width of the viewport which directly contains the associated element.voidhandleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)Invoked when the animated value of an animated attribute has changed.voidhandleCSSEngineEvent(CSSEngineEvent evt)Invoked when an CSSEngineEvent is fired.voidhandleDOMAttrModifiedEvent(org.w3c.dom.events.MutationEvent evt)Invoked when an MutationEvent of type 'DOMAttrModified' is fired.voidhandleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.voidhandleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.voidhandleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.voidhandleOtherAnimationChanged(java.lang.String type)Invoked when an 'other' animation value has changed.voidsetScreenTransform(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 thisBridgeis dedicated to. Returnsnull, as a Document node has no namespace URI.- Specified by:
getNamespaceURIin interfaceBridge
-
getLocalName
public java.lang.String getLocalName()
Returns the local name of the element thisBridgeis dedicated to. Returnsnull, as a Document node has no local name.- Specified by:
getLocalNamein interfaceBridge
-
getInstance
public Bridge getInstance()
Returns a new instance of this bridge.- Specified by:
getInstancein interfaceBridge
-
createGraphicsNode
public RootGraphicsNode createGraphicsNode(BridgeContext ctx, org.w3c.dom.Document doc)
Creates aGraphicsNodeaccording 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:
createGraphicsNodein 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:
buildGraphicsNodein 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:
handleDOMAttrModifiedEventin interfaceBridgeUpdateHandler
-
handleDOMNodeInsertedEvent
public void handleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.- Specified by:
handleDOMNodeInsertedEventin interfaceBridgeUpdateHandler
-
handleDOMNodeRemovedEvent
public void handleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.- Specified by:
handleDOMNodeRemovedEventin interfaceBridgeUpdateHandler
-
handleDOMCharacterDataModified
public void handleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.- Specified by:
handleDOMCharacterDataModifiedin interfaceBridgeUpdateHandler
-
handleCSSEngineEvent
public void handleCSSEngineEvent(CSSEngineEvent evt)
Invoked when an CSSEngineEvent is fired.- Specified by:
handleCSSEngineEventin interfaceBridgeUpdateHandler
-
handleAnimatedAttributeChanged
public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animated attribute has changed.- Specified by:
handleAnimatedAttributeChangedin interfaceBridgeUpdateHandler
-
handleOtherAnimationChanged
public void handleOtherAnimationChanged(java.lang.String type)
Invoked when an 'other' animation value has changed.- Specified by:
handleOtherAnimationChangedin interfaceBridgeUpdateHandler
-
dispose
public void dispose()
Disposes this BridgeUpdateHandler and releases all resources.- Specified by:
disposein interfaceBridgeUpdateHandler
-
getPixelUnitToMillimeter
public float getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.- Specified by:
getPixelUnitToMillimeterin interfaceSVGContext
-
getPixelToMM
public float getPixelToMM()
Returns the size of a px CSS unit in millimeters. This will be removed after next release.- Specified by:
getPixelToMMin interfaceSVGContext- See Also:
getPixelUnitToMillimeter()
-
getBBox
public java.awt.geom.Rectangle2D getBBox()
Description copied from interface:SVGContextReturns 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:
getBBoxin interfaceSVGContext
-
getScreenTransform
public java.awt.geom.AffineTransform getScreenTransform()
Description copied from interface:SVGContextReturns the transform from the global transform space to pixels.- Specified by:
getScreenTransformin interfaceSVGContext
-
setScreenTransform
public void setScreenTransform(java.awt.geom.AffineTransform at)
Description copied from interface:SVGContextSets the transform to be used from the global transform space to pixels.- Specified by:
setScreenTransformin interfaceSVGContext
-
getCTM
public java.awt.geom.AffineTransform getCTM()
Description copied from interface:SVGContextReturns 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:
getCTMin interfaceSVGContext
-
getGlobalTransform
public java.awt.geom.AffineTransform getGlobalTransform()
Description copied from interface:SVGContextReturns the global transformation matrix from the current element to the root.- Specified by:
getGlobalTransformin interfaceSVGContext
-
getViewportWidth
public float getViewportWidth()
Description copied from interface:SVGContextReturns the width of the viewport which directly contains the associated element.- Specified by:
getViewportWidthin interfaceSVGContext
-
getViewportHeight
public float getViewportHeight()
Description copied from interface:SVGContextReturns the height of the viewport which directly contains the associated element.- Specified by:
getViewportHeightin interfaceSVGContext
-
getFontSize
public float getFontSize()
Description copied from interface:SVGContextReturns the font-size on the associated element.- Specified by:
getFontSizein interfaceSVGContext
-
-