Package diva.canvas

Interface FigureContainer

    • Method Detail

      • add

        void add​(Figure f)
        Add a figure to this container. The figure should be added so that it always displays above existing figures.
        Parameters:
        f - The figure to be added.
      • contains

        boolean contains​(Figure f)
        Test if this container contains the given figure. As a general rule, the implementation of this method is not required to be efficient -- O(n) in the length of the list is acceptable. Clients should note that, in general, a much better way of making this same test is to check if the parent of the figure is the same object as this container.
        Specified by:
        contains in interface FigureSet
        Parameters:
        f - The figure to be searched for
        Returns:
        true if the figure is contained.
      • decorate

        void decorate​(Figure f,
                      FigureDecorator d)
        Decorate a child figure, replacing the child figure with the decorator.
        Parameters:
        f - The child figure.
        d - The decorator.
      • getFigureCount

        int getFigureCount()
        Return the number of figures in this container.
        Returns:
        The number of figures.
      • pick

        Figure pick​(java.awt.geom.Rectangle2D region)
        Given a rectangle, return the top-most descendent figure that hits it. Otherwise, return null. Implementors should not call their own hit() method, but only those of their children.

        Note that a region is given instead of a point so that "pick halo" can be implemented. The region should not have zero size, or no figure will be hit.

        Parameters:
        region - The rectangle
        Returns:
        The figure
      • pick

        Figure pick​(java.awt.geom.Rectangle2D region,
                    Filter f)
        Given a rectangle, return the top-most descendent figure that hits it, and is accepted by the given filter. Otherwise, return null. Implementors should not call their own hit() method, but only those of their children.

        Note that a region is given instead of a point so that "pick halo" can be implemented. The region should not have zero size, or no figure will be hit.

        Parameters:
        region - The rectangle
        f - The filter
        Returns:
        the Figure or null.
      • remove

        void remove​(Figure f)
        Remove the given figure from this container.
        Parameters:
        f - The figure to be removed
      • undecorate

        void undecorate​(FigureDecorator d)
        Remove a figure from the given decorator and add it back into this container.
        Parameters:
        d - The decorator