LatLngBounds

公共最终类 LatLngBounds 扩展了对象
,实现了 Parcelable

表示纬度/经度对齐矩形的不可变类。

嵌套类摘要

LatLngBounds.Builder 此构建器可以根据一组 LatLng 点创建下限。

继承的常量摘要

字段摘要

public final LatLng 东北部 边界的东北角。
public final LatLng 美国西南部 边界的西南角。

公共构造函数摘要

LatLngBoundsLatLng 西南部,LatLng 东北部)
用于根据西南角和东北角创建新的边界。
LatLngBounds(LatLngBounds bounds)
复制构造函数。

公共方法摘要

static LatLngBounds.Builder
builder()
创建新的构建器。
布尔值
containsLatLng 点)
返回此字段是否包含指定的 LatLng
static LatLngBounds
createFromAttributes(上下文环境、AttributeSet 属性)
根据 AttributeSet 创建 LatLngBounds。
布尔值
等于(对象 o)
LatLng
getCenter()
返回此 LatLngBounds 的中心。
整数
LatLngBounds
包括LatLng 点)
返回一个新的 LatLngBounds,用于扩展此 LatLngBounds 以包含给定的 LatLng
字符串
toString

继承的方法摘要

字段

public 最终 LatLng northeast

边界的东北角。

public 最终 LatLng southwest

边界的西南角。

公共构造函数

public LatLngBounds LatLng 西南部,LatLng 东北部)

根据西南角和东北角创建新的边界。

从概念上讲,边界包括符合以下条件的所有点:

  • 纬度在 [northeast.纬度, 南方纬度] 范围内;
  • 如果 southwest.经度 ≤ northeast.经度,则经度在 [southwest.经度,东北.经度] 范围内;
  • 经度在 [southwest.经度, 180) ÷ [-180, northeast.经度] 范围内,如果 southwest.经度 > northeast.经度。

参数
西南 西南角
东北 东北角
抛出
IllegalArgumentException 东北角的纬度低于西南角的纬度。

public BoundBounds (LatLngBounds bounds)

复制构造函数。

参数
范围 要复制的对象。

公共方法

public static LatLngBounds.Builder builder ()

创建新的构建器。

public boolean contains (LatLng point)

返回此字段是否包含指定的 LatLng

参数
要测试的 LatLng
返回
  • 如果给定点包含该点,则返回 true;否则返回 false

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
返回

public String toString ()