PointPrimitive

internal constructor new Cesium.PointPrimitive()

通过调用 PointPrimitiveCollection#add 创建一个点并设置其初始属性。 不要直接调用构造函数。
位于 3D 场景中创建的图形点 并使用 PointPrimitiveCollection 进行渲染。
Performance:

读取属性(例如 PointPrimitive#show)是常数时间。 分配给属性是恒定时间,但会导致 调用 PointPrimitiveCollection#update 时的 CPU 到 GPU 流量。 每个 pointPrimitive 的流量为 无论更新了多少个属性,都是相同的。 如果集合中的大多数 pointPrimitive 都需要 更新,使用 PointPrimitiveCollection#removeAll 清除集合可能更有效。 并添加新的 pointPrimitive 而不是修改每个 pointPrimitive。

Throws:
  • DeveloperError : scaleByDistance.far must be greater than scaleByDistance.near
  • DeveloperError : translucencyByDistance.far must be greater than translucencyByDistance.near
  • DeveloperError : distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
Demo:
See:

Members

获取或设置点的内部颜色。 红色、绿色、蓝色和 alpha 值由值的红色绿色bluealpha 属性,如示例 1 所示。 这些组件的范围从 0.0 (无强度)到 1.0(全强度)。
Examples:
// Example 1. Assign yellow.
p.color = Cesium.Color.YELLOW;
// Example 2. Make a pointPrimitive 50% translucent.
p.color = new Cesium.Color(1.0, 1.0, 1.0, 0.5);

disableDepthTestDistance : number

获取或设置与摄像机的距离,以禁用深度测试,以防止根据地形进行裁剪。 当设置为零时,始终应用深度测试。设置为 Number.POSITIVE_INFINITY 时,从不应用深度测试。
Default Value: 0.0
获取或设置条件 指定在距摄像机多远处显示此点。
Default Value: undefined
获取或设置选取点时返回的 User-defined 值。
获取或设置outline color of the point.
获取或设置轮廓宽度(以像素为单位)。 此宽度会增加 pixelSize, 增加点的总大小。
获取或设置inner size of the point in pixels.
获取或设置该点的笛卡尔位置。
根据点与摄像机的距离获取或设置点的近距和远距缩放属性。 点的比例将在 NearFarScalar#nearValueNearFarScalar#farValue 当摄像机距离落在下限和上限内时 指定的 NearFarScalar#nearNearFarScalar#far 的。 在这些范围之外,点的刻度仍然被限制在最近的边界上。 此刻度 将 pixelSize 和 outlineWidth 相乘以影响点的总大小。 如果未定义,则 scaleByDistance 将被禁用。
Examples:
// Example 1.
// Set a pointPrimitive's scaleByDistance to scale to 15 when the
// camera is 1500 meters from the pointPrimitive and disappear as
// the camera distance approaches 8.0e6 meters.
p.scaleByDistance = new Cesium.NearFarScalar(1.5e2, 15, 8.0e6, 0.0);
// Example 2.
// disable scaling by distance
p.scaleByDistance = undefined;
确定是否显示此点。 使用它来隐藏或显示点 将其删除并重新添加到集合中。
要应用于此点的 SplitDirection
Default Value: SplitDirection.NONE
根据点与摄像机的距离获取或设置点的近距和远距半透明属性。 点的半透明性将在 NearFarScalar#nearValueNearFarScalar#farValue 当摄像机距离落在下限和上限内时 指定的 NearFarScalar#nearNearFarScalar#far 的。 在这些范围之外,点的半透明性仍然被限制在最近的边界上。 如果未定义,则 translucencyByDistance 将被禁用。
Examples:
// Example 1.
// Set a point's translucency to 1.0 when the
// camera is 1500 meters from the point and disappear as
// the camera distance approaches 8.0e6 meters.
p.translucencyByDistance = new Cesium.NearFarScalar(1.5e2, 1.0, 8.0e6, 0.0);
// Example 2.
// disable translucency by distance
p.translucencyByDistance = undefined;

Methods

computeScreenSpacePosition(scene, result)Cartesian2

计算点原点的屏幕空间位置。 屏幕空间原点是画布的左上角;x 从 从左到右,y 从上到下增加。
Name Type Description
scene Scene scene
result Cartesian2 optional 要在其上存储结果的对象。
Returns:
点的屏幕空间位置。
Throws:
Example:
console.log(p.computeScreenSpacePosition(scene).toString());

equals(other)boolean

确定此点是否等于另一个点。 如果它们的所有属性都相等,则 Points 是相等的 相等。 不同集合中的点可以相等。
Name Type Description
other PointPrimitive optional 要比较相等的点。
Returns:
如果点相等,则 true;否则为 false
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.