Queue

new Cesium.Queue()

一个可以在末尾入队、从前端出队的队列。

Members

readonly length : number

队列的长度。

Methods

从队列中移除所有项。
检查此队列是否包含指定项。
Name Type Description
item * 要搜索的项。
出队一项。如果队列为空则返回undefined。
Returns:
出队的项。
将指定项入队。
Name Type Description
item * 要入队的项。
返回队列前端的项。如果队列为空则返回undefined。
Returns:
队列前端的项。

sort(compareFunction)

对队列中的项进行原地排序。
Name Type Description
compareFunction Queue.Comparator 定义排序顺序的函数。

Type Definitions

Cesium.Queue.Comparator(a, b)number

排序队列时用于比较两个项的函数。
Name Type Description
a * 数组中的一项。
b * 数组中的一项。
Returns:
如果a小于b则返回负值, 如果a大于b则返回正值,或 如果a等于b则返回0。
Example:
function compareNumbers(a, b) {
    return a - b;
}
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.