new Cesium.PrimitiveCollection(options)

A collection of primitives. This is most often used with Scene#primitives, 不过,NTXQ0 原始的收集 NTXQ1 本身也是原始的,所以收藏可以 添加到构成等级的集合中.
Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
show boolean true optional Determines if the primitives in the collection will be shown.
destroyPrimitives boolean true optional Determines if primitives in the collection are destroyed when they are removed.
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 primitive

Members

destroyPrimitives : boolean

确定收藏中的原始物是否在被清除时被销毁 PrimitiveCollection#destroy or PrimitiveCollection#remove or implicitly by 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

readonly length : number

获得收藏中的原始人数量.

readonly primitiveAdded : Event

当一个原始物被添加到收藏中时会提起的事件. 事件处理器被传递 原始的被添加.

readonly primitiveRemoved : Event

当一个原始人被从收藏中移除时,一个被提起的事件. 事件处理器被传递 原始的被删除.

注意:根据破坏的原始建造者选项,原始可能已经销毁.

show : boolean

确定此收藏中的原始元素是否会被显示 .
Default Value: true

Methods

add(primitive, index)object

在收藏中添加原始内容.
Name Type Description
primitive object 原始的要加起来.
index number optional 添加层的索引 。 如果省略,原始语会被添加到所有现存原始语的底部.
Returns:
原始人加入藏书.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
const billboards = scene.primitives.add(new Cesium.BillboardCollection());

contains(primitive)boolean

确定此收藏是否包含原始的 .
Name Type Description
primitive object optional 原始的检查.
Returns:
NT###################################################################################### #######################################################################################################################################################################.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
See:

destroy()

Destroys the WebGL resources held by each primitive in this collection. Explicitly destroying this 收藏允许确定性地释放 NT 0 资源,而不是依赖垃圾 收藏家销毁此收藏.

摧毁了收藏品 摧毁了所有包含的原始人 只摧毁了收藏品 您确定没有其他代码仍在使用 任何包含的原始.

Once this collection 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.
Example:
primitives = primitives && primitives.destroy();
See:

get(index)object

在指定的索引中返回收藏中的原始内容.
Name Type Description
index number 原始人回归的零基指数.
Returns:
The primitive at the index.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
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:

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
如果此天体被销毁, 则属真; 否则, 属假 .
See:

lower(primitive)

将收藏中原始的"降一"降. 如果收藏中的所有原始物都被绘制出来 地球表面,这个视线 将原始的移动下来.
Name Type Description
primitive object optional 原始的变低.
Throws:
See:

lowerToBottom(primitive)

将原始物降到收藏品的"底部". 如果收藏中的所有原始物都被绘制出来 在全球表面,这个视觉将原始的移动到底部.
Name Type Description
primitive object optional 从原始到底部.
Throws:
See:

raise(primitive)

在藏品中提出原始的"上". 如果收藏中的所有原始物都被绘制出来 在全球表面,这个视线 移动原始的上.
Name Type Description
primitive object optional 原始人来抚养.
Throws:
See:

raiseToTop(primitive)

将原始的提升到收藏的"顶部". 如果收藏中的所有原始物都被绘制出来 在全球表面,这个视线将原始人移到顶端.
Name Type Description
primitive object optional 原始人升顶.
Throws:
See:

remove(primitive)boolean

从收藏中删除原始内容.
Name Type Description
primitive object optional 原始的要清除.
Returns:
true if the primitive was removed; false if the primitive is undefined or was not found in the collection.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
const billboards = scene.primitives.add(new Cesium.BillboardCollection());
scene.primitives.remove(billboards);  // Returns true
See:

removeAll()

删除收藏中的所有原始内容.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
See:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.