Package diva.canvas

Interface Figure

    • Method Detail

      • contains

        boolean contains​(java.awt.geom.Point2D point)
        Test whether this figure contains the point given. The point given is in the enclosing transform context.
        Parameters:
        point - The given point
        Returns:
        true if the point is contained by this figure.
      • getBounds

        java.awt.geom.Rectangle2D getBounds()
        Get the bounding box of this figure. The result rectangle is given in the enclosing transform context. The returned rectangle may be an internally cached shape, and should not be modified.
        Returns:
        the bounding box of this figure.
      • getInteractor

        Interactor getInteractor()
        Return the interactor of this figure. Return null if there isn't one.
        Returns:
        the interactor of this figure or null.
        See Also:
        setInteractor(Interactor)
      • getLayer

        CanvasLayer getLayer()
        Get the most immediate layer containing this figure.
        Returns:
        the most immediate layer containing this figure.
      • getOrigin

        java.awt.geom.Point2D getOrigin()
        Return the origin of the figure in the enclosing transform context. This might be, for example, the center of the figure, the upper left corner, or some other point with respect to which the pieces of the figure are defined.
        Returns:
        The origin of the figure.
      • getParent

        CanvasComponent getParent()
        Return the parent of this figure. Return null if the figure does not have a parent. (Note that a figure with no parent can exist, but it will not be displayed, as it must be in a layer for the figure canvas to ever call its paint method.)
        Specified by:
        getParent in interface CanvasComponent
        Returns:
        the parent of this figure.
        See Also:
        setParent(CanvasComponent)
      • getShape

        java.awt.Shape getShape()
        Get the outline shape of this figure. The outline shape is used for things like highlighting. The result shape is given in the enclosing transform context.
        Returns:
        the outline shape of this figure
      • getToolTipText

        java.lang.String getToolTipText()
        Return the tooltip string for this figure, or null if the figure does not have a tooltip.
        Returns:
        the tooltip string for this figure.
        See Also:
        setToolTipText(String)
      • hit

        boolean hit​(java.awt.geom.Rectangle2D rectangle)
        Test if this figure is "hit" by the given rectangle. This is the same as intersects if the interior of the figure is not transparent. The rectangle is given in the enclosing transform context. If the figure is not visible, it must return false. The default implementation is the same as intersects if the figure is visible.

        (This method would be better named hits, but the name hit is consistent with java.awt.Graphics2D.)

        Parameters:
        rectangle - The rectangle to be checked.
        Returns:
        true if the figure is hit by the given rectangle.
      • intersects

        boolean intersects​(java.awt.geom.Rectangle2D rectangle)
        Test if this figure intersects the given rectangle. The rectangle is given in the enclosing transform context.
        Parameters:
        rectangle - The rectangle to be checked.
        Returns:
        truen if the figure intersects the given rectangle.
      • setInteractor

        void setInteractor​(Interactor interactor)
        Set the interactor of this figure. Once a figure has an interactor given to it, it will respond to events on the canvas, in the ways determined by the interactor.
        Parameters:
        interactor - The interactor.
        See Also:
        getInteractor()
      • setParent

        void setParent​(CanvasComponent canvasComponent)
        Set the parent of this figure. A null argument means that the figure is being removed from its parent. No checks are performed to see if the figure already has a parent -- it is the responsibility of the caller to do this. This method is not intended for public use, and should never be called by client code.
        Parameters:
        canvasComponent - The parent of the figure.
        See Also:
        getParent()
      • setToolTipText

        void setToolTipText​(java.lang.String toolTipText)
        Set the tooltip string for this figure. If the string is null, then the figure will not have a tooltip.
        Parameters:
        toolTipText - The tool tip text.
        See Also:
        getToolTipText()
      • transform

        void transform​(java.awt.geom.AffineTransform affineTransform)
        Transform the figure with the supplied transform. This can be used to perform arbitrary translation, scaling, shearing, and rotation operations.
        Parameters:
        affineTransform - The transform to be used.
      • translate

        void translate​(double x,
                       double y)
        Move the figure the indicated distance.
        Parameters:
        x - The x value to be moved.
        y - The y value to be moved.