Package ucar.nc2.dt.ugrid.geom
Class LatLonRectangle2D
- java.lang.Object
-
- ucar.nc2.dt.ugrid.geom.LatLonRectangle2D
-
- All Implemented Interfaces:
Serializable
public class LatLonRectangle2D extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LatLonRectangle2D(double leftY, double leftX, double rightY, double rightX)LatLonRectangle2D(Point2D leftPoint, Point2D rightPoint)LatLonRectangle2D(LatLonPoint2D leftPoint, double dLat, double dLon)Deprecated.LatLonRectangle2D(LatLonPoint2D leftPoint, LatLonPoint2D rightPoint)LatLonRectangle2D(LatLonRectangle2D rect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainedBy(LatLonRectangle2D rect)booleancontains(double lat, double lon)booleancontains(Point2D point)booleancontains(LatLonPoint2D point)booleancontains(LatLonPolygon2D poly)booleancontains(LatLonRectangle2D rect)LatLonRectangle2Dcopy()Creates and returns a copy of this LatLonRectangle2DbooleancrossesDateline()booleanequals(LatLonRectangle2D rect)voidextend(double[] bounds)Extends the bounds of thisLatLonRectangle2Dby the coordinates in the bounding rectangle given bybounds.voidextend(double pLat, double pLon)voidextend(LatLonPoint2D point)voidextend(LatLonPolygon2D poly)voidextend(LatLonRectangle2D rect)doublegetArea()double[]getBoundingLatLonValues()Returns the coordinates of thisLatLonRectangle2Das adoublearray with a length of 4.doublegetCenterLatitude()doublegetCenterLongitude()LatLonPoint2DgetCentroid()doublegetHeight()double[]getLatCoords()doublegetLatMax()doublegetLatMin()double[]getLonCoords()doublegetLonMax()doublegetLonMin()LatLonPoint2DgetLowerLeftPoint()LatLonPoint2DgetLowerRightPoint()LatLonPoint2DgetUpperLeftPoint()LatLonPoint2DgetUpperRightPoint()doublegetWidth()booleanintersects(LatLonPoint2D point)booleanintersects(LatLonPolygon2D poly)booleanintersects(LatLonRectangle2D rect)LatLonRectangle2Drecenter(double centerLat, double centerLon)Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches the location specified by centerLat and centerLon.LatLonRectangle2Drecenter(Point2D newCenterPoint)Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches newCenterPoint.LatLonRectangle2Drecenter(LatLonRectangle2D referenceRectangle)Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches the centroid of the referenceRectangle.booleanshouldCrossDateline(LatLonPolygon2D poly)ucar.unidata.geoloc.LatLonRecttoLatLonRect()StringtoString()LatLonRectangle2Dtranslate(double deltaLat, double deltaLon)Shifts this rectangle by the distances deltaLat and deltaLon.
-
-
-
Constructor Detail
-
LatLonRectangle2D
@Deprecated public LatLonRectangle2D(LatLonPoint2D leftPoint, double dLat, double dLon)
Deprecated.
-
LatLonRectangle2D
public LatLonRectangle2D(double leftY, double leftX, double rightY, double rightX)
-
LatLonRectangle2D
public LatLonRectangle2D(LatLonPoint2D leftPoint, LatLonPoint2D rightPoint)
-
LatLonRectangle2D
public LatLonRectangle2D(LatLonRectangle2D rect)
-
-
Method Detail
-
getBoundingLatLonValues
public double[] getBoundingLatLonValues()
Returns the coordinates of thisLatLonRectangle2Das adoublearray with a length of 4. The coordinates are arranged in the order of southern lat, western lon, northern lat, and eastern lon
In terms of points where LL = lower left and UR = upper right, this is equivalent to the arrangement ofdouble[] {lly, llx, ury, urx}.- Returns:
- a
doublearray with a length of 4 containing the lat/lon points of this rectangle. If this object contains no verticesnullis returned.
-
getLowerLeftPoint
public LatLonPoint2D getLowerLeftPoint()
-
getUpperRightPoint
public LatLonPoint2D getUpperRightPoint()
-
getLowerRightPoint
public LatLonPoint2D getLowerRightPoint()
-
getUpperLeftPoint
public LatLonPoint2D getUpperLeftPoint()
-
crossesDateline
public boolean crossesDateline()
-
equals
public boolean equals(LatLonRectangle2D rect)
-
getWidth
public double getWidth()
-
getHeight
public double getHeight()
-
getCenterLatitude
public double getCenterLatitude()
-
getCenterLongitude
public double getCenterLongitude()
-
getCentroid
public LatLonPoint2D getCentroid()
-
getLonMin
public double getLonMin()
-
getLonMax
public double getLonMax()
-
getLatMin
public double getLatMin()
-
getLatMax
public double getLatMax()
-
getLonCoords
public double[] getLonCoords()
-
getLatCoords
public double[] getLatCoords()
-
contains
public boolean contains(Point2D point)
-
contains
public boolean contains(LatLonPoint2D point)
-
contains
public boolean contains(double lat, double lon)
-
contains
public boolean contains(LatLonRectangle2D rect)
-
contains
public boolean contains(LatLonPolygon2D poly)
-
containedBy
public boolean containedBy(LatLonRectangle2D rect)
-
intersects
public boolean intersects(LatLonRectangle2D rect)
-
intersects
public boolean intersects(LatLonPolygon2D poly)
-
intersects
public boolean intersects(LatLonPoint2D point)
-
extend
public void extend(double pLat, double pLon)
-
extend
public void extend(LatLonPoint2D point)
-
extend
public void extend(double[] bounds)
Extends the bounds of thisLatLonRectangle2Dby the coordinates in the bounding rectangle given bybounds. It is assumed that bounds is a non-null double array with a length of 4 which contains lat/lon coords in the arrangement of LLy, LLx, URy, URx.- Parameters:
bounds-
-
extend
public void extend(LatLonRectangle2D rect)
-
extend
public void extend(LatLonPolygon2D poly)
-
shouldCrossDateline
public boolean shouldCrossDateline(LatLonPolygon2D poly)
-
getArea
public double getArea()
-
copy
public LatLonRectangle2D copy()
Creates and returns a copy of this LatLonRectangle2D- Returns:
- a copy of this LatLonRectangle2D
-
translate
public LatLonRectangle2D translate(double deltaLat, double deltaLon)
Shifts this rectangle by the distances deltaLat and deltaLon.- Parameters:
deltaLat- the distance (in Decimal Degrees) by which to move this rectangle vertically. + to the North, - to the South- Returns:
- a reference to this LatLonRectangle2D - for convenience
-
recenter
public LatLonRectangle2D recenter(LatLonRectangle2D referenceRectangle)
Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches the centroid of the referenceRectangle. Delegates torecenter(Point2D)- Parameters:
referenceRectangle- the LatLonRectangle2D to move this LatLonRectangle2D's centroid to- Returns:
- this LatLonRectangle2D, for convenience
-
recenter
public LatLonRectangle2D recenter(Point2D newCenterPoint)
Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches newCenterPoint. Delegates torecenter(double, double)- Parameters:
newCenterPoint- the new center point- Returns:
- this LatLonRectangle2D, for convenience
-
recenter
public LatLonRectangle2D recenter(double centerLat, double centerLon)
Usestranslate(double, double)to shift this LatLonRectangle2D so that the centroid matches the location specified by centerLat and centerLon.- Parameters:
centerLat- the new center latitudecenterLon- the new center longitude- Returns:
- this LatLonRectangle2D, for convenience
-
toLatLonRect
public ucar.unidata.geoloc.LatLonRect toLatLonRect()
-
-