Class Rectangle2D

  • All Implemented Interfaces:
    Shape2D

    public class Rectangle2D
    extends java.lang.Object
    implements Shape2D
    Simple 2D shape rectangle.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double bottom_  
      private double left_  
      private double right_  
      private double top_  
      • Fields inherited from interface org.htmlunit.util.geometry.Shape2D

        epsilon
    • Constructor Summary

      Constructors 
      Constructor Description
      Rectangle2D​(double x1, double y1, double x2, double y2)
      Ctor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(double x, double y)
      void extend​(double x, double y)  
      double getBottom()  
      double getLeft()  
      boolean isEmpty()
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • left_

        private double left_
      • top_

        private double top_
      • right_

        private double right_
      • bottom_

        private double bottom_
    • Constructor Detail

      • Rectangle2D

        public Rectangle2D​(double x1,
                           double y1,
                           double x2,
                           double y2)
        Ctor.
        Parameters:
        x1 - x value of the first corner
        y1 - y value of the first corner
        x2 - x value of the second corner
        y2 - y value of the second corner
    • Method Detail

      • getLeft

        public double getLeft()
        Returns:
        the x coord of the leftmost corner.
      • getBottom

        public double getBottom()
        Returns:
        the y coord of the bottom line.
      • contains

        public boolean contains​(double x,
                                double y)
        Specified by:
        contains in interface Shape2D
        Parameters:
        x - point x value
        y - point y value
        Returns:
        true if the specified point is inside; false otherwise.
      • extend

        public void extend​(double x,
                           double y)
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Shape2D
        Returns:
        true if the Shape is empty.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object