Package ucar.nc2.dt.ugrid.geom
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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ucar.nc2.dt.ugrid.geom.GeoRectangle
GeoRectangle.Double
-
-
Field Summary
-
Fields inherited from class ucar.nc2.dt.ugrid.geom.GeoRectangle
polygon
-
-
Constructor Summary
Constructors Constructor Description Double()Constructs a GeoRectangle.Double with all four points located at {0,0}Double(double[] xVals, double[] yVals)Constructor accepting two double arrays, one for x values and one for y values.Double(double x, double y)Constructs a GeoRectangle.Double from the given location.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 rectangleDouble(Point2D loc)Constructs a GeoRectangle.Double from the given location.Double(Point2D corner1, Point2D corner2)Constructs a GeoRectangle.Double from the given corner points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(GeoRectangle r)Adds aRectangle2Dobject to thisRectangle2D.voidadd(Polygon2D polygon)Extends this rectangle by the bounding box of the given polygon.GeoRectangle.Doublecopy()Retrieves a copy of thisGeoRectangleobject with the exact same bounding coordinates.booleanequals(Object obj)Determines if the given object possesses the same coordinate bounds as thisGeoRectangle.Polygon2D.DoublegetBackingPolygon()Retrieves a copy of the 4-point polygon representation of thisGeoRectanglePoint2DgetLowerLeft()Retrieves the lower-left point of this rectangledoublegetMaxX()Determines the lowest x value within the points of this rectangledoublegetMaxY()Determines the lowest x value within the points of this rectangledoublegetMinX()Determines the lowest x value within the points of this rectangledoublegetMinY()Determines the lowest x value within the points of this rectanglePoint2DgetUpperRight()Retrieves the upper-right point of this rectanglevoidsetRect(double xCorner1, double yCorner1, double xCorner2, double yCorner2)Set the coordinates of this rectangle by its lower-left and upper-right points-
Methods inherited from class ucar.nc2.dt.ugrid.geom.GeoRectangle
contains, contains, contains, contains, contains, contains, getArea, getBounds, getBounds2D, getCentroid, getHeight, getPathIterator, getPathIterator, getWidth, getXCoords, getYCoords, intersects, intersects, intersects, isEmpty, setRect, setRect, toString, union
-
-
-
-
Constructor Detail
-
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 locationy- 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 rectanglecorner2- a point representing the point oppositecorner1
-
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 rectangleyVals- 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 rectangleyCorner1- the y coordinate of the first corner of this rectanglexCorner2- the x coordinate of the opposite corner of this rectangleyCorner2- the y coordinate of the opposite corner of this rectangle
-
-
Method Detail
-
add
public void add(Polygon2D polygon)
Extends this rectangle by the bounding box of the given polygon. The resulting rectangle is the union of thisGeoRectanglewith the rectangle representing the bounds of the givenPolygon2D- Specified by:
addin classGeoRectangle- Parameters:
polygon- Apolygonobject
-
add
public void add(GeoRectangle r)
Adds aRectangle2Dobject to thisRectangle2D. The resultingRectangle2Dis the union of the twoGeoRectangleobjects.- Specified by:
addin classGeoRectangle- Parameters:
r- theRectangle2Dto add to thisRectangle2D.
-
copy
public GeoRectangle.Double copy()
Description copied from class:GeoRectangleRetrieves a copy of thisGeoRectangleobject 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:
copyin classGeoRectangle- Returns:
- a
GeoRectangle
-
setRect
public void setRect(double xCorner1, double yCorner1, double xCorner2, double yCorner2)Description copied from class:GeoRectangleSet the coordinates of this rectangle by its lower-left and upper-right points- Specified by:
setRectin classGeoRectangle- Parameters:
xCorner1- the x coordinate of the first corner of this rectangleyCorner1- the y coordinate of the first corner of this rectanglexCorner2- the x coordinate of the opposite corner of this rectangleyCorner2- 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 thisGeoRectangle. The two objects do not necessarily have to be equivalent as given bythis == obj, however, if they are this will return true- Specified by:
equalsin classGeoRectangle- Parameters:
obj- anotherObject- Returns:
trueif the given object is an instance ofGeoRectangleand has the same rectangular bounds as thisGeoRectangle, otherwisefalse.
-
getBackingPolygon
public Polygon2D.Double getBackingPolygon()
Description copied from class:GeoRectangleRetrieves a copy of the 4-point polygon representation of thisGeoRectangle- Specified by:
getBackingPolygonin classGeoRectangle- Returns:
- a
Polygon2Dobject
-
getLowerLeft
public Point2D getLowerLeft()
Description copied from class:GeoRectangleRetrieves the lower-left point of this rectangle- Specified by:
getLowerLeftin classGeoRectangle- Returns:
- a
Point2Dobject
-
getUpperRight
public Point2D getUpperRight()
Description copied from class:GeoRectangleRetrieves the upper-right point of this rectangle- Specified by:
getUpperRightin classGeoRectangle- Returns:
- a
Point2Dobject
-
getMinX
public double getMinX()
Description copied from class:GeoRectangleDetermines the lowest x value within the points of this rectangle- Specified by:
getMinXin classGeoRectangle- Returns:
- the lowest x value
-
getMinY
public double getMinY()
Description copied from class:GeoRectangleDetermines the lowest x value within the points of this rectangle- Specified by:
getMinYin classGeoRectangle- Returns:
- the lowest x value
-
getMaxX
public double getMaxX()
Description copied from class:GeoRectangleDetermines the lowest x value within the points of this rectangle- Specified by:
getMaxXin classGeoRectangle- Returns:
- the lowest x value
-
getMaxY
public double getMaxY()
Description copied from class:GeoRectangleDetermines the lowest x value within the points of this rectangle- Specified by:
getMaxYin classGeoRectangle- Returns:
- the lowest x value
-
-