Class ExplicitBoundsShape

Object
ExplicitBoundsShape
All Implemented Interfaces:
Shape

public class ExplicitBoundsShape extends Object implements Shape
Decorator on top of the Shape. It extends the Shape interface to include a method 'setBounds' for explicitly defining a bounding box (which is not necessarily associated with the actual shape's bounds).
Author:
fmoura
  • Constructor Details

    • ExplicitBoundsShape

      public ExplicitBoundsShape(Shape shape)
      The Constructor
      Parameters:
      shape - The actual shape on top of which this decorator will stand.
  • Method Details

    • setBounds

      public void setBounds(Rectangle2D bounds)
      Sets the explicitly defined bounds for this shape.
    • contains

      public boolean contains(double x, double y, double w, double h)
      Specified by:
      contains in interface Shape
    • contains

      public boolean contains(double x, double y)
      Specified by:
      contains in interface Shape
    • contains

      public boolean contains(Point2D p)
      Specified by:
      contains in interface Shape
    • contains

      public boolean contains(Rectangle2D r)
      Specified by:
      contains in interface Shape
    • getBounds

      public Rectangle getBounds()
      Returns the explicitly defined bounds for this shape. If no bounds were explicitly set, it delegates the call to the actual shape.
      Specified by:
      getBounds in interface Shape
      Returns:
      the Rectangle representing the Shape's bounding box.
      See Also:
    • getBounds2D

      public Rectangle2D getBounds2D()
      Returns the explicitly defined bounds for this shape. If no bounds were explicitly set, it delegates the call to the actual shape.
      Specified by:
      getBounds2D in interface Shape
      Returns:
      the Rectangle2D representing the Shape's bounding box.
      See Also:
    • getPathIterator

      public PathIterator getPathIterator(AffineTransform at, double flatness)
      Specified by:
      getPathIterator in interface Shape
    • getPathIterator

      public PathIterator getPathIterator(AffineTransform at)
      Specified by:
      getPathIterator in interface Shape
    • intersects

      public boolean intersects(double x, double y, double w, double h)
      Specified by:
      intersects in interface Shape
    • intersects

      public boolean intersects(Rectangle2D r)
      Specified by:
      intersects in interface Shape
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object