A graphical point positioned in the 3D scene, that is created
and rendered using a
PointPrimitiveCollection
. A point is created and its initial
properties are set by calling PointPrimitiveCollection#add
.
Performance:
Reading a property, e.g., PointPrimitive#show
, is constant time.
Assigning to a property is constant time but results in
CPU to GPU traffic when PointPrimitiveCollection#update
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
and add new pointPrimitives instead of modifying each one.
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
Members
color : Color
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
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);
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.
在某个相机视角高度下(例如10000米),禁用深度检测。当设置值为Number.POSITIVE_INFINITY时,深度检测被一直禁用。
在某个相机视角高度下(例如10000米),禁用深度检测。当设置值为Number.POSITIVE_INFINITY时,深度检测被一直禁用。
-
Default Value:
0.0
distanceDisplayCondition : DistanceDisplayCondition
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.
outlineColor : Color
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.
position : Cartesian3
Gets or sets the Cartesian position of this point.
scaleByDistance : NearFarScalar
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
.
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.根据相机高度设定图元的大小比例属性,当相机高度在最近相机高度
NearFarScalar#near
及以下时,图元的大小比例为最近相机高度时的大小比例NearFarScalar#nearValue
,当相机高度在最近相机高度
NearFarScalar#near
和最远相机高度NearFarScalar#far
之间时,图元的大小比例从最近相机高度时的大小比例NearFarScalar#nearValue
到最远相机高度时的大小比例NearFarScalar#farValue
,当相机高度在最远相机高度
NearFarScalar#far
及以上时,图元的大小比例为最远相机高度时的大小比例NearFarScalar#farValue
。如果未赋值,则不生效。
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.
// 当相机高度在1.5e2米及以下时,图元恒定到1.5倍,在1.5e2米到8.0e6米之间时,比例从1.5到0,在8.0e6及以上时恒定为0。
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.
translucencyByDistance : NearFarScalar
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
.
Outside of these ranges the point's translucency remains clamped to the nearest bound. If undefined,
translucencyByDistance will be disabled.根据相机高度设定图元的透明度属性,当相机高度在最近相机高度
NearFarScalar#near
及以下时,图元的透明度为最近相机高度时的透明度NearFarScalar#nearValue
,当相机高度在最近相机高度
NearFarScalar#near
和最远相机高度NearFarScalar#far
之间时,图元的透明度从最近相机高度时的透明度NearFarScalar#nearValue
渐变到最远相机高度时的透明度NearFarScalar#farValue
,当相机高度在最远相机高度
NearFarScalar#far
之上时,图元的透明度为最远相机高度时的透明度NearFarScalar#farValue
。如果未赋值,则不生效。
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.
// 当相机高度在1.5e2米及以下时,图元透明度为1,在1.5e2米与8.0e6米之间时,透明度从1渐变到0,在8.0e6及以上时透明度为0。
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 must be in a collection.
Example:
console.log(p.computeScreenSpacePosition(scene).toString());
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 | The point to compare for equality. |
Returns:
true
if the points are equal; otherwise, false
.