Class AbstractShape

  • All Implemented Interfaces:
    Shape
    Direct Known Subclasses:
    CubicPath, CurvedPolyline, MutablePath, Spiral2D


    public abstract class AbstractShape
    extends Object
    implements Shape
    This is a class that implements all Shape methods except for getPathIterator(AffineTransform). Because all the other methods consult getPathIterator() it is essential that when subclasses implement that method it be very light. See MutablePath as a possible example.
    • Constructor Detail

      • AbstractShape

        public AbstractShape()
    • Method Detail

      • contains

        public boolean contains(Point2D p)
      • getWindingRule

        public abstract int getWindingRule()
      • contains

        public boolean contains(double x,
                                double y)
      • contains

        public boolean contains(double x,
                                double y,
                                AffineTransform transform)
      • countCrossings

        protected int countCrossings(double x,
                                     double y,
                                     AffineTransform transform)
        This counts the number of crossings from (-infinity,y) to (x,y). This total is used in combination with the winding rule to determine when a point is inside a shape.
      • identifyCrossings

        protected boolean identifyCrossings(double x,
                                            double y,
                                            double w,
                                            double h,
                                            AffineTransform transform)
        This checks to see if the rectangle argument ever crosses this shape. This method returns immediately when/if it finds proof of an intersection.
      • intersects

        public boolean intersects(double x,
                                  double y,
                                  double w,
                                  double h)
      • intersects

        public boolean intersects(double x,
                                  double y,
                                  double w,
                                  double h,
                                  AffineTransform transform)
      • contains

        public boolean contains(double x,
                                double y,
                                double w,
                                double h)
      • contains

        public boolean contains(double x,
                                double y,
                                double w,
                                double h,
                                AffineTransform transform)
      • intersects

        public boolean intersects(Rectangle2D r)