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
- See Also:
-
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
ConstructorsConstructorDescriptionDouble()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 rectangleConstructs a GeoRectangle.Double from the given location.Constructs a GeoRectangle.Double from the given corner points. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(GeoRectangle r) Adds aRectangle2Dobject to thisRectangle2D.voidExtends this rectangle by the bounding box of the given polygon.copy()Retrieves a copy of thisGeoRectangleobject with the exact same bounding coordinates.booleanDetermines if the given object possesses the same coordinate bounds as thisGeoRectangle.Retrieves a copy of the 4-point polygon representation of thisGeoRectangleRetrieves 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 rectangleRetrieves 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 pointsMethods 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 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 locationy- the y location
-
Double
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
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 Details
-
add
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
Adds aRectangle2Dobject to thisRectangle2D. The resultingRectangle2Dis the union of the twoGeoRectangleobjects.- Specified by:
addin classGeoRectangle- Parameters:
r- theRectangle2Dto add to thisRectangle2D.
-
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
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
Description copied from class:GeoRectangleRetrieves a copy of the 4-point polygon representation of thisGeoRectangle- Specified by:
getBackingPolygonin classGeoRectangle- Returns:
- a
Polygon2Dobject
-
getLowerLeft
Description copied from class:GeoRectangleRetrieves the lower-left point of this rectangle- Specified by:
getLowerLeftin classGeoRectangle- Returns:
- a
Point2Dobject
-
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
-