公共最终类 LatLngBounds 扩展了对象
,实现了 Parcelable
,实现了 Parcelable
表示纬度/经度对齐矩形的不可变类。
嵌套类摘要
类 | LatLngBounds.Builder | 此构建器可以根据一组 LatLng 点创建下限。 |
继承的常量摘要
字段摘要
public final LatLng | 东北部 | 边界的东北角。 |
public final LatLng | 美国西南部 | 边界的西南角。 |
公共构造函数摘要
公共方法摘要
static LatLngBounds.Builder |
builder()
创建新的构建器。
|
布尔值 | |
static LatLngBounds |
createFromAttributes(上下文环境、AttributeSet 属性)
根据
AttributeSet 创建 LatLngBounds。 |
布尔值 |
等于(对象 o)
|
LatLng |
getCenter()
返回此 LatLngBounds 的中心。
|
整数 |
hashCode()
|
LatLngBounds | |
字符串 |
继承的方法摘要
字段
公共构造函数
public LatLngBounds (LatLng 西南部,LatLng 东北部)
根据西南角和东北角创建新的边界。
从概念上讲,边界包括符合以下条件的所有点:
- 纬度在 [northeast.纬度, 南方纬度] 范围内;
- 如果 southwest.经度 ≤ northeast.经度,则经度在 [southwest.经度,东北.经度] 范围内;
- 经度在 [southwest.经度, 180) ÷ [-180, northeast.经度] 范围内,如果 southwest.经度 > northeast.经度。
参数
西南 | 西南角 |
---|---|
东北 | 东北角 |
抛出
IllegalArgumentException | 东北角的纬度低于西南角的纬度。 |
---|
公共方法
public boolean contains (LatLng point)
public static LatLngBounds createFromAttributes (context context, AttributeSet attrs)
根据 AttributeSet
创建 LatLngBounds。
参数
context | |
---|---|
attrs |
public boolean equals (Object o)
参数
o |
---|
public LatLng getCenter ()
返回此 LatLngBounds 的中心。该中心只是坐标的平均值(如果横跨对向子午线,则需考虑在内)。这大概是地理中心(如果地球是完美的球面的话,那就是精确的)。由于墨卡托投影法,这不一定是地图上绘制的矩形中心。
返回
LatLng
,它是 LatLngBounds 的中心。
public int hashCode ()
public LatLngBounds include (LatLng point)
返回一个新的 LatLngBounds
,用于扩展此 LatLngBounds 以包含给定的 LatLng
。这将同时返回同时包含该点和额外点的最小 LatLngBounds。
特别是,它会考虑向东和向西扩展边界(其中一个可以穿过对向子午线),然后选择两者中的较小者。如果两个方向都生成相同大小的 LatLngBounds,则会使其朝向东方。
参数
点 | 一个要添加到新边界中的 LatLng |
---|
返回
- 包含此点和额外点的新
LatLngBounds
。