new Cesium.PointPrimitiveCollection(options)

集成的积分.

Points are added and removed from the collection using PointPrimitiveCollection#addPointPrimitiveCollection#remove .
Performance:

For best performance, prefer a few collections, each with many points, to 许多藏品,各只有几分. 组织收藏,以便点数 同一更新频率的集合中, i.e ., 点数不相同 更改应在一个集合中进行;更改的点数应在另一个框架中进行 收藏; 等.

Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
modelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix that transforms each point from model to world coordinates.
debugShowBoundingVolume boolean false optional For debugging only. Determines if this primitive's commands' bounding spheres are shown.
blendOption BlendOption BlendOption.OPAQUE_AND_TRANSLUCENT optional The point blending option. The default 用于渲染不透明点和半透明点。 但是,如果任何一点都是完全不透明的或全部是完全半透明的, 将技术设置为 BlendOption.OPAQUE 或 BlendOption.TRANSLUCENT ,可以提高性能最多2×.
show boolean true optional Determines if the primitives in the collection will be shown.
Example:
// Create a pointPrimitive collection with two points
const points = scene.primitives.add(new Cesium.PointPrimitiveCollection());
points.add({
  position : new Cesium.Cartesian3(1.0, 2.0, 3.0),
  color : Cesium.Color.YELLOW
});
points.add({
  position : new Cesium.Cartesian3(4.0, 5.0, 6.0),
  color : Cesium.Color.CYAN
});
See:

Members

blendOption : BlendOption

点混合选项。 默认用于渲染不透明点和半透明点. 但是,如果任何一点都是完全不透明的或全部是完全半透明的, 将技术设置为 NT 0 或 NT 1 可以改进 最多2x的表演.
Default Value: -NT=0=- 翻译:

debugShowBoundingVolume : boolean

此属性仅用于调试;不用于生产,也不优化.

绘制原始中每个绘图命令的边框.

Default Value: false

length : number

返回此收藏中的点数。 这通常用于 PointPrimitiveCollection#get to iterate over all the points 在收藏中.

modelMatrix : Matrix4

4x4变换矩阵将本集中的每个点从模型转换为世界坐标. 当这是身份矩阵时,点引点被绘制在世界坐标, i.e . 地球的 WGS84 坐标. 本地参考框架可以通过提供不同的变换矩阵来使用, 如返回的变换矩阵 by Transforms.eastNorthUpToFixedFrame.
Default Value: Matrix4.IDENTITY
Example:
const center = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);
pointPrimitives.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
pointPrimitives.add({
  color : Cesium.Color.ORANGE,
  position : new Cesium.Cartesian3(0.0, 0.0, 0.0) // center
});
pointPrimitives.add({
  color : Cesium.Color.YELLOW,
  position : new Cesium.Cartesian3(1000000.0, 0.0, 0.0) // east
});
pointPrimitives.add({
  color : Cesium.Color.GREEN,
  position : new Cesium.Cartesian3(0.0, 1000000.0, 0.0) // north
});
pointPrimitives.add({
  color : Cesium.Color.CYAN,
  position : new Cesium.Cartesian3(0.0, 0.0, 1000000.0) // up
});
See:

show : boolean

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

Methods

add(options)PointPrimitive

在收藏中创建并添加一个带有指定初始属性的点. 添加的点被返回,以便日后可以修改或从收藏中移除.
Performance:

Calling add is expected constant time. However, the collection's vertex buffer is rewritten - an O(n) operation that also incurs CPU to GPU overhead. For 最佳表现,在拨打 NT 0 update NT +1 前,请加入尽可能多的点首.

Name Type Description
options object optional A template describing the point's properties as shown in Example 1.
Returns:
集中所加之分.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Examples:
// Example 1:  Add a point, specifying all the default values.
const p = pointPrimitives.add({
  show : true,
  position : Cesium.Cartesian3.ZERO,
  pixelSize : 10.0,
  color : Cesium.Color.WHITE,
  outlineColor : Cesium.Color.TRANSPARENT,
  outlineWidth : 0.0,
  id : undefined
});
// Example 2:  Specify only the point's cartographic position.
const p = pointPrimitives.add({
  position : Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
});
See:

contains(pointPrimitive)boolean

检查此收藏是否包含给定点 .
Name Type Description
pointPrimitive PointPrimitive optional 检查点.
Returns:
如果本集包含点, 则真实性为真, 否则为假 .
See:

destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic 释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.

Once an object 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:
pointPrimitives = pointPrimitives && pointPrimitives.destroy();
See:

get(index)PointPrimitive

在指定的索引中返回收藏中的点。 指数为零 并增加点数。 删除点移所有点后 在左边,改变他们的指数。 此函数通常用于 PointPrimitiveCollection#length to iterate over all the points 在收藏中.
Performance:

Expected constant time. If points were removed from the collection and PointPrimitiveCollection#update was not called, an implicit O(n) 操作完成.

Name Type Description
index number 该点的零基指数.
Returns:
指定索引的点 .
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
// Toggle the show property of every point in the collection
const len = pointPrimitives.length;
for (let i = 0; i < len; ++i) {
  const p = pointPrimitives.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:
true if this object was destroyed; otherwise, false.
See:

remove(pointPrimitive)boolean

从收藏中删除点.
Performance:

Calling remove is expected constant time. However, the collection's vertex buffer is rewritten - an O(n) operation that also incurs CPU to GPU overhead. For 最佳性能,在拨打 NT 0 update NT 1 前,尽量去除积分. 如果你打算暂时隐藏一个点,通常更高效的调用 PointPrimitive#show 而不是去除和重新添加点.

Name Type Description
pointPrimitive PointPrimitive 取之点.
Returns:
如果点被删除,则使用 NT##0 real NT 1 ;如果在收藏中找不到点,则使用 NT 2 false NT 3 .
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
const p = pointPrimitives.add(...);
pointPrimitives.remove(p);  // Returns true
See:

removeAll()

删除收藏中的所有点.
Performance:

O(n). It is more efficient to remove all the points 从收藏开始,然后添加新收藏,而不是完全创建新收藏.

Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
pointPrimitives.add(...);
pointPrimitives.add(...);
pointPrimitives.removeAll();
See:
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.