GroundPolylinePrimitive

external class GroundPolylinePrimitive(options: GroundPolylinePrimitive.ConstructorOptions? = definedExternally)(source)

A GroundPolylinePrimitive represents a polyline draped over the terrain or 3D Tiles in the Scene.

Only to be used with GeometryInstances containing GroundPolylineGeometry.

// 1. Draw a polyline on terrain with a basic color material

const instance = new GeometryInstance({
geometry : new GroundPolylineGeometry({
positions : Cartesian3.fromDegreesArray([
-112.1340164450331, 36.05494287836128,
-112.08821010582645, 36.097804071380715
]),
width : 4.0
}),
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});

scene.groundPrimitives.add(new GroundPolylinePrimitive({
geometryInstances : instance,
appearance : new PolylineMaterialAppearance()
}));

// 2. Draw a looped polyline on terrain with per-instance color and a distance display condition.
// Distance display conditions for polylines on terrain are based on an approximate terrain height
// instead of true terrain height.

const instance2 = new GeometryInstance({
geometry : new GroundPolylineGeometry({
positions : Cartesian3.fromDegreesArray([
-112.1340164450331, 36.05494287836128,
-112.08821010582645, 36.097804071380715,
-112.13296079730024, 36.168769146801104
]),
loop : true,
width : 4.0
}),
attributes : {
color : ColorGeometryInstanceAttribute.fromColor(Color.fromCssColorString('green').withAlpha(0.7)),
distanceDisplayCondition : new DistanceDisplayConditionGeometryInstanceAttribute(1000, 30000)
},
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});

scene.groundPrimitives.add(new GroundPolylinePrimitive({
geometryInstances : instance2,
appearance : new PolylineColorAppearance()
}));

See also

Constructors

Link copied to clipboard
constructor(options: GroundPolylinePrimitive.ConstructorOptions? = definedExternally)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface ConstructorOptions

Properties

Link copied to clipboard

When true, each geometry instance will only be pickable with Scene.pick. When false, GPU memory is saved.

Link copied to clipboard

The Appearance used to shade this primitive. Each geometry instance is shaded with the same appearance. Some appearances, like PolylineColorAppearance allow giving each instance unique properties.

Link copied to clipboard

Determines if the geometry instances will be created and batched on a web worker.

Link copied to clipboard

Determines whether terrain, 3D Tiles or both will be classified.

Link copied to clipboard

This property is for debugging only; it is not for production use nor is it optimized.

Link copied to clipboard

This property is for debugging only; it is not for production use nor is it optimized.

Link copied to clipboard

The geometry instances rendered with this primitive. This may be undefined if options.releaseGeometryInstances is true when the primitive is constructed.

Link copied to clipboard

Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.

Link copied to clipboard

Determines if the primitive is complete and ready to render. If this property is true, the primitive will be rendered the next time that GroundPolylinePrimitive.update is called.

Link copied to clipboard

When true, the primitive does not keep a reference to the input geometryInstances to save memory.

Link copied to clipboard

Determines if the primitive will be shown. This affects all geometry instances in the primitive.

Functions

Link copied to clipboard
fun destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Link copied to clipboard

Returns the modifiable per-instance attributes for a GeometryInstance.

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.

Link copied to clipboard
fun update()

Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.