English中文

Queue

new Cesium.Queue()

一个队列,可以在末尾将项目入队,并从前面将项目出队。 A queue that can enqueue items at the end, and dequeue items from the front.

成员 Members

readonly length : number

队列的长度。 The length of the queue.

方法 Methods

从队列中删除所有项目。 Remove all items from the queue.
检查此队列是否包含指定的项目。 Check whether this queue contains the specified item.
名称 Name 类型 Type 说明 Description
item * 要搜索的项目。 The item to search for.
使项目出列。如果队列为空,则返回未定义。 Dequeues an item. Returns undefined if the queue is empty.
返回: Returns:
出队的项目。 The the dequeued item.
将指定的项目放入队列。 Enqueues the specified item.
名称 Name 类型 Type 说明 Description
item * 要排队的项目。 The item to enqueue.
返回队列前面的项目。如果队列为空,则返回未定义。 Returns the item at the front of the queue. Returns undefined if the queue is empty.
返回: Returns:
队列前面的项目。 The item at the front of the queue.

sort(compareFunction)

对队列中的项目进行就地排序。 Sort the items in the queue in-place.
名称 Name 类型 Type 说明 Description
compareFunction Queue.Comparator 定义排序顺序的函数。 A function that defines the sort order.

类型定义 Type Definitions

Cesium.Queue.Comparator(a, b)number

用于在对队列进行排序时比较两个项目的函数。 A function used to compare two items while sorting a queue.
名称 Name 类型 Type 说明 Description
a * 数组中的一个项目。 An item in the array.
b * 数组中的一个项目。 An item in the array.
返回: Returns:
如果返回负值 Returns a negative value if a 小于 is less than b,如果为正值 , a positive value if a 大于 is greater than b,或 0 如果 , or 0 if a 等于 is equal to b.
示例: 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.