Class CanvasModel


  • public class CanvasModel
    extends Object
    Canvas Model for VectorCanvas
    Author:
    KIYUT
    • Constructor Detail

      • CanvasModel

        public CanvasModel​(VectorCanvas canvas)
        Creates a new instance of CanvasModel
        Parameters:
        canvas - The VectorCanvas
    • Method Detail

      • dispose

        public void dispose()
        Dispose
      • setSVGDocument

        public void setSVGDocument​(org.w3c.dom.svg.SVGDocument doc)
        Set SVGDocument
        Parameters:
        doc - SVGDocument
      • getSVGDocument

        public org.w3c.dom.svg.SVGDocument getSVGDocument()
        Return SVGDocument
        Returns:
        SVGDocument
      • getEditorUserAgent

        public EditorUserAgent getEditorUserAgent()
        Return EditorUserAgent
        Returns:
        EditorUserAgent
      • getAnimationEngine

        public org.apache.batik.bridge.SVGAnimationEngine getAnimationEngine()
        Returns the SVGAnimationEngine for the document or null.
        Returns:
        SVGAnimationEngine or null
      • getRoot

        public org.apache.batik.gvt.GraphicsNode getRoot()
        Returns the root graphics node.
        Returns:
        root graphics node
      • getSVGNameSpace

        @Deprecated
        public String getSVGNameSpace()
        Deprecated.
        replaced by SVGConstants.SVG_NAMESPACE_URI
        Returns the SVG namespace
        Returns:
        SVG namespace String
      • getSVGSVGElement

        public org.w3c.dom.svg.SVGSVGElement getSVGSVGElement()
        Return SVGSVGElement
        Returns:
        SVGSVGElement
      • getSVGWidth

        public double getSVGWidth()
        Return SVG width
        Returns:
        SVG width
      • getSVGHeight

        public double getSVGHeight()
        Return SVG height
        Returns:
        SVG height
      • appendChild

        public void appendChild​(Element element)
        Convenience method to add Element to the Document Root
        Parameters:
        element - Element
      • getSVGElement

        public org.w3c.dom.svg.SVGElement getSVGElement​(org.apache.batik.gvt.GraphicsNode graphicsNode)
        Get SVGElement of specified GraphicsNode or null
        Parameters:
        graphicsNode - the GraphicsNode associated with the SVGElement to return
        Returns:
        SVGElement or null
      • getGraphicsNode

        public org.apache.batik.gvt.GraphicsNode getGraphicsNode​(org.w3c.dom.svg.SVGElement svgElement)
        Get GraphicsNode of specified element or null
        Parameters:
        svgElement - the SVGElement associated with GraphicsNode to return
        Returns:
        GraphicsNode or null
      • getBrokenLinkDocument

        public org.w3c.dom.svg.SVGDocument getBrokenLinkDocument​(Element e,
                                                                 String url,
                                                                 String message)
        Return SVG that show broken link.
        Adapted from Batik Code
        Parameters:
        e - The <image> element that can't be loaded.
        url - The resolved url that can't be loaded.
        message - As best as can be determined the reason it can't be loaded (not available, corrupt, unknown format,...).
        Returns:
        SVG that show broken link