原语的集合。这最常与
       
        
      
         Scene#primitives
        
       
       一起使用,但
       
        PrimitiveCollection
       
       本身也是一个基元,因此可以将集合添加到形成层次结构的集合中。
      | Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
           options
           | Object | 具有以下属性的
          
           可选
          
          对象: 
 | 
Example:
const billboards = new Cesium.BillboardCollection();
const labels = new Cesium.LabelCollection();
const collection = new Cesium.PrimitiveCollection();
collection.add(billboards);
scene.primitives.add(collection);  // Add collection
scene.primitives.add(labels);      // Add regular primitiveMembers
      确定集合中的基元是否在被
      
       
     
        PrimitiveCollection#destroy
       
      
      或
      
       
        PrimitiveCollection#remove
       
      
      或由
      
       
        PrimitiveCollection#removeAll
       
      
      隐式删除时被销毁。
     - 
      
       Default Value:
      
      
       true
      
      Examples:
// Example 1. Primitives are destroyed by default.
const primitives = new Cesium.PrimitiveCollection();
const labels = primitives.add(new Cesium.LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // true// Example 2. Do not destroy primitives in a collection.
const primitives = new Cesium.PrimitiveCollection();
primitives.destroyPrimitives = false;
const labels = primitives.add(new Cesium.LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // false
labels = labels.destroy();    // explicitly destroy
      获取集合中的基元数。
     
     
      确定是否将显示此集合中的基元。
     
     - 
      
       Default Value:
      
      
       true
      
     Methods
      将原语添加到集合中。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 要添加的原语。 | 
| 
          index
          | Number | 可选 要添加图层的索引。如果省略,原语将被添加到所有现有原语的底部。 | 
Returns:
   添加到集合中的原语。
  
 
     Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
Example:
const billboards = scene.primitives.add(new Cesium.BillboardCollection());
      确定此集合是否包含原语。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 要检查的原语。 | 
Returns:
   如果原语在集合中,则为
   
 
     
    true
   
   ;如果原语
   
    undefined
   
   或未在集合中找到,则返回
   
    false
   
   。
  Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
      销毁此集合中每个原语持有的 WebGL 资源。显式销毁此集合允许确定性地释放 WebGL 资源,而不是依赖垃圾收集器来销毁此集合。
      
      
由于销毁集合会销毁所有包含的基元,因此只有在您确定没有其他代码仍在使用任何包含的基元时才销毁集合。
      
一旦这个集合被销毁,它就不应该被使用;调用
     由于销毁集合会销毁所有包含的基元,因此只有在您确定没有其他代码仍在使用任何包含的基元时才销毁集合。
一旦这个集合被销毁,它就不应该被使用;调用
       isDestroyed
      
      以外的任何函数都将导致
      
       
        DeveloperError
       
      
      异常。因此,如示例中所做的那样,将返回值 (
      
       undefined
      
      ) 分配给对象。
     Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
Example:
primitives = primitives && primitives.destroy();See:
      返回集合中指定索引处的基元。
     
     | Name | Type | Description | 
|---|---|---|
| 
          index
          | Number | 要返回的基元的从零开始的索引。 | 
Returns:
    index
   
   处的原语。
  Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
Example:
// Toggle the show property of every primitive in the collection.
const primitives = scene.primitives;
const length = primitives.length;
for (let i = 0; i < length; ++i) {
  const p = primitives.get(i);
  p.show = !p.show;
}See:
Returns:
   如果此对象被销毁,则为真;否则为假。
  
 
     
     
     
      降低集合中的原始'降低'。如果集合中的所有图元都绘制在地球表面上,这会在视觉上将图元向下移动一个。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 要降低的原语。 | 
Throws:
- 
 
  DeveloperError :原语不在此集合中。
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
      将原语降低到集合的'底部'。如果集合中的所有图元都绘制在地球表面上,这会在视觉上将图元移动到底部。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 要降低到底部的原语。 | 
Throws:
- 
 
  DeveloperError :原语不在此集合中。
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
      在集合中引发一个原始的'up one'。如果集合中的所有图元都绘制在地球表面上,这会在视觉上将图元向上移动一个。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 要引发的原语。 | 
Throws:
- 
 
  DeveloperError :原语不在此集合中。
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
      将原语提升到集合的'顶部'。如果集合中的所有图元都绘制在地球表面上,这会在视觉上将图元移动到顶部。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 抬高顶部的原语。 | 
Throws:
- 
 
  DeveloperError :原语不在此集合中。
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
      从集合中移除一个原语。
     
     | Name | Type | Description | 
|---|---|---|
| 
          primitive
          | Object | 可选 要删除的原语。 | 
Returns:
   如果原语被移除,则为
   
 
     
    true
   
   ;如果原语
   
    undefined
   
   或未在集合中找到,则返回
   
    false
   
   。
  Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
Example:
const billboards = scene.primitives.add(new Cesium.BillboardCollection());
scene.primitives.remove(billboards);  // Returns trueSee:
      删除集合中的所有基元。
     
     Throws:
- 
 
  DeveloperError : 该对象被销毁,即调用了destroy()。
