Interface SVGTarget

  • All Superinterfaces:
    RenderTarget

    public interface SVGTarget
    extends RenderTarget
    Rendering target to SVG format.

    This target is used by renderers objects to render a graph to a SVG DOM and uses the Batik library to transcode the SVG DOM in a SVG document.

    To allow further document further manipulation the DOM is organized with top elements. Top elements are nodes, edges, node-labels, edge-labels and arrows and are elements to append items to. For instance when a node label element is created it should be appended to the node-label element instead of directly to the root. Use the getTopElement() method to retrieve or create top elements.

    Author:
    Mathieu Bastian
    • Method Detail

      • createElement

        Element createElement​(String qualifiedName)
        Create a new element qualifiedName in the document.
        Parameters:
        qualifiedName - the name of the element
        Returns:
        the newly created element
      • createTextNode

        Text createTextNode​(String data)
        Create a new text node with data in it.
        Parameters:
        data - the text data
        Returns:
        the newly created text node
      • getTopElement

        Element getTopElement​(String name)
        Returns the top element name in the document. Top elements are direct children of the root node and help to organize the SVG document (e.g. all edges in the same parent DOM node). Create the top element if it missing.
        Parameters:
        name - the top element name to lookup
        Returns:
        the top element
      • getDocument

        Document getDocument()
        Returns the SVG document
        Returns:
        the SVG document
      • getScaleRatio

        float getScaleRatio()
        When SCALE_STROKES property is true returns the scale ratio to scale strokes with.
        Returns:
        the current scale ratio
      • toHexString

        String toHexString​(Color color)
        Returns color in the hex format (e.g. #ff0000).
        Parameters:
        color - the color to convert
        Returns:
        the color in a hex format