Class SVGDocumentBridge

java.lang.Object
org.apache.batik.bridge.SVGDocumentBridge
All Implemented Interfaces:
Bridge, BridgeUpdateHandler, DocumentBridge, SVGContext

public class SVGDocumentBridge extends Object implements DocumentBridge, BridgeUpdateHandler, SVGContext
Bridge class for an SVGDocument node.
Version:
$Id: SVGDocumentBridge.java 1733416 2016-03-03 07:07:13Z gadams $
  • Field Details

    • document

      protected 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.
  • Constructor Details

    • SVGDocumentBridge

      public SVGDocumentBridge()
      Constructs a new bridge the SVG document.
  • Method Details

    • getNamespaceURI

      public String getNamespaceURI()
      Returns the namespace URI of the element this Bridge is dedicated to. Returns null, as a Document node has no namespace URI.
      Specified by:
      getNamespaceURI in interface Bridge
    • getLocalName

      public String getLocalName()
      Returns the local name of the element this Bridge is dedicated to. Returns null, as a Document node has no local name.
      Specified by:
      getLocalName in interface Bridge
    • getInstance

      public Bridge getInstance()
      Returns a new instance of this bridge.
      Specified by:
      getInstance in interface Bridge
    • createGraphicsNode

      public RootGraphicsNode createGraphicsNode(BridgeContext ctx, Document doc)
      Creates a GraphicsNode 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 interface DocumentBridge
      Parameters:
      ctx - the bridge context to use
      doc - 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, 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 interface DocumentBridge
      Parameters:
      ctx - the bridge context to use
      doc - the document node that describes the graphics node to build
      node - the graphics node to build
    • handleDOMAttrModifiedEvent

      public void handleDOMAttrModifiedEvent(MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMAttrModified' is fired.
      Specified by:
      handleDOMAttrModifiedEvent in interface BridgeUpdateHandler
    • handleDOMNodeInsertedEvent

      public void handleDOMNodeInsertedEvent(MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
      Specified by:
      handleDOMNodeInsertedEvent in interface BridgeUpdateHandler
    • handleDOMNodeRemovedEvent

      public void handleDOMNodeRemovedEvent(MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired.
      Specified by:
      handleDOMNodeRemovedEvent in interface BridgeUpdateHandler
    • handleDOMCharacterDataModified

      public void handleDOMCharacterDataModified(MutationEvent evt)
      Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired.
      Specified by:
      handleDOMCharacterDataModified in interface BridgeUpdateHandler
    • handleCSSEngineEvent

      public void handleCSSEngineEvent(CSSEngineEvent evt)
      Invoked when an CSSEngineEvent is fired.
      Specified by:
      handleCSSEngineEvent in interface BridgeUpdateHandler
    • handleAnimatedAttributeChanged

      public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
      Invoked when the animated value of an animated attribute has changed.
      Specified by:
      handleAnimatedAttributeChanged in interface BridgeUpdateHandler
    • handleOtherAnimationChanged

      public void handleOtherAnimationChanged(String type)
      Invoked when an 'other' animation value has changed.
      Specified by:
      handleOtherAnimationChanged in interface BridgeUpdateHandler
    • dispose

      public void dispose()
      Disposes this BridgeUpdateHandler and releases all resources.
      Specified by:
      dispose in interface BridgeUpdateHandler
    • getPixelUnitToMillimeter

      public float getPixelUnitToMillimeter()
      Returns the size of a px CSS unit in millimeters.
      Specified by:
      getPixelUnitToMillimeter in interface SVGContext
    • 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 interface SVGContext
      See Also:
    • getBBox

      public 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 interface SVGContext
    • getScreenTransform

      public AffineTransform getScreenTransform()
      Description copied from interface: SVGContext
      Returns the transform from the global transform space to pixels.
      Specified by:
      getScreenTransform in interface SVGContext
    • setScreenTransform

      public void setScreenTransform(AffineTransform at)
      Description copied from interface: SVGContext
      Sets the transform to be used from the global transform space to pixels.
      Specified by:
      setScreenTransform in interface SVGContext
    • getCTM

      public 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 interface SVGContext
    • getGlobalTransform

      public AffineTransform getGlobalTransform()
      Description copied from interface: SVGContext
      Returns the global transformation matrix from the current element to the root.
      Specified by:
      getGlobalTransform in interface SVGContext
    • 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 interface SVGContext
    • 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 interface SVGContext
    • getFontSize

      public float getFontSize()
      Description copied from interface: SVGContext
      Returns the font-size on the associated element.
      Specified by:
      getFontSize in interface SVGContext