PrimitiveCollection

external class PrimitiveCollection(source)

A collection of primitives. This is most often used with Scene.primitives, but PrimitiveCollection is also a primitive itself so collections can be added to collections forming a hierarchy.

const billboards = new BillboardCollection();
const labels = new LabelCollection();

const collection = new PrimitiveCollection();
collection.add(billboards);

scene.primitives.add(collection); // Add collection
scene.primitives.add(labels); // Add regular primitive

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Determines if primitives in the collection are destroyed when they are removed by PrimitiveCollection.destroy or PrimitiveCollection.remove or implicitly by PrimitiveCollection.removeAll.

Link copied to clipboard
val length: Int

Gets the number of primitives in the collection.

Link copied to clipboard

An event that is raised when a primitive is added to the collection. Event handlers are passed the primitive that was added.

Link copied to clipboard

An event that is raised when a primitive is removed from the collection. Event handlers are passed the primitive that was removed.

Link copied to clipboard

Determines if primitives in this collection will be shown.

Functions

Link copied to clipboard
fun add(primitive: Any, index: Int? = definedExternally): Any

Adds a primitive to the collection.

Link copied to clipboard
fun contains(primitive: Any? = definedExternally): Boolean

Determines if this collection contains a primitive.

Link copied to clipboard
fun destroy()

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.

Link copied to clipboard
operator fun get(index: Int): Any

Returns the primitive in the collection at the specified index.

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.

Link copied to clipboard
fun lower(primitive: Any? = definedExternally)

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.

Link copied to clipboard
fun lowerToBottom(primitive: Any? = definedExternally)

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.

Link copied to clipboard
fun raise(primitive: Any? = definedExternally)

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.

Link copied to clipboard
fun raiseToTop(primitive: Any? = definedExternally)

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.

Link copied to clipboard
fun remove(primitive: Any? = definedExternally): Boolean

Removes a primitive from the collection.

Link copied to clipboard
fun removeAll()

Removes all primitives in the collection.