new CompositePrimitive
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
Members
-
centralBody :CentralBody
-
Gets or sets the depth-test ellipsoid.
-
destroyPrimitives :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
-
length :Number
-
Gets the length of the list of primitives
-
show :Boolean
-
Determines if primitives in this composite will be shown.
Methods
-
add
-
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);
-
destroy
-
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 thanisDestroyed
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();
-
get
-
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; }
- CompositePrimitive#getLength
See:
-
isDestroyed
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception.Returns:
Boolean True if this object was destroyed; otherwise, false. -
lower
-
DOC_TBA
Throws:
-
DeveloperError : primitive is not in this composite.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
- CompositePrimitive#lowerToBottom
- CompositePrimitive#raise
- CompositePrimitive#raiseToTop
- CompositePrimitive#addGround
See:
-
-
lowerToBottom
-
DOC_TBA
Throws:
-
DeveloperError : primitive is not in this composite.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
- CompositePrimitive#lower
- CompositePrimitive#raise
- CompositePrimitive#raiseToTop
- CompositePrimitive#addGround
See:
-
-
raise
-
DOC_TBA
Throws:
-
DeveloperError : primitive is not in this composite.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
- CompositePrimitive#raiseToTop
- CompositePrimitive#lower
- CompositePrimitive#lowerToBottom
- CompositePrimitive#addGround
See:
-
-
raiseToTop
-
DOC_TBA
Throws:
-
DeveloperError : primitive is not in this composite.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
- CompositePrimitive#raise
- CompositePrimitive#lower
- CompositePrimitive#lowerToBottom
- CompositePrimitive#addGround
See:
-
-
remove
-
DOC_TBA
Parameters:
Name Type Description primitive
Object DOC_TBA Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.Returns:
Booleantrue
if the primitive was removed;false
if the primitive was not found in the composite.Example
primitives.add(p); primitives.remove(p); // Returns true
-
removeAll
-
DOC_TBA
Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.Example
primitives.add(...); primitives.add(...); primitives.removeAll();