Optional
options: { Optional
destroyOptional
show?: booleanDestroys the WebGL resources held by each primitive in this collection. Explicitly destroying this
collection allows for deterministic release of WebGL resources, instead of relying on the garbage
collector to destroy this collection.
Since destroying a collection destroys all the contained primitives, only destroy a collection
when you are sure no other code is still using any of the contained primitives.
Once this collection is destroyed, it should not be used; calling any function other than
isDestroyed
will result in a DeveloperError exception. Therefore,
assign the return value (undefined
) to the object as done in the example.
Optional
[vcsDetermines if primitives in the collection are destroyed when they are removed by PrimitiveCollection#destroy or PrimitiveCollection#remove or implicitly by PrimitiveCollection#removeAll.
// Example 1. Primitives are destroyed by default.
const primitives = new Cesium.PrimitiveCollection();
const labels = primitives.add(new Cesium.LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // true
// Example 2. Do not destroy primitives in a collection.
const primitives = new Cesium.PrimitiveCollection();
primitives.destroyPrimitives = false;
const labels = primitives.add(new Cesium.LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // false
labels = labels.destroy(); // explicitly destroy
Readonly
lengthGets the number of primitives in the collection.
Readonly
primitiveAn event that is raised when a primitive is added to the collection. Event handlers are passed the primitive that was added.
Readonly
primitiveAn event that is raised when a primitive is removed from the collection. Event handlers are passed the primitive that was removed.
Note: Depending on the destroyPrimitives constructor option, the primitive may already be destroyed.
Determines if primitives in this collection will be shown.
Optional
VCMLayer
Adds a primitive to the collection.