为性能和内存优化在ArrayBuffer存储中保存的原始物的集合. 为了获得使用含有"N"原始词的缓冲吸收的完全性能好处, 注意避免分配任何相关的 JavaScript 对象的“ N” 实例 。 –BufferPrimitive , Color, Cartesian3, and other objects can all be reused when working with large collections, using the flyweight pattern.

abstract new Cesium.BufferPrimitiveCollection(options)

Name Type Description
options object
Name Type Default Description
primitiveCountMax number BufferPrimitiveCollection.DEFAULT_CAPACITY optional
vertexCountMax number BufferPrimitiveCollection.DEFAULT_CAPACITY optional
show boolean true optional
debugShowBoundingVolume boolean false optional
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

See:

Members

boundingVolume : BoundingSphere

收集中所有原始物的边界体积,包括两者 显示和隐藏原始人.

readonly byteLength : number

此收藏所拥有的缓冲总字节长度 。 包括未使用 space allocated by primitiveCountMax, even if no primitives have 却被添加在这个空间.

debugShowBoundingVolume : boolean

此属性仅用于调试;不用于生产,也不优化.

绘制原始中每个绘图命令的边框.

Default Value: false

readonly DEFAULT_CAPACITY : number

新收藏的缓冲器默认容量 。 数量 : 顶点缓冲中的顶点数,原始的顶点数 缓冲等. 这个价值是任意的,收藏不能调整大小, 因此,收集中应提供具体的每缓冲能力 可用时的构造器 .

readonly primitiveCount : number

Number of primitives in collection. Must be <= primitiveCountMax.

readonly primitiveCountMax : number

此收藏可包含的最大原始数量 。 一定是 \ \ primitiveCount.
Default Value: BufferPrimitiveCollection.DEFAULT_CAPACITY

show : boolean

确定此收藏中的原始元素是否会被显示 .
Default Value: true

readonly vertexCount : number

Number of vertices in collection. Must be <= vertexCountMax.

readonly vertexCountMax : number

此收藏可包含的最大顶点数 。 一定是 \ \ vertexCount.
Default Value: BufferPrimitiveCollection.DEFAULT_CAPACITY

Methods

static Cesium.BufferPrimitiveCollection.clone(collection, result)

将本集的内容复制到结果集中. 结果收藏没有调整大小,必须包含足够的空间供所有人使用 源集中的原始语. 结果中的现有原始物 收藏将被覆盖. NT 0 当为收藏分配更多空间时有用 capacity, and efficiently transferring features to the new collection.

Name Type Description
collection BufferPrimitiveCollection.<T>
result BufferPrimitiveCollection.<T>
Example:
const result = new BufferPrimitiveCollection({ ... }); // allocate larger 'result' collection
BufferPrimitiveCollection.clone(collection, result);   // copy primitives from 'collection' into 'result'

add(options, result)BufferPrimitive

在收藏中添加新的原始内容,并附带指定的选项。 页:1 BufferPrimitive instance is linked to the new primitive, using 如果给出了“ 结果” 参数, 或者没有给出新实例 。 对重复 调用,宁可重复使用单个缓冲实例,而不是 每次通话都分配一个新实例.
Name Type Description
options BufferPrimitiveOptions
result BufferPrimitive
Returns:

get(index, result)BufferPrimitive

Makes the given BufferPrimitive a view onto this collection's 原始索引,用于读/写原始索引 属性。 当在大型收藏品上漫游时,宁可重复使用 整个循环的相同缓冲实例——重新绑定 现有的实例到不同的原始 便宜,并避免 为每个对象分配内在对象.
Name Type Description
index number
result BufferPrimitive
Returns:
The BufferPrimitive instance passed as the 'result' argument, now bound to the specified primitive index.
Example:
const primitive = new BufferPrimitive();
for (let i = 0; i < collection.primitiveCount; i++) {
  collection.get(i, primitive);
  primitive.setColor(Color.RED);
}

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .
Returns:
如果此天体被销毁, 则属真; 否则, 属假 .

sort(sortFn, result)Uint32Array

排序收藏的原始内容. 因为排序会改变原始人的指数(但不是特征ID) 在收藏中,该函数还返回来自先前的数组映射 索引为新索引。 当反复排序时,该阵列可重复使用 每次通话都通过“结果”论证.
Name Type Description
sortFn function
result Uint32Array
Returns:
从先前的索引映射到新的索引.

toJSON()Array.<Object>

返回代表收藏的 NT 0 -序列大小的数组。 此编码 没有内存效率,一般应用于调试和 testing.
Returns:
List of JSON-serializable objects, one for each primitive in the collection.
Example:
console.table(collection.toJSON());

update(frameState)

Name Type Description
frameState object
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.