Class CanvasUtilities


  • public class CanvasUtilities
    extends Object
    Collection of Canvas Utilities
    Author:
    Kiyut
    • Constructor Detail

      • CanvasUtilities

        public CanvasUtilities()
    • Method Detail

      • isSelectableGraphicsElement

        public static boolean isSelectableGraphicsElement​(Element elt)
        Check whether the node is selectable Graphics Element by canvas or not.
        Parameters:
        elt - Element
        Returns:
        true if selectable otherwise false
      • isSelectableContainerElement

        public static boolean isSelectableContainerElement​(Element elt)
        Check whether the node is selectable Container Element by canvas or not.
        Parameters:
        elt - Element
        Returns:
        true if selectable otherwise false
      • getSVGElementAt

        public static List<org.w3c.dom.svg.SVGElement> getSVGElementAt​(VectorCanvas canvas,
                                                                       Shape shape,
                                                                       boolean direct)
        Return List of Selectable SVGElement. It does not return null instead it return empty List. It search from bottom to top because the bottom is the front on the canvas (SVG z-order).
        Parameters:
        canvas - the VectorCanvas
        shape - selection shape
        direct - true for direct selection
        Returns:
        List of Selectable SVGElement
      • getSVGElementAt

        public static List<org.w3c.dom.svg.SVGElement> getSVGElementAt​(VectorCanvas canvas,
                                                                       Point2D point,
                                                                       boolean direct)
        Return List of Selectable SVGElement. It does not return null instead it return empty List It search from bottom to top because the bottom is the front on the canvas (SVG z-order).
        Parameters:
        canvas - VectorCanvas
        point - selection point
        direct - true for direct selection
        Returns:
        List of Selectable SVGElement
      • getGraphicsElement

        public static List<org.w3c.dom.svg.SVGElement> getGraphicsElement​(List<org.w3c.dom.svg.SVGElement> source)
        This methods traverse the givent Element list, to find the child which is selectable Graphics Element. If nothings found, it return empty list instead of null
        Parameters:
        source - list of Element
        Returns:
        list of GraphicsElement
        See Also:
        isSelectableGraphicsElement(Element), isSelectableContainerElement(Element)
      • getSVGTextElementAt

        public static org.w3c.dom.svg.SVGTextElement getSVGTextElementAt​(VectorCanvas canvas,
                                                                         Point2D point)
        Return SVGTextElement the most front or the most bottom (SVG z-order).
        Parameters:
        canvas - VectorCanvas
        point - Point2D
        Returns:
        SVGTextElement or null