Optionaloptions: { destroyPrimitives?: boolean; show?: boolean }The primitive to add.
Optionalindex: numberThe index to add the layer at. If omitted, the primitive will be added at the bottom of all existing primitives.
The primitive added to the collection.
Determines if this collection contains a primitive.
Optionalprimitive: anyThe primitive to check for.
true if the primitive is in the collection; false if the primitive is undefined or was not found in the collection.
Destroys 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.
Returns the primitive in the collection at the specified index.
The zero-based index of the primitive to return.
The primitive at the index.
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception.
True if this object was destroyed; otherwise, false.
Lowers a primitive "down one" in the collection. If all primitives in the collection are drawn on the globe surface, this visually moves the primitive down one.
Optionalprimitive: anyThe primitive to lower.
Lowers a primitive to the "bottom" of the collection. If all primitives in the collection are drawn on the globe surface, this visually moves the primitive to the bottom.
Optionalprimitive: anyThe primitive to lower to the bottom.
Raises a primitive "up one" in the collection. If all primitives in the collection are drawn on the globe surface, this visually moves the primitive up one.
Optionalprimitive: anyThe primitive to raise.
Raises a primitive to the "top" of the collection. If all primitives in the collection are drawn on the globe surface, this visually moves the primitive to the top.
Optionalprimitive: anyThe primitive to raise the top.
Removes a primitive from the collection.
Optionalprimitive: anyThe primitive to remove.
true if the primitive was removed; false if the primitive is undefined or was not found in the collection.
Removes all primitives in the collection.
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
ReadonlylengthGets the number of primitives in the collection.
ReadonlyprimitiveAn event that is raised when a primitive is added to the collection. Event handlers are passed the primitive that was added.
ReadonlyprimitiveAn 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.
OptionalVCM
Adds a primitive to the collection.