English中文

PointPrimitive

internal constructor new Cesium.PointPrimitive()

创建一个点并通过调用设置其初始属性 A point is created and its initial properties are set by calling PointPrimitiveCollection#add。不要直接调用构造函数。 . Do not call the constructor directly.
位于 3D 场景中的图形点,使用 A graphical point positioned in the 3D scene, that is created and rendered using a PointPrimitiveCollection.
性能: Performance:

读取属性,例如 Reading a property, e.g., PointPrimitive#show,是常数时间。分配给属性的时间是恒定的,但会导致 CPU 到 GPU 的流量 , is constant time. Assigning to a property is constant time but results in CPU to GPU traffic when PointPrimitiveCollection#update 被称为。无论更新了多少属性,每点原始流量都是相同的。如果集合中的大多数 pointPrimitives 需要更新,则使用以下命令清除集合可能会更有效 is called. The per-pointPrimitive traffic is the same regardless of how many properties were updated. If most pointPrimitives in a collection need to be updated, it may be more efficient to clear the collection with PointPrimitiveCollection#removeAll 并添加新的 pointPrimitives 而不是修改每一个。 and add new pointPrimitives instead of modifying each one.

抛出: Throws:
  • DeveloperError :scaleByDistance.far 必须大于scaleByDistance.near : scaleByDistance.far must be greater than scaleByDistance.near
  • DeveloperError :translucencyByDistance.far 必须大于 translucencyByDistance.near : translucencyByDistance.far must be greater than translucencyByDistance.near
  • DeveloperError :distanceDisplayCondition.far 必须大于 distanceDisplayCondition.near : distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
演示: Demo:
另见: See:

成员 Members

获取或设置点的内部颜色。红色、绿色、蓝色和 alpha 值由下式表示 Gets or sets the inner color of the point. The red, green, blue, and alpha values are indicated by value's red, green, blue, 和 , and alpha 特性如示例 1 所示。这些组件的范围为 properties as shown in Example 1. These components range from 0.0 (无强度)至 (no intensity) to 1.0 (全强度)。 (full intensity).
示例: 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 时,永远不会应用深度测试。 Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.
默认值: Default Value: 0.0
获取或设置指定在距相机的距离处显示该点的条件。 Gets or sets the condition specifying at what distance from the camera that this point will be displayed.
默认值: Default Value: undefined
获取或设置选取点时返回的用户定义值。 Gets or sets the user-defined value returned when the point is picked.
获取或设置点的轮廓颜色。 Gets or sets the outline color of the point.
获取或设置轮廓宽度(以像素为单位)。此宽度会增加像素大小,从而增加点的总大小。 Gets or sets the outline width in pixels. This width adds to pixelSize, increasing the total size of the point.
获取或设置点的内部大小(以像素为单位)。 Gets or sets the inner size of the point in pixels.
获取或设置该点的笛卡尔位置。 Gets or sets the Cartesian position of this point.
根据点距相机的距离获取或设置该点的近距和远距缩放属性。点的比例将在 Gets or sets near and far scaling properties of a point based on the point's distance from the camera. A point's scale will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue 当相机距离落在指定的下限和上限内时 while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far。在这些范围之外,点的比例仍然限制在最近的范围内。该比例将像素大小和轮廓宽度相乘,以影响点的总大小。如果未定义,scaleByDistance 将被禁用。 . Outside of these ranges the point's scale remains clamped to the nearest bound. This scale multiplies the pixelSize and outlineWidth to affect the total size of the point. If undefined, scaleByDistance will be disabled.
示例: 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;
确定是否显示该点。使用它来隐藏或显示一个点,而不是删除它并将其重新添加到集合中。 Determines if this point will be shown. Use this to hide or show a point, instead of removing it and re-adding it to the collection.
The SplitDirection 适用于这一点。 to apply to this point.
默认值: Default Value: SplitDirection.NONE
根据点距相机的距离获取或设置该点的近端和远端半透明属性。点的半透明度将在 Gets or sets near and far translucency properties of a point based on the point's distance from the camera. A point's translucency will interpolate between the NearFarScalar#nearValue and NearFarScalar#farValue 当相机距离落在指定的下限和上限内时 while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far。在这些范围之外,点的半透明度仍然被限制在最近的范围内。如果未定义,translucencyByDistance 将被禁用。 . Outside of these ranges the point's translucency remains clamped to the nearest bound. If undefined, translucencyByDistance will be disabled.
示例: 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

计算点原点的屏幕空间位置。屏幕空间原点是画布的左上角; Computes the screen-space position of the point's origin. The screen space origin is the top, left corner of the canvas; x 从左到右增加,并且 increases from left to right, and y 从上到下增加。 increases from top to bottom.
名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.
result Cartesian2 可选 optional 用于存储结果的对象。 The object onto which to store the result.
返回: Returns:
点的屏幕空间位置。 The screen-space position of the point.
抛出: Throws:
  • DeveloperError :PointPrimitive 必须位于集合中。 : PointPrimitive must be in a collection.
示例: Example:
console.log(p.computeScreenSpacePosition(scene).toString());

equals(other)boolean

确定此点是否等于另一个点。如果所有属性都相等,则点相等。不同集合中的点可以相等。 Determines if this point equals another point. Points are equal if all their properties are equal. Points in different collections can be equal.
名称 Name 类型 Type 说明 Description
other PointPrimitive 可选 optional 比较平等的点。 The point to compare for equality.
返回: Returns:
true 如果分数相等;否则, if the points are equal; otherwise, false.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.