Skip to content

KBE3D / KBCore / Cesium / PointPrimitive

类: PointPrimitive

<div class="notice"> A point is created and its initial properties are set by calling PointPrimitiveCollection#add. Do not call the constructor directly. </div> A graphical point positioned in the 3D scene, that is created and rendered using a PointPrimitiveCollection.

属性

show

show: boolean

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.


position

position: Cartesian3

Gets or sets the Cartesian position of this point.


scaleByDistance

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.

Examples

ts
// 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);
ts
// Example 2.
// disable scaling by distance
p.scaleByDistance = undefined;

translucencyByDistance

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.

Examples

ts
// 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);
ts
// Example 2.
// disable translucency by distance
p.translucencyByDistance = undefined;

pixelSize

pixelSize: number

Gets or sets the inner size of the point in pixels.


color

color: Color

Gets or sets the inner color of the point. The red, green, blue, and alpha values are indicated by <code>value</code>'s <code>red</code>, <code>green</code>, <code>blue</code>, and <code>alpha</code> properties as shown in Example 1. These components range from <code>0.0</code> (no intensity) to <code>1.0</code> (full intensity).

Examples

ts
// Example 1. Assign yellow.
p.color = Cesium.Color.YELLOW;
ts
// Example 2. Make a pointPrimitive 50% translucent.
p.color = new Cesium.Color(1.0, 1.0, 1.0, 0.5);

outlineColor

outlineColor: Color

Gets or sets the outline color of the point.


outlineWidth

outlineWidth: number

Gets or sets the outline width in pixels. This width adds to pixelSize, increasing the total size of the point.


distanceDisplayCondition

distanceDisplayCondition: DistanceDisplayCondition

Gets or sets the condition specifying at what distance from the camera that this point will be displayed.


disableDepthTestDistance

disableDepthTestDistance: number

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.


id

id: any

Gets or sets the user-defined value returned when the point is picked.


splitDirection

splitDirection: SplitDirection

The SplitDirection to apply to this point.

方法

computeScreenSpacePosition()

computeScreenSpacePosition(scene: Scene, result?: Cartesian2): Cartesian2

Computes the screen-space position of the point's origin. The screen space origin is the top, left corner of the canvas; <code>x</code> increases from left to right, and <code>y</code> increases from top to bottom.

参数

scene

Scene

The scene.

result?

Cartesian2

The object onto which to store the result.

返回

Cartesian2

The screen-space position of the point.

示例

ts
console.log(p.computeScreenSpacePosition(scene).toString());

equals()

equals(other?: PointPrimitive): boolean

Determines if this point equals another point. Points are equal if all their properties are equal. Points in different collections can be equal.

参数

other?

PointPrimitive

The point to compare for equality.

返回

boolean

true if the points are equal; otherwise, false.

构造函数

构造函数

new PointPrimitive(): PointPrimitive

返回

PointPrimitive

KBE3D @3.0.0 Copyright © 2024-present KBE3D