GroundPolylinePrimitive
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
Types
Properties
When true
, each geometry instance will only be pickable with Scene.pick. When false
, GPU memory is saved.
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.
Determines if the geometry instances will be created and batched on a web worker.
Determines whether terrain, 3D Tiles or both will be classified.
This property is for debugging only; it is not for production use nor is it optimized.
This property is for debugging only; it is not for production use nor is it optimized.
The geometry instances rendered with this primitive. This may be undefined
if options.releaseGeometryInstances
is true
when the primitive is constructed.
Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
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.
When true
, the primitive does not keep a reference to the input geometryInstances
to save memory.
Functions
Returns the modifiable per-instance attributes for a GeometryInstance.
Returns true if this object was destroyed; otherwise, false.
Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.