@Immutable public class LatLonRect extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LatLonRect.Builder |
| Modifier and Type | Field and Description |
|---|---|
static LatLonRect |
INVALID |
| Constructor and Description |
|---|
LatLonRect()
Create a LatLonRect that covers the whole world.
|
LatLonRect(double lat0,
double lon0,
double lat1,
double lon1)
Construct a lat/lon bounding box from unnormalized longitudes.
|
LatLonRect(LatLonPoint p1,
double deltaLat,
double deltaLon)
Construct a lat/lon bounding box from a point, and a delta lat, lon.
|
| Modifier and Type | Method and Description |
|---|---|
static LatLonRect.Builder |
builder(double lat0,
double lon0,
double lat1,
double lon1)
Construct a lat/lon bounding box from unnormalized longitude.
|
static LatLonRect.Builder |
builder(LatLonPoint p1,
double deltaLat,
double deltaLon)
Construct a lat/lon bounding box from a point, and a delta lat, lon.
|
static LatLonRect.Builder |
builder(LatLonPoint left,
LatLonPoint right)
Deprecated.
use builder(LatLonPoint p1, double deltaLat, double deltaLon).
|
static LatLonRect.Builder |
builder(String spec)
Deprecated.
use fromSpec(String spec)
|
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) |
static LatLonRect |
fromSpec(String spec)
Construct a lat/lon bounding box from a string, or null if format is wrong.
|
double |
getCenterLon()
return center Longitude, always in the range +/-180
|
double |
getHeight()
return height of bounding box in degrees latitude, 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.
|
LatLonPoint |
getLowerLeftPoint()
Get the lower left corner of the bounding box.
|
LatLonPoint |
getLowerRightPoint()
Get the lower left corner of the bounding box.
|
LatLonPoint |
getUpperLeftPoint()
Get the upper left corner of the bounding box.
|
LatLonPoint |
getUpperRightPoint()
Get the upper right corner of the bounding box.
|
double |
getWidth()
return width of bounding box in degrees longitude, always between 0 and 360 degrees.
|
int |
hashCode() |
LatLonRect |
intersect(LatLonRect clip)
Create the intersection of this LatLonRect with another LatLonRect.
|
boolean |
isAllLongitude()
Get whether the bounding box contains all longitudes.
|
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. |
LatLonRect.Builder |
toBuilder()
Convert to a mutable Builder
|
String |
toString()
Return a String representation of this LatLonRect that can be used in new LatLonRect.Builder(String):
"lat, lon, deltaLat, deltaLon"
|
String |
toString1()
Return a String representation of this object.
|
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). A negetive value is interepreted as
indicating a wrap, and 360 is added to it.public LatLonRect(double lat0,
double lon0,
double lat1,
double lon1)
lat0 - lat of starting pointlon0 - lon of starting pointlat1 - lat of ending pointlon1 - lon of ending pointpublic LatLonPoint getUpperRightPoint()
public LatLonPoint getLowerLeftPoint()
public LatLonPoint getUpperLeftPoint()
public LatLonPoint getLowerRightPoint()
public boolean crossDateline()
public boolean isAllLongitude()
public double getWidth()
public double getHeight()
public double getCenterLon()
public double getLonMin()
public double getLonMax()
public double getLatMin()
public double getLatMax()
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 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@Nullable public LatLonRect intersect(LatLonRect clip)
clip - intersect with thispublic String toString1()
eg: ll: 90.0S .0E+ ur: 90.0N .0E
public String toString2()
lat= [-90.00,90.00] lon= [0.00,360.00
public String toString()
public LatLonRect.Builder toBuilder()
@Deprecated public static LatLonRect.Builder builder(LatLonPoint left, LatLonPoint right)
left - left cornerright - right cornerpublic static LatLonRect.Builder builder(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 static LatLonRect.Builder builder(double lat0, double lon0, double lat1, double lon1)
lat0 - lat of starting pointlon0 - lon of starting pointlat1 - lat of ending pointlon1 - lon of ending point@Nullable public static LatLonRect fromSpec(String spec)
spec - "lat, lon, deltaLat, deltaLon"
LatLonRect.Builder(LatLonPoint, double, double)@Deprecated public static LatLonRect.Builder builder(String spec)