Class GeoRectangle.Double

java.lang.Object
ucar.nc2.dt.ugrid.geom.GeoRectangle
ucar.nc2.dt.ugrid.geom.GeoRectangle.Double
All Implemented Interfaces:
Shape, Serializable
Enclosing class:
GeoRectangle

public static class GeoRectangle.Double extends GeoRectangle
See Also:
  • Constructor Details

    • Double

      public Double()
      Constructs a GeoRectangle.Double with all four points located at {0,0}
    • Double

      public Double(double x, double y)
      Constructs a GeoRectangle.Double from the given location. All 4 vertices of the rectangle are set to the same value.
      Parameters:
      x - the x location
      y - the y location
    • Double

      public Double(Point2D loc)
      Constructs a GeoRectangle.Double from the given location. All 4 vertices of the rectangle are set to the same value.
      Parameters:
      loc - the starting location
    • Double

      public Double(Point2D corner1, Point2D corner2)
      Constructs a GeoRectangle.Double from the given corner points.
      Parameters:
      corner1 - a point representing any corner of the rectangle
      corner2 - a point representing the point opposite corner1
    • Double

      public Double(double[] xVals, double[] yVals)
      Constructor accepting two double arrays, one for x values and one for y values. Only the FIRST TWO members of each array are used.
      Parameters:
      xVals - the x coordinates of two opposite corners of this rectangle
      yVals - the y coordinates of two opposite corners of this rectangle
    • Double

      public Double(double xCorner1, double yCorner1, double xCorner2, double yCorner2)
      Initializes a new GeoRectangle.Double with the given coordinates for the lower left and upper right points of the rectangle
      Parameters:
      xCorner1 - the x coordinate of the first corner of this rectangle
      yCorner1 - the y coordinate of the first corner of this rectangle
      xCorner2 - the x coordinate of the opposite corner of this rectangle
      yCorner2 - the y coordinate of the opposite corner of this rectangle
  • Method Details

    • add

      public void add(Polygon2D polygon)
      Extends this rectangle by the bounding box of the given polygon. The resulting rectangle is the union of this GeoRectangle with the rectangle representing the bounds of the given Polygon2D
      Specified by:
      add in class GeoRectangle
      Parameters:
      polygon - A polygon object
    • add

      public void add(GeoRectangle r)
      Adds a Rectangle2D object to this Rectangle2D. The resulting Rectangle2D is the union of the two GeoRectangle objects.
      Specified by:
      add in class GeoRectangle
      Parameters:
      r - the Rectangle2D to add to this Rectangle2D.
    • copy

      public GeoRectangle.Double copy()
      Description copied from class: GeoRectangle
      Retrieves a copy of this GeoRectangle object with the exact same bounding coordinates. The backing polygon associated with this copy may have its nodes in a different order than the original.
      Specified by:
      copy in class GeoRectangle
      Returns:
      a GeoRectangle
    • setRect

      public void setRect(double xCorner1, double yCorner1, double xCorner2, double yCorner2)
      Description copied from class: GeoRectangle
      Set the coordinates of this rectangle by its lower-left and upper-right points
      Specified by:
      setRect in class GeoRectangle
      Parameters:
      xCorner1 - the x coordinate of the first corner of this rectangle
      yCorner1 - the y coordinate of the first corner of this rectangle
      xCorner2 - the x coordinate of the opposite corner of this rectangle
      yCorner2 - the y coordinate of the opposite corner of this rectangle
    • equals

      public boolean equals(Object obj)
      Determines if the given object possesses the same coordinate bounds as this GeoRectangle. The two objects do not necessarily have to be equivalent as given by this == obj, however, if they are this will return true
      Specified by:
      equals in class GeoRectangle
      Parameters:
      obj - another Object
      Returns:
      true if the given object is an instance of GeoRectangle and has the same rectangular bounds as this GeoRectangle, otherwise false.
    • getBackingPolygon

      public Polygon2D.Double getBackingPolygon()
      Description copied from class: GeoRectangle
      Retrieves a copy of the 4-point polygon representation of this GeoRectangle
      Specified by:
      getBackingPolygon in class GeoRectangle
      Returns:
      a Polygon2D object
    • getLowerLeft

      public Point2D getLowerLeft()
      Description copied from class: GeoRectangle
      Retrieves the lower-left point of this rectangle
      Specified by:
      getLowerLeft in class GeoRectangle
      Returns:
      a Point2D object
    • getUpperRight

      public Point2D getUpperRight()
      Description copied from class: GeoRectangle
      Retrieves the upper-right point of this rectangle
      Specified by:
      getUpperRight in class GeoRectangle
      Returns:
      a Point2D object
    • getMinX

      public double getMinX()
      Description copied from class: GeoRectangle
      Determines the lowest x value within the points of this rectangle
      Specified by:
      getMinX in class GeoRectangle
      Returns:
      the lowest x value
    • getMinY

      public double getMinY()
      Description copied from class: GeoRectangle
      Determines the lowest x value within the points of this rectangle
      Specified by:
      getMinY in class GeoRectangle
      Returns:
      the lowest x value
    • getMaxX

      public double getMaxX()
      Description copied from class: GeoRectangle
      Determines the lowest x value within the points of this rectangle
      Specified by:
      getMaxX in class GeoRectangle
      Returns:
      the lowest x value
    • getMaxY

      public double getMaxY()
      Description copied from class: GeoRectangle
      Determines the lowest x value within the points of this rectangle
      Specified by:
      getMaxY in class GeoRectangle
      Returns:
      the lowest x value