new CompositePrimitive
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
Members
-
destroyPrimitives :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
-
show :Boolean
-
Determines if primitives in this composite will be shown.
Methods
-
add
-
DOC_TBA
Parameters:
Name Type Description primitive
Object DOC_TBA Throws:
-
DeveloperError : primitive is required.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
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 : index is required.
-
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; }
-
-
getCentralBody
-
DOC_TBA
Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called. -
getLength
-
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; }
-
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();
-
setCentralBody
-
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());
- CompositePrimitive#depthTestEllipsoid
- CompositePrimitive#getCentralBody
See: