Class FlatShape

java.lang.Object
org.apache.sis.internal.feature.AbstractGeometry
org.apache.sis.internal.feature.j2d.FlatShape
All Implemented Interfaces:
Shape
Direct Known Subclasses:
MultiPolylines, Polyline

public abstract class FlatShape extends AbstractGeometry implements Shape
A shape made of straight lines. This shape does not contain any Bézier curve. Consequently, the flatness factor of path iterator can be ignored.
Since:
1.1
Version:
1.1
  • Field Details

  • Constructor Details

    • FlatShape

      FlatShape(IntervalRectangle bounds)
      Creates a shape with the given bounds. The given argument is stored by reference; it is not cloned.
      Parameters:
      bounds - the shape bounds (not cloned).
    • FlatShape

      FlatShape(double[] coordinates, int size)
      Creates a shape with bounds initialized to minimum and maximum coordinates of given array. The coordinates array shall not be empty.
      Parameters:
      coordinates - the coordinate values as (x,y) tuples.
      size - number of valid value in coordinates array.
  • Method Details

    • getBounds

      public final Rectangle getBounds()
      Returns an integer rectangle that completely encloses the shape. There is no guarantee that the rectangle is the smallest bounding box that encloses the shape.
      Specified by:
      getBounds in interface Shape
    • getBounds2D

      public final Rectangle2D getBounds2D()
      Returns a rectangle that completely encloses the shape. There is no guarantee that the rectangle is the smallest bounding box that encloses the shape.
      Specified by:
      getBounds2D in interface Shape
    • contains

      public final boolean contains(Point2D p)
      Tests if the specified point is inside the boundary of the shape. This method delegates to Shape.contains(double, double).
      Specified by:
      contains in interface Shape
    • getPathIterator

      public final PathIterator getPathIterator(AffineTransform at, double flatness)
      Returns an iterator for the shape outline geometry. The flatness factor is ignored on the assumption that this shape does not contain any Bézier curve, as stipulated in FlatShape class contract.
      Specified by:
      getPathIterator in interface Shape
      Parameters:
      at - an optional transform to apply on coordinate values.
      flatness - ignored.
      Returns:
      an iterator for the shape outline geometry.
    • fastClip

      public FlatShape fastClip(Rectangle2D areaOfInterest)
      Returns a potentially smaller shape containing all polylines that intersect the given area of interest. This method performs only a quick check based on bounds intersections. It does not test individual points. The returned shape may still have many points outside the given bounds.
      Parameters:
      areaOfInterest - the area of interest. Edges are considered exclusive.
      Returns:
      a potentially smaller shape, or null if this shape is fully outside the AOI.