Rectangle

new Cesium.Rectangle(west, south, east, north)

A two dimensional region specified as longitude and latitude coordinates.
参数名称 类型 默认值 描述信息
west number 0.0 可选 The westernmost longitude, in radians, in the range [-Pi, Pi].
south number 0.0 可选 The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
east number 0.0 可选 The easternmost longitude, in radians, in the range [-Pi, Pi].
north number 0.0 可选 The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
参考:

成员(属性)

static constant Cesium.Rectangle.MAX_VALUE : Rectangle

The largest possible rectangle.

static Cesium.Rectangle.packedLength : number

The number of elements used to pack the object into an array.
The easternmost longitude in radians in the range [-Pi, Pi].
默认值: 0.0

readonly height : number

Gets the height of the rectangle in radians.
The northernmost latitude in radians in the range [-Pi/2, Pi/2].
默认值: 0.0
The southernmost latitude in radians in the range [-Pi/2, Pi/2].
默认值: 0.0
The westernmost longitude in radians in the range [-Pi, Pi].
默认值: 0.0

readonly width : number

Gets the width of the rectangle in radians.

方法

static Cesium.Rectangle.center(rectangle, result)Cartographic

Computes the center of a rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle for which to find the center
result Cartographic 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartographic instance if none was provided.

static Cesium.Rectangle.clone(rectangle, result)Rectangle

Duplicates a Rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle to clone.
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)

static Cesium.Rectangle.computeHeight(rectangle)number

Computes the height of a rectangle in radians.
参数名称 类型 描述信息
rectangle Rectangle The rectangle to compute the height of.
返回值:
The height.

static Cesium.Rectangle.computeWidth(rectangle)number

Computes the width of a rectangle in radians.
参数名称 类型 描述信息
rectangle Rectangle The rectangle to compute the width of.
返回值:
The width.

static Cesium.Rectangle.contains(rectangle, cartographic)boolean

Returns true if the cartographic is on or inside the rectangle, false otherwise.
参数名称 类型 描述信息
rectangle Rectangle The rectangle
cartographic Cartographic The cartographic to test.
返回值:
true if the provided cartographic is inside the rectangle, false otherwise.

static Cesium.Rectangle.equals(left, right)boolean

Compares the provided rectangles and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
left Rectangle 可选 The first Rectangle.
right Rectangle 可选 The second Rectangle.
返回值:
true if left and right are equal; otherwise false.

static Cesium.Rectangle.equalsEpsilon(left, right, absoluteEpsilon)boolean

Compares the provided Rectangles componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.
参数名称 类型 默认值 描述信息
left Rectangle 可选 The first Rectangle.
right Rectangle 可选 The second Rectangle.
absoluteEpsilon number 0 可选 The absolute epsilon tolerance to use for equality testing.
返回值:
true if left and right are within the provided epsilon, false otherwise.

static Cesium.Rectangle.expand(rectangle, cartographic, result)Rectangle

Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
参数名称 类型 描述信息
rectangle Rectangle A rectangle to expand.
cartographic Cartographic A cartographic to enclose in a rectangle.
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Rectangle instance if one was not provided.

static Cesium.Rectangle.fromBoundingSphere(boundingSphere, ellipsoid, result)Rectangle

Create a rectangle from a bounding sphere, ignoring height.
参数名称 类型 默认值 描述信息
boundingSphere BoundingSphere The bounding sphere.
ellipsoid Ellipsoid Ellipsoid.default 可选 The ellipsoid.
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

static Cesium.Rectangle.fromCartesianArray(cartesians, ellipsoid, result)Rectangle

Creates the smallest possible Rectangle that encloses all positions in the provided array.
参数名称 类型 默认值 描述信息
cartesians Array.<Cartesian3> The list of Cartesian instances.
ellipsoid Ellipsoid Ellipsoid.default 可选 The ellipsoid the cartesians are on.
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

static Cesium.Rectangle.fromCartographicArray(cartographics, result)Rectangle

Creates the smallest possible Rectangle that encloses all positions in the provided array.
参数名称 类型 描述信息
cartographics Array.<Cartographic> The list of Cartographic instances.
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

static Cesium.Rectangle.fromDegrees(west, south, east, north, result)Rectangle

Creates a rectangle given the boundary longitude and latitude in degrees.
参数名称 类型 默认值 描述信息
west number 0.0 可选 The westernmost longitude in degrees in the range [-180.0, 180.0].
south number 0.0 可选 The southernmost latitude in degrees in the range [-90.0, 90.0].
east number 0.0 可选 The easternmost longitude in degrees in the range [-180.0, 180.0].
north number 0.0 可选 The northernmost latitude in degrees in the range [-90.0, 90.0].
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.
使用示例:
const rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);

static Cesium.Rectangle.fromRadians(west, south, east, north, result)Rectangle

