PointPrimitiveCollection

new Cesium.PointPrimitiveCollection(options)



可渲染的点集合。 使用PointPrimitiveCollection#add从集合中添加和删除点 和PointPrimitiveCollection#remove
Performance:

为了获得最佳性能,最好选择几个集合,每个集合都有多个点 许多藏品每件只有几点。组织集合以便 具有相同更新频率的点位于同一集合中,即 更改应该在一个集合中;每个帧更改的点应该在另一个集合中 收集;等等。

Name Type Description
options Object optional 具有以下属性的对象:
Name Type Default Description
modelMatrix Matrix4 Matrix4.IDENTITY optional 将每个点从模型转换为世界坐标的4x4变换矩阵。
debugShowBoundingVolume Boolean false optional 仅用于调试。确定是否显示了该图元的命令的边界球体。
blendOption BlendOption BlendOption.OPAQUE_AND_TRANSLUCENT optional 点混合选项。违约 用于渲染不透明点和半透明点。但是,如果所有点都是完全不透明的,或者所有点都是完全半透明的, 将技术设置为混合。不透明或者混合半透明可将性能提高2倍。
Example:
// Create a pointPrimitive collection with two points
var 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

点混合选项。默认值用于渲染不透明点和半透明点。 但是,如果所有点都是完全不透明的,或者所有点都是完全半透明的, 将技术设置为混合。不透明或者混合半透明可以改进 性能提高2倍。
Default Value: BlendOption.OPAQUE_AND_TRANSLUCENT

debugShowBoundingVolume : Boolean

此属性仅用于调试;它不用于生产用途,也不进行优化。

Draws the bounding sphere for each draw command in the primitive.

Default Value: false
返回此集合中的点数。通常用于 PointPrimitiveCollection#get遍历所有点 收藏中。
将此集合中的每个点从模型转换为世界坐标的4x4变换矩阵。 当这是单位矩阵时,点基元在世界坐标系中绘制,即地球的WGS84坐标系。 局部参考帧可以通过提供不同的转换矩阵来使用,就像返回的那样 通过Transforms.eastNorthUpToFixedFrame
Default Value: Matrix4.IDENTITY
Example:
var 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:

Methods

创建具有指定初始特性的点并将其添加到集合中。 将返回添加的点,以便以后可以在集合中修改或删除它。
Performance:

调用add应为常量时间。但是,集合的顶点缓冲区 重写-O(n)操作也会导致CPU到GPU的开销。为 最佳性能,请在调用update之前添加尽可能多的PointPrimitive。

Name Type Description
options Object optional 描述点属性的模板,如示例1所示。
Returns:
这一点被添加到集合中。
Throws:
Examples:
// Example 1:  Add a point, specifying all the default values.
var 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.
var p = pointPrimitives.add({
  position : Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
});
See:

contains(pointPrimitive)Boolean

检查此集合是否包含给定点。
Name Type Description
pointPrimitive PointPrimitive optional 要检查的点。
Returns:
如果此集合包含点,则为true,否则为false。
See:


销毁此对象持有的WebGL资源。销毁一个对象允许确定性 释放WebGL资源,而不是依赖垃圾回收器销毁此对象。 一旦一个对象被销毁,就不应该使用它;调用除 isDestroyed将导致DeveloperError异常。因此, 如示例所示,将返回值(undefined)分配给对象。
Throws:
Example:
pointPrimitives = pointPrimitives && pointPrimitives.destroy();
See:
返回集合中指定索引处的点。指数以零为基础 随着点数的增加而增加。删除一个点会在之后移动所有点 它在左边,改变他们的指数。此函数常用于 PointPrimitiveCollection#length遍历所有点 收藏中。
Performance:

预期恒定时间。如果点从集合中移除,并且 不是6861166,是6866166 执行操作。

Name Type Description
index Number 点的从零开始的索引。
Returns:
指定索引处的点。
Throws:
Example:
// Toggle the show property of every point in the collection
var len = pointPrimitives.length;
for (var i = 0; i < len; ++i) {
  var p = pointPrimitives.get(i);
  p.show = !p.show;
}
See:

isDestroyed()Boolean



如果此对象已销毁,则返回true;否则返回false。 如果此对象已被销毁,则不应使用它;调用除 isDestroyed将导致DeveloperError异常。
Returns:
如果此对象被销毁,则为true;否则为false
See:

remove(pointPrimitive)Boolean

从集合中删除点。
Performance:

调用remove应为常量时间。但是,集合的顶点缓冲区 重写-O(n)操作也会导致CPU到GPU的开销。为 最佳性能,请在拨打update之前删除尽可能多的点。 如果你想暂时隐藏一个点,通常打电话更有效 PointPrimitive#show,而不是删除并重新添加点。

Name Type Description
pointPrimitive PointPrimitive 要删除的点。
Returns:
true(如果该点已删除);false(如果在集合中未找到该点)。
Throws:
Example:
var p = pointPrimitives.add(...);
pointPrimitives.remove(p);  // Returns true
See:
从集合中删除所有点。
Performance:

O(n)删除所有点更有效 从一个集合中添加新的集合,而不是完全创建一个新集合。

Throws:
Example:
pointPrimitives.add(...);
pointPrimitives.add(...);
pointPrimitives.removeAll();
See: