public class LatLonRect extends 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(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 |
crossDateline()
Get whether the bounding box crosses the +/- 180 seam
|
boolean |
equals(Object o) |
void |
extend(LatLonPoint p)
Deprecated.
use builder
|
void |
extend(LatLonRect r)
Deprecated.
use builder
|
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
|
LatLonPointImpl |
getLowerLeftPoint()
Get the lower left corner of the bounding box.
|
LatLonPointImpl |
getLowerRightPoint()
Get the lower left corner of the bounding box.
|
LatLonPointImpl |
getUpperLeftPoint()
Get the upper left corner of the bounding box.
|
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 . |
String |
toString()
Return a String representation of this object.
|
String |
toString2()
Return a String representation of this object.
|
public static LatLonRect INVALID
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(String spec)
spec
- "lat, lon, deltaLat, deltaLon"LatLonRect(LatLonPoint p1, double deltaLat, double deltaLon)
public LatLonRect(LatLonRect r)
r
- rectangle to copypublic LatLonRect()
public LatLonPointImpl getUpperRightPoint()
public LatLonPointImpl getLowerLeftPoint()
public LatLonPointImpl getUpperLeftPoint()
public LatLonPointImpl getLowerRightPoint()
public boolean crossDateline()
public 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 double getWidth()
public double getHeight()
public double getCenterLon()
public double getLonMin()
public double getLonMax()
public double getLatMin()
public double getLatMax()
public boolean contains(LatLonPoint p)
p
- the specified point to be testedpublic boolean contains(double lat, double lon)
lat
- lat of pointlon
- lon of pointpublic boolean containedIn(LatLonRect b)
b
- the other box to see if it contains this one@Deprecated public void extend(LatLonPoint p)
p
- point to include@Deprecated public void extend(LatLonRect r)
r
- rectangle to includepublic LatLonRect intersect(LatLonRect clip)
clip
- intersect with thispublic String toString()
eg: ll: 90.0S .0E+ ur: 90.0N .0E
public String toString2()
lat= [-90.00,90.00] lon= [0.00,360.00