CompositePrimitive

CompositePrimitive

new

DOC_TBA

Example
// Example 1. Add primitives to a composite.
var primitives = new Cesium.CompositePrimitive();
primitives.centralBody = new Cesium.CentralBody();
primitives.add(billboards);
primitives.add(labels);

//////////////////////////////////////////////////////////////////

// Example 2. Create composites of composites.
var children = new Cesium.CompositePrimitive();
children.add(billboards);

var parent = new Cesium.CompositePrimitive();
parent.add(children);    // Add composite
parent.add(labels);      // Add regular primitive
Source:

Members

:CentralBody

Gets or sets the depth-test ellipsoid.

:DeveloperError

DOC_TBA
Example
// Example 1. Primitives are destroyed by default.
var primitives = new Cesium.CompositePrimitive();
primitives.add(labels);
primitives = primitives.destroy();
var b = labels.isDestroyed(); // true

//////////////////////////////////////////////////////////////////

// Example 2. Do not destroy primitives in a composite.
var primitives = new Cesium.CompositePrimitive();
primitives.destroyPrimitives = false;
primitives.add(labels);
primitives = primitives.destroy();
var b = labels.isDestroyed(); // false
labels = labels.destroy();    // explicitly destroy
See:

:Number

Gets the length of the list of primitives

:Boolean

Determines if primitives in this composite will be shown.

Methods

Adds a primitive to a composite primitive. When a composite is rendered so are all of the primitives in the composite.

Parameters:
Name Type Description
primitive Object The primitive to add to the composite.
Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Returns:
Object The primitive added to the composite.
Example
primitives.add(billboards);
primitives.add(labels);
See:

Destroys the WebGL resources held by each primitive in this composite. Explicitly destroying this composite allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this composite.

Since destroying a composite destroys all the contained primitives, only destroy a composite when you are sure no other code is still using any of the contained primitives.

Once this composite 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.

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Returns:
Example
primitives = primitives && primitives.destroy();
See:

DOC_TBA The index is based on the order the primitives were added to the composite.

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example
// Toggle the show property of every primitive in the composite -
// not recursive on child composites.
var len = primitives.length;
for (var i = 0; i < len; ++i) {
  var p = primitives.get(i);
  p.show = !p.show;
}
See:
  • CompositePrimitive#getLength

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.

Returns:
Boolean True if this object was destroyed; otherwise, false.
See:

DOC_TBA

Throws:
See:

DOC_TBA

Throws:
See:

DOC_TBA

Throws:
See:

DOC_TBA

Throws:
See:

DOC_TBA

Parameters:
Name Type Description
primitive Object DOC_TBA
Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Returns:
Boolean true if the primitive was removed; false if the primitive was not found in the composite.
Example
primitives.add(p);
primitives.remove(p);  // Returns true
See:

DOC_TBA

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example
primitives.add(...);
primitives.add(...);
primitives.removeAll();
See: