public class LatLonRect
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static LatLonRect |
INVALID |
Constructor and Description |
---|
LatLonRect()
Create a LatLonRect that covers the whole world.
|
LatLonRect(LatLonPoint p1,
double deltaLat,
double deltaLon)
Construct a lat/lon bounding box from a point, and a delta lat, lon.
|
LatLonRect(LatLonPoint left,
LatLonPoint right)
Construct a lat/lon bounding box from two points.
|
LatLonRect(LatLonRect r)
Copy Constructor
|
LatLonRect(java.lang.String spec)
Construct a lat/lon bounding box from a string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containedIn(LatLonRect b)
Determine if this bounding box is contained in another LatLonRect.
|
boolean |
contains(double lat,
double lon)
Determine if the given lat/lon point is contined inside this rectangle.
|
boolean |
contains(LatLonPoint p)
Determine if a specified LatLonPoint is contained in this bounding box.
|
boolean |
containsAllLongitude()
return does this rectangle contain all longitudes
|
boolean |
crossDateline()
Get whether the bounding box crosses the +/- 180 seam
|
boolean |
equals(java.lang.Object o) |
static LatLonRect |
extend(LatLonRect rect,
LatLonPoint p)
Extend the bounding box to contain this point.
|
static LatLonRect |
extend(LatLonRect rect,
LatLonRect other)
Extend the bounding box to contain another bounding box.
|
double |
getCenterLon()
return center Longitude, always in the range +/-180
|
double |
getHeight()
return height of bounding box, always between 0 and 180 degrees.
|
double |
getLatMax()
Get maximum latitude, aka "north" edge
|
double |
getLatMin()
Get minimum latitude, aka "south" edge
|
double |
getLonMax()
Get maximum longitude, aka "east" edge
|
double |
getLonMin()
Get minimum longitude, aka "west" edge
|
ucar.unidata.geoloc.LatLonPointImpl |
getLowerLeftPoint()
Get the lower left corner of the bounding box.
|
ucar.unidata.geoloc.LatLonPointImpl |
getLowerRightPoint()
Get the lower left corner of the bounding box.
|
ucar.unidata.geoloc.LatLonPointImpl |
getUpperLeftPoint()
Get the upper left corner of the bounding box.
|
ucar.unidata.geoloc.LatLonPointImpl |
getUpperRightPoint()
Get the upper right corner of the bounding box.
|
double |
getWidth()
return width of bounding box, always between 0 and 360 degrees.
|
int |
hashCode() |
LatLonRect |
intersect(LatLonRect clip)
Create the instersection of this LatLon with the given one
|
boolean |
nearlyEquals(LatLonRect other)
Returns the result of
nearlyEquals(LatLonRect, double) , with Misc.defaultMaxRelativeDiffFloat . |
boolean |
nearlyEquals(LatLonRect other,
double maxRelDiff)
Returns
true if this rectangle is nearly equal to other . |
java.lang.String |
toString()
Return a String representation of this object.
|
java.lang.String |
toString2()
Return a String representation of this object.
|
public static LatLonRect INVALID
public LatLonRect()
public LatLonRect(LatLonPoint p1, double deltaLat, double deltaLon)
p1
- one corner of the boxdeltaLat
- delta lat from p1. (may be positive or negetive)deltaLon
- delta lon from p1. (may be positive or negetive)public LatLonRect(LatLonPoint left, LatLonPoint right)
left
- left cornerright
- right cornerpublic LatLonRect(LatLonRect r)
r
- rectangle to copypublic LatLonRect(java.lang.String spec)
spec
- "lat, lon, deltaLat, deltaLon"LatLonRect(LatLonPoint p1, double deltaLat, double deltaLon)
public boolean containedIn(LatLonRect b)
b
- the other box to see if it contains this onepublic boolean contains(double lat, double lon)
lat
- lat of pointlon
- lon of pointpublic boolean contains(LatLonPoint p)
p
- the specified point to be testedpublic boolean containsAllLongitude()
public boolean crossDateline()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public static LatLonRect extend(LatLonRect rect, LatLonPoint p)
public static LatLonRect extend(LatLonRect rect, LatLonRect other)
public double getCenterLon()
public double getHeight()
public double getLatMax()
public double getLatMin()
public double getLonMax()
public double getLonMin()
public ucar.unidata.geoloc.LatLonPointImpl getLowerLeftPoint()
public ucar.unidata.geoloc.LatLonPointImpl getLowerRightPoint()
public ucar.unidata.geoloc.LatLonPointImpl getUpperLeftPoint()
public ucar.unidata.geoloc.LatLonPointImpl getUpperRightPoint()
public double getWidth()
public int hashCode()
hashCode
in class java.lang.Object
public LatLonRect intersect(LatLonRect clip)
clip
- intersect with thispublic boolean nearlyEquals(LatLonRect other)
nearlyEquals(LatLonRect, double)
, with Misc.defaultMaxRelativeDiffFloat
.public boolean nearlyEquals(LatLonRect other, double maxRelDiff)
true
if this rectangle is nearly equal to other
. The "near equality" of corners is
determined using LatLonPoint.nearlyEquals(LatLonPoint, double)
, with the specified maxRelDiff.other
- the other rectangle to check.maxRelDiff
- the maximum relative difference
that two corners may have.true
if this rectangle is nearly equal to other
.public java.lang.String toString()
eg: ll: 90.0S .0E+ ur: 90.0N .0E
toString
in class java.lang.Object
public java.lang.String toString2()
lat= [-90.00,90.00] lon= [0.00,360.00