BufferPolylineCollection
Cesium v1.147 · 中文

为优化性能和内存使用,多段线形物存储在 ArrayBuffer 中。

默认的缓冲区内存分配是任意的,集合无法调整大小, 因此应在集合中指定每个缓冲区的具体容量。 当可用时,提供构造函数。

new Cesium.BufferPolylineCollection(options)

Name Type Description
options object optional
Name Type Default Description
modelMatrix Matrix4 Matrix4.IDENTITY optional 将几何图形从模型坐标转换为世界坐标。
primitiveCountMax number BufferPrimitiveCollection.DEFAULT_CAPACITY optional
vertexCountMax number BufferPrimitiveCollection.DEFAULT_CAPACITY optional
show boolean true optional
positionDatatype ComponentDatatype ComponentDatatype.DOUBLE optional
positionNormalized boolean false optional
allowPicking boolean false optional 当 true 时,原语可通过 Scene#pick 选择。当 false 时,内存和初始化成本更低。
boundingVolume BoundingSphere optional 集合在世界空间中的边界体积。
debugShowBoundingVolume boolean false optional
blendOption BlendOption BlendOption.TRANSLUCENT optional 决定集合中的原语如何与场景混合。必须为 BlendOption.OPAQUE 或 BlendOption.TRANSLUCENT;不支持 BlendOption.OPAQUE_AND_TRANSLUCENT。
heightReference HeightReference HeightReference.NONE optional
widthUnits "pixels" | "meters" "pixels" optional 此集合中多段线宽的单位: 在屏幕上为 "pixels",在世界空间中为 "meters"。经过限制后 HeightReference 在椭球面上测量这些米数,因此海拔和地形 会拉伸绘制宽度。以米为单位的宽度有上限,以减少 瓦片接缝处的不连续性。
Example:
const collection = new BufferPolylineCollection({
primitiveCountMax: 1024,
vertexCountMax: 4096,
});

const polyline = new BufferPolyline();
const material = new BufferPolylineMaterial({color: Color.WHITE});

// 创建新的多段线,暂时绑定到 'polyline' 局部变量。
collection.add({
positions: new Float64Array([ ... ]),
material,
}, polyline);

// 遍历集合中的所有多段线,暂时将 'polyline' 绑定到每个元素,并更新多段线材质。
// 使用局部变量,并针对每个元素进行更新。
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, polyline);
polyline.setMaterial(material);
}
Experimental

This 此特性尚未最终确定,可能根据 Cesium 的标准弃用政策发生变化。

See:

Extends

Members

readonly widthUnits : "pixels"|"meters"

此集合中多段线宽的单位:在屏幕上为 "pixels",或 在世界空间中为 "meters",在限制后按椭球面测量。

Methods

根据指定选项向集合中添加新多段线。一个 BufferPolyline 实例与新的多段线关联,使用 'result' 参数(如果提供)或新实例(如果不提供)。对于重复操作 调用时,建议复用同一个 BufferPolyline 实例,而非每次调用都创建新实例。 这样能避免重复分配新实例。
Name Type Description
options BufferPolylineOptions
result BufferPolyline
Returns:

setPositions(positions, primitiveOffset, primitiveCount)

在指定的图元范围内更新顶点位置。对于 仅更新位置的多个图元,`setPositions()` 比单独更新每个图元更 高效。 参数 `positions` 必须包含与目标图元范围相同数量的顶点;该方法无法添加或移除顶点。 target primitive range; vertices cannot be added/removed by this method.
Name Type Description
positions TypedArray
primitiveOffset number
primitiveCount number
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.