Class MultiPolylines

All Implemented Interfaces:
Shape

final class MultiPolylines extends FlatShape
Collection of polylines or polygons as a Java2D Shape. This class has some similarities with Path2D with the following differences:
  • No synchronization.
  • Line segments only (no Bézier curves).
Since:
1.1
Version:
1.3
  • Field Details

    • polylines

      private final Polyline[] polylines
      The polylines or polygons in this collection.
  • Constructor Details

    • MultiPolylines

      public MultiPolylines(Polyline[] polylines)
      Creates a collection of polylines. The given argument is stored by reference; it is not cloned.
      Parameters:
      polylines - the polylines. This array is not cloned.
  • Method Details

    • contains

      public boolean contains(double x, double y)
      Tests if the given coordinates are inside the boundary of 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 the given rectangle. May conservatively return true if an intersection is probable but accurate answer would be too costly to compute.
    • intersects

      public boolean intersects(Rectangle2D r)
      Tests if the interior of this shape intersects the interior of the given rectangle. May conservatively return true if an intersection is probable but accurate answer would be too costly to compute.
    • contains

      public boolean contains(double x, double y, double w, double h)
      Tests if the interior of this shape entirely contains the interior of the given rectangle. May conservatively return false if an accurate answer would be too costly to compute.
    • contains

      public boolean contains(Rectangle2D r)
      Tests if the interior of this shape entirely contains the interior of the given rectangle. May conservatively return false if an accurate answer would be too costly to compute.
    • getPathIterator

      public PathIterator getPathIterator(AffineTransform at)
      Returns an iterator over coordinates in this multi-polylines.
    • 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. The returned shape may still have many points outside the given bounds.
      Overrides:
      fastClip in class FlatShape
      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.
    • toString

      public String toString()
      Returns a string representation for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      a debug string representation.