Creates a rectangle given the boundary longitude and latitude in radians.
参数名称 类型 默认值 描述信息
west number 0.0 可选 The westernmost longitude in radians in the range [-Math.PI, Math.PI].
south number 0.0 可选 The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
east number 0.0 可选 The easternmost longitude in radians in the range [-Math.PI, Math.PI].
north number 0.0 可选 The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].
result Rectangle 可选 The object onto which to store the result, or undefined if a new instance should be created.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.
使用示例:
const rectangle = Cesium.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);

static Cesium.Rectangle.intersection(rectangle, otherRectangle, result)Rectangle|undefined

Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are latitude and longitude in radians and produces a correct intersection, taking into account the fact that the same angle can be represented with multiple values as well as the wrapping of longitude at the anti-meridian. For a simple intersection that ignores these factors and can be used with projected coordinates, see Rectangle.simpleIntersection.
参数名称 类型 描述信息
rectangle Rectangle On rectangle to find an intersection
otherRectangle Rectangle Another rectangle to find an intersection
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.

static Cesium.Rectangle.northeast(rectangle, result)Cartographic

Computes the northeast corner of a rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle for which to find the corner
result Cartographic 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartographic instance if none was provided.

static Cesium.Rectangle.northwest(rectangle, result)Cartographic

Computes the northwest corner of a rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle for which to find the corner
result Cartographic 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartographic instance if none was provided.

static Cesium.Rectangle.pack(value, array, startingIndex)Array.<number>

Stores the provided instance into the provided array.
参数名称 类型 默认值 描述信息
value Rectangle The value to pack.
array Array.<number> The array to pack into.
startingIndex number 0 可选 The index into the array at which to start packing the elements.
返回值:
The array that was packed into

static Cesium.Rectangle.simpleIntersection(rectangle, otherRectangle, result)Rectangle|undefined

Computes a simple intersection of two rectangles. Unlike Rectangle.intersection, this function does not attempt to put the angular coordinates into a consistent range or to account for crossing the anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude and longitude (i.e. projected coordinates).
参数名称 类型 描述信息
rectangle Rectangle On rectangle to find an intersection
otherRectangle Rectangle Another rectangle to find an intersection
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.

static Cesium.Rectangle.southeast(rectangle, result)Cartographic

Computes the southeast corner of a rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle for which to find the corner
result Cartographic 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartographic instance if none was provided.

static Cesium.Rectangle.southwest(rectangle, result)Cartographic

Computes the southwest corner of a rectangle.
参数名称 类型 描述信息
rectangle Rectangle The rectangle for which to find the corner
result Cartographic 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Cartographic instance if none was provided.

static Cesium.Rectangle.subsample(rectangle, ellipsoid, surfaceHeight, result)Array.<Cartesian3>

Samples a rectangle so that it includes a list of Cartesian points suitable for passing to BoundingSphere#fromPoints. Sampling is necessary to account for rectangles that cover the poles or cross the equator.
参数名称 类型 默认值 描述信息
rectangle Rectangle The rectangle to subsample.
ellipsoid Ellipsoid Ellipsoid.default 可选 The ellipsoid to use.
surfaceHeight number 0.0 可选 The height of the rectangle above the ellipsoid.
result Array.<Cartesian3> 可选 The array of Cartesians onto which to store the result.
返回值:
The modified result parameter or a new Array of Cartesians instances if none was provided.

static Cesium.Rectangle.subsection(rectangle, westLerp, southLerp, eastLerp, northLerp, result)Rectangle

Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].
参数名称 类型 描述信息
rectangle Rectangle The rectangle to subsection.
westLerp number The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.
southLerp number The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.
eastLerp number The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.
northLerp number The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

static Cesium.Rectangle.union(rectangle, otherRectangle, result)Rectangle

Computes a rectangle that is the union of two rectangles.
参数名称 类型 描述信息
rectangle Rectangle A rectangle to enclose in rectangle.
otherRectangle Rectangle A rectangle to enclose in a rectangle.
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

static Cesium.Rectangle.unpack(array, startingIndex, result)Rectangle

Retrieves an instance from a packed array.
参数名称 类型 默认值 描述信息
array Array.<number> The packed array.
startingIndex number 0 可选 The starting index of the element to be unpacked.
result Rectangle 可选 The object into which to store the result.
返回值:
The modified result parameter or a new Rectangle instance if one was not provided.
Duplicates this Rectangle.
参数名称 类型 描述信息
result Rectangle 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Rectangle instance if none was provided.

equals(other)boolean

Compares the provided Rectangle with this Rectangle componentwise and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
other Rectangle 可选 The Rectangle to compare.
返回值:
true if the Rectangles are equal, false otherwise.

equalsEpsilon(other, epsilon)boolean

Compares the provided Rectangle with this Rectangle componentwise and returns true if they are within the provided epsilon, false otherwise.
参数名称 类型 默认值 描述信息
other Rectangle 可选 The Rectangle to compare.
epsilon number 0 可选 The epsilon to use for equality testing.
返回值:
true if the Rectangles are within the provided epsilon, false otherwise.