示例: Example:
const collection = new BufferPolylineCollection({
primitiveCountMax: 1024,
vertexCountMax: 4096,
});
const polyline = new BufferPolyline();
const material = new BufferPolylineMaterial({color: Color.WHITE});
// Create a new polyline, temporarily bound to 'polyline' local variable.
collection.add({
positions: new Float64Array([ ... ]),
material,
}, polyline);
// Iterate over all polylines in collection, temporarily binding 'polyline'
// local variable to each, and updating polyline material.
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, polyline);
polyline.setMaterial(material);
}
实验性 Experimental
此功能不是最终版本,可能会在没有 Cesium 标准弃用政策的情况下进行更改。 This feature is not final and is subject to change without Cesium's standard deprecation policy.
另见: See:
继承 Extends
方法 Methods
add(options, result) → BufferPolyline
使用指定的选项将新的折线添加到集合中。一个 Adds a new polyline to the collection, with the specified options. A
BufferPolyline 实例链接到新的折线,如果给定则使用“结果”参数,如果没有则使用新实例。对于重复调用,最好重用单个 BufferPolyline 实例,而不是在每次调用时分配一个新实例。 instance is linked to the new polyline, using the 'result' argument if given, or a new instance if not. For repeated calls, prefer to reuse a single BufferPolyline instance rather than allocating a new instance on each call.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
options |
BufferPolylineOptions | |
result |
BufferPolyline |
