Points are added and removed from the collection using
PointPrimitiveCollection#add
和 PointPrimitiveCollection#remove .
Performance:
For best performance, prefer a few collections, each with many points, to 许多藏品,各只有几分. 组织收藏,以便点数 同一更新频率的集合中, i.e ., 点数不相同 更改应在一个集合中进行;更改的点数应在另一个框架中进行 收藏; 等.
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
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
-
Default Value:
-NT=0=- 翻译:
绘制原始中每个绘图命令的边框.
-
Default Value:
false
PointPrimitiveCollection#get to iterate over all the points
在收藏中.
modelMatrix : Matrix4
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:
-
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:
| Name | Type | Description |
|---|---|---|
pointPrimitive |
PointPrimitive | optional 检查点. |
Returns:
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:
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.
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:
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
const p = pointPrimitives.add(...);
pointPrimitives.remove(p); // Returns true
See:
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();