Class ShapeWrapper

java.lang.Object
org.apache.sis.internal.referencing.j2d.AbstractShape
org.apache.sis.internal.feature.j2d.ShapeWrapper
All Implemented Interfaces:
Shape, Serializable
Direct Known Subclasses:
DecimatedShape

abstract class ShapeWrapper extends AbstractShape implements Serializable
A wrapper that delegate all Shape methods to a source shape. Subclasses should override at least one method for making this class useful.
Since:
1.2
Version:
1.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final long
    For cross-version compatibility.
    protected final Shape
    The source of coordinate values.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new wrapper for the given shape.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(double x, double y)
    Tests if the specified coordinates are inside the boundary of this shape.
    boolean
    contains(double x, double y, double w, double h)
    Tests if the interior of this Shape entirely contains the interior of a specified rectangular area.
    boolean
    Tests if the point is inside the boundary of this shape.
    boolean
    Tests if the interior of this Shape entirely contains the interior of a specified rectangular area.
    Returns a rectangle that completely encloses this Shape.
    Returns a rectangle that completely encloses this Shape.
    Returns an iterator over the coordinates of this shape.
    getPathIterator(AffineTransform at, double flatness)
    Returns an iterator over the coordinates of this shape, approximated by line segments.
    boolean
    intersects(double x, double y, double w, double h)
    Tests if the interior of this Shape intersects the interior of a specified rectangular area.
    boolean
    Tests if the interior of this Shape intersects the interior of a specified rectangular area.
    protected boolean
    Returns true if this shape backed by primitive float values.

    Methods inherited from class org.apache.sis.internal.referencing.j2d.AbstractShape

    isFloat

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • source

      protected final Shape source
      The source of coordinate values.
  • Constructor Details

    • ShapeWrapper

      protected ShapeWrapper(Shape source)
      Creates a new wrapper for the given shape.
      Parameters:
      source - the source of coordinate values.
  • Method Details

    • isFloat

      protected boolean isFloat()
      Returns true if this shape backed by primitive float values.
      Overrides:
      isFloat in class AbstractShape
      Returns:
      true if this shape is backed by float coordinate values.
    • getBounds

      public Rectangle getBounds()
      Returns a rectangle that completely encloses this Shape. This is not necessarily the smallest bounding box if an accurate computation would be too expansive.
      Specified by:
      getBounds in interface Shape
      Returns:
      a rectangle that completely encloses this Shape.
    • getBounds2D

      public Rectangle2D getBounds2D()
      Returns a rectangle that completely encloses this Shape. This is not necessarily the smallest bounding box if an accurate computation would be too expansive.
      Specified by:
      getBounds2D in interface Shape
      Returns:
      a rectangle that completely encloses this Shape.
    • contains

      public boolean contains(double x, double y)
      Tests if the specified coordinates are inside the boundary of this shape.
      Specified by:
      contains in interface Shape
      Parameters:
      x - the first coordinate value.
      y - the second coordinate value.
      Returns:
      whether the point specified by given coordinates is inside this shape.
    • contains

      public boolean contains(Point2D p)
      Tests if the point is inside the boundary of this shape.
      Specified by:
      contains in interface Shape
      Parameters:
      p - the point to test.
      Returns:
      whether the given point is inside this shape.
    • intersects

      public boolean intersects(double x, double y, double w, double h)
      Tests if the interior of this Shape intersects the interior of a specified rectangular area. This method may conservatively return true if an accurate computation would be too expansive.
      Specified by:
      intersects in interface Shape
      Parameters:
      x - minimal x coordinate of the rectangle.
      y - minimal y coordinate of the rectangle.
      w - width of the rectangle.
      h - height of the rectangle.
      Returns:
      whether the specified rectangle intersects the interior of this shape.
    • intersects

      public boolean intersects(Rectangle2D r)
      Tests if the interior of this Shape intersects the interior of a specified rectangular area. This method may conservatively return true if an accurate computation would be too expansive.
      Specified by:
      intersects in interface Shape
      Parameters:
      r - the rectangular area to test.
      Returns:
      whether the specified rectangle intersects the interior of this shape.
    • contains

      public boolean contains(double x, double y, double w, double h)
      Tests if the interior of this Shape entirely contains the interior of a specified rectangular area. This method may conservatively return false if an accurate computation would be too expansive.
      Specified by:
      contains in interface Shape
      Parameters:
      x - minimal x coordinate of the rectangle.
      y - minimal y coordinate of the rectangle.
      w - width of the rectangle.
      h - height of the rectangle.
      Returns:
      whether the specified rectangle entirely contains the interior of this shape.
    • contains

      public boolean contains(Rectangle2D r)
      Tests if the interior of this Shape entirely contains the interior of a specified rectangular area. This method may conservatively return false if an accurate computation would be too expansive.
      Specified by:
      contains in interface Shape
      Parameters:
      r - the rectangular area to test.
      Returns:
      whether the specified rectangle entirely contains the interior of this shape.
    • getPathIterator

      public PathIterator getPathIterator(AffineTransform at)
      Returns an iterator over the coordinates of this shape.
      Specified by:
      getPathIterator in interface Shape
      Parameters:
      at - an optional transform to be applied on coordinate values, or null if none.
      Returns:
      iterator over the coordinate values of this shape.
    • getPathIterator

      public PathIterator getPathIterator(AffineTransform at, double flatness)
      Returns an iterator over the coordinates of this shape, approximated by line segments.
      Specified by:
      getPathIterator in interface Shape
      Parameters:
      at - an optional transform to be applied on coordinate values, or null if none.
      flatness - maximum distance between line segments approximations and the curve segments.
      Returns:
      iterator over the coordinate values of line segments approximating this shape.