CompositePrimitive

CompositePrimitive

new

DOC_TBA

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

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

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

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

Members

:DeveloperError

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

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

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

:Boolean

Determines if primitives in this composite will be shown.

Methods

DOC_TBA

Parameters:
Name Type Description
primitive Object DOC_TBA
Throws:
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:
Example
// Toggle the show property of every primitive in the composite -
// not recursive on child composites.
var len = primitives.getLength();
for (var i = 0; i < len; ++i) {
  var p = primitives.get(i);
  p.show = !p.show;
}
See:

DOC_TBA

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
See:

DOC_TBA

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.getLength();
for (var i = 0; i < len; ++i) {
  var p = primitives.get(i);
  p.show = !p.show;
}
See:

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:

DOC_TBA Implicitly sets the depth-test ellipsoid.

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example
var primitives = new CompositePrimitive();
primitives.setCentralBody(new CentralBody());
See: