Class: Rectangle

Rectangle

new Rectangle(west, south, east, north)

以经纬度坐标指定的二维区域。

Name Type Default Description
west Number 0.0 可选

西经在[-Pi, Pi]范围内的最西经,以弧度为单位

south Number 0.0 可选

最南端的纬度,以弧度计,在[-Pi/2, Pi/2]范围内。

east Number 0.0 可选

以弧度为单位,在[-Pi, Pi]范围内的最东经。

north Number 0.0 可选

最北纬,以弧度为单位,在[-Pi/2, Pi/2]范围内。

See:
  • Packable

Members

(static, constant) MAX_VALUERectangle

最大的矩形。

static packedLengthNumber

用于将对象打包到数组中的元素数量。

eastNumber

在[-Pi, Pi]范围内以弧度为单位的最东经。

Default Value:
0.0

heightNumber

以弧度为单位获取矩形的高度。

northNumber

在[-Pi/2, Pi/2]范围内以弧度为单位的最北纬。

Default Value:
0.0

southNumber

在[-Pi/2, Pi/2]范围内以弧度为单位的最南端纬度。

Default Value:
0.0

westNumber

在[-Pi, Pi]范围内以弧度为单位的最西经。

Default Value:
0.0

widthNumber

获取以弧度为单位的矩形的宽度。

Methods

static center(rectangle, result){Cartographic}

计算矩形的中心点。

Name Type Description
rectangle Rectangle

查找中心点的矩形。

result Cartographic 可选

存储结果的对象。

Returns:
Type Description
Cartographic 修改后的结果参数,或一个新的投影实例(如果没有提供)。

static clone(rectangle, result){Rectangle}

复制一个矩形。

Name Type Description
rectangle Rectangle

要复制的矩形。

result Rectangle 可选

存储结果的对象,如果需要创建新实例,则未定义。

Returns:
Type Description
Rectangle 如果没有提供,则为修改后的结果参数或一个新的Rectangle实例。(如果矩形未定义则返回未定义)

static computeHeight(rectangle){Number}

以弧度为单位计算矩形的高度。

Name Type Description
rectangle Rectangle

需要计算高度的矩形。

Returns:
Type Description
Number 高度。

static computeWidth(rectangle){Number}

以弧度为单位计算矩形的宽度。

Name Type Description
rectangle Rectangle

需要计算宽度的矩形。

Returns:
Type Description
Number 宽度。

static contains(rectangle, cartographic){Boolean}

如果地图投影在矩形上或矩形内部,则返回true;否则返回false。

Name Type Description
rectangle Rectangle

矩形。

cartographic Cartographic

要测试的地图投影。

Returns:
Type Description
Boolean 如果提供的地图投影在矩形内部,则为true;否则为false。

static equals(left, right){Boolean}

比较所提供的矩形,如果相等则返回 true,否则返回 false。

Name Type Description
left Rectangle 可选

第一个矩形。

right Rectangle 可选

第二个矩形。

Returns:
Type Description
Boolean 如果两个矩形相等,则为true,否则为false。

static equalsEpsilon(left, right, epsilon){Boolean}

将提供的矩形与此矩形进行比较,如果它们在提供的epsilon范围内,则返回true,否则返回false。

Name Type Description
left Rectangle 可选

要比较的矩形。

right Rectangle 可选

另一个要比较的矩形。

epsilon Number

用于等式测试的容差值。

Returns:
Type Description
Boolean 如果矩形在提供的epsilon内则为true,否则为false

static expand(rectangle, cartographic, result){Rectangle}

通过扩大所提供的矩形直至包含所提供的地图来计算矩形。

Name Type Description
rectangle Rectangle

要展开的矩形。

cartographic Cartographic

要在矩形内包含的地图投影。

result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。

static fromCartesianArray(cartesians, ellipsoid, result){Rectangle}

创建包围所提供数组中所有位置的最小矩形。

Name Type Default Description
cartesians Array.<Cartesian>

地图投影实例的列表。

ellipsoid Ellipsoid Ellipsoid.WGS84 可选

直角坐标系所在的椭球体。

result Rectangle 可选

存储结果的对象,如果需要创建新实例,则未定义。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。

static fromCartographicArray(cartographics, result){Rectangle}

创建包围所提供数组中所有位置的最小矩形。

Name Type Description
cartographics Array.<Cartographic>

地图投影实例的列表。

result Rectangle 可选

存储结果的对象,如果需要创建新实例,则未定义。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。

static fromDegrees(west, south, east, north, result){Rectangle}

根据边界经度和纬度(以度为单位)创建一个矩形。

Name Type Default Description
west Number 0.0 可选

最西端的经度,单位为度,范围 [-180.0, 180.0]。

south Number 0.0 可选

最南端纬度,单位为度,范围 [-90.0, 90.0]。

east Number 0.0 可选

在[-180.0,180.0]范围内以度为单位的最东经。

north Number 0.0 可选

在纬度范围[-90.0,90.0]内最北的纬度。

result Rectangle 可选

要在其上存储结果的对象,如果要创建新实例,则未定义。

Returns:
Type Description
Rectangle 如果没有提供,则为修改后的结果参数或一个新的Rectangle实例。
Example
var rectangle = SuperMap3D.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);

static fromRadians(west, south, east, north, result){Rectangle}

创建给定边界经度和纬度(以弧度为单位)的矩形。

Name Type Default Description
west Number 0.0 可选

范围内以弧度为单位的最西经[-数学]。π,Math.PI]。

south Number 0.0 可选

范围内以弧度为单位的最南端纬度[-数学]。π/ 2,Math.PI / 2)。

east Number 0.0 可选

范围内以弧度为单位的最东经[-数学]。π,Math.PI]。

north Number 0.0 可选

范围内以弧度为单位的最北纬[-数学]。π/ 2,Math.PI / 2)。

result Rectangle 可选

存储结果的对象,如果需要创建新实例,则未定义。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。
Example
var rectangle = SuperMap3D.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);

static intersection(rectangle, otherRectangle, result){Rectangle|undefined}

计算两个矩形的交点。此函数假定矩形的坐标是以弧度为单位的经度和纬度,并考虑到同一角度可以用多个值表示以及反经线处的经度包络等因素,生成正确的交点。关于忽略这些因素并可用于投影坐标的简单相交,请参见 Rectangle.simpleIntersection

Name Type Description
rectangle Rectangle

在矩形上查找交点。

otherRectangle Rectangle

另一个矩形的交点

result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle | undefined 修改后的结果参数,如果没有提供,则是一个新的矩形实例;如果没有交集,则未定义。

static northeast(rectangle, result){Cartographic}

计算矩形的东北角。

Name Type Description
rectangle Rectangle

查找角的矩形。

result Cartographic 可选

存储结果的对象。

Returns:
Type Description
Cartographic 修改后的结果参数,或一个新的投影实例(如果没有提供)。

static northwest(rectangle, result){Cartographic}

计算矩形的西北角。

Name Type Description
rectangle Rectangle

查找角的矩形。

result Cartographic 可选

存储结果的对象。

Returns:
Type Description
Cartographic 修改后的结果参数,或一个新的投影实例(如果没有提供)。

static pack(value, array, startingIndex){Array.<Number>}

将提供的实例存储到提供的数组中。

Name Type Default Description
value Rectangle

要打包的值。

array Array.<Number>

要装入的数组。

startingIndex Number 0 可选

开始打包元素的数组的索引。

Returns:
Type Description
Array.<Number> 被装入的数组。

static simpleIntersection(rectangle, otherRectangle, result){Rectangle|undefined}

计算两个矩形的简单交集。与 Rectangle.intersection 不同的是,此函数并不试图将角度坐标置于一致的范围内,也不考虑穿越反经线的情况。 因此,它可以用于坐标不是简单经纬度(即投影坐标)的矩形。

Name Type Description
rectangle Rectangle

在矩形上查找交点

otherRectangle Rectangle

另一个矩形的交点

result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle | undefined 修改后的结果参数,如果没有提供,则是一个新的矩形实例;如果没有交集,则未定义。

static southeast(rectangle, result){Cartographic}

计算矩形的东南角。

Name Type Description
rectangle Rectangle

查找角的矩形。

result Cartographic 可选

存储结果的对象。

Returns:
Type Description
Cartographic 修改后的结果参数,或一个新的投影实例(如果没有提供)。

static southwest(rectangle, result){Cartographic}

计算矩形的西南角。

Name Type Description
rectangle Rectangle

查找角的矩形。

result Cartographic 可选

存储结果的对象。

Returns:
Type Description
Cartographic 修改后的结果参数,或一个新的投影实例(如果没有提供)。

static subsample(rectangle, ellipsoid, surfaceHeight, result){Array.<Cartesian3>}

对矩形进行采样,使其包含适合传递给BoundingSphere#fromPoints的Cartesian点列表。以解释覆盖两极或跨越赤道的矩形。

Name Type Default Description
rectangle Rectangle

子样本的矩形区域。

ellipsoid Ellipsoid Ellipsoid.WGS84 可选

要使用的椭球体。

surfaceHeight Number 0.0 可选

矩形在椭圆体上方的高度。

result Array.<Cartesian3> 可选

用于存储结果的Cartesians数组。

Returns:
Type Description
Array.<Cartesian3> 修改后的结果参数,或者一个新的Cartesians实例数组(如果没有提供)。

static union(rectangle, otherRectangle, result){Rectangle}

计算由两个矩形合并而成的矩形。

Name Type Description
rectangle Rectangle

在矩形中包围的矩形。

otherRectangle Rectangle

另一个在矩形中包围的矩形。

result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle 如果没有提供,则为修改后的结果参数或一个新的Rectangle实例。

static unpack(array, startingIndex, result){Rectangle}

从打包数组中检索实例。

Name Type Default Description
array Array.<Number>

打包数组。

startingIndex Number 0 可选

要解压缩的元素的起始索引。

result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。

static validate(rectangle)

检查矩形的属性,如果不在有效范围内则抛出。

Name Type Description
rectangle Rectangle

要验证的矩形。

Throws:
  • 北必须在区间[-Pi/2Pi/2]内。

    Type
    DeveloperError
  • 南必须在区间[-Pi/2Pi/2]内。

    Type
    DeveloperError
  • 东必须在区间[-PiPi]内。

    Type
    DeveloperError
  • 西必须在区间[-PiPi]内。

    Type
    DeveloperError

clone(result){Rectangle}

复制这个矩形。

Name Type Description
result Rectangle 可选

存储结果的对象。

Returns:
Type Description
Rectangle 修改后的结果参数,或者一个新的矩形实例(如果没有提供)。

equals(other){Boolean}

将提供的矩形与此矩形进行分量比较,如果相等则返回 true,否则返回 false。

Name Type Description
other Rectangle 可选

要比较的矩形。

Returns:
Type Description
Boolean 如果两个矩形相等,则为 true,否则为 false。

equalsEpsilon(other, epsilon){Boolean}

将提供的矩形与此矩形进行比较,如果它们在提供的epsilon范围内,则返回true,否则返回false。

Name Type Description
other Rectangle 可选

要比较的矩形。

epsilon Number

用于等式测试的容差值。

Returns:
Type Description
Boolean 如果矩形在提供的epsilon内则为true,否则为false