usePrimitiveCollection
类似于 useEntityCollection,但是返回一个 PrimitiveCollection
。
使用
默认情况下,与上下文中的 viewer.scene.primitives
同步:
js
const primitives = usePrimitiveCollection()
// 组件销毁时自动卸载primitives
你也可以手动传入一个 PrimitiveCollection
作为同步的目标:
js
const collection = new Cesium.PrimitiveCollection()
usePrimitiveCollection(collection)
demo
类型声明
Details
ts
/**
* Create a PrimitiveCollection, which synchronizes with the `viewer.scene.primitives`.
* It will be cleared when the component is unmounted.
*
* @returns Will be cleared when the scope disposed
*/
export declare function usePrimitiveCollection(
source?: Cesium.PrimitiveCollection,
): Cesium.PrimitiveCollection