Scene
.
Only to be used with GeometryInstances containing GroundPolylineGeometry
.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object with the following properties:
|
Example:
// 1. Draw a polyline on terrain with a basic color material
const instance = new Cesium.GeometryInstance({
geometry : new Cesium.GroundPolylineGeometry({
positions : Cesium.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 Cesium.GroundPolylinePrimitive({
geometryInstances : instance,
appearance : new Cesium.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 Cesium.GeometryInstance({
geometry : new Cesium.GroundPolylineGeometry({
positions : Cesium.Cartesian3.fromDegreesArray([
-112.1340164450331, 36.05494287836128,
-112.08821010582645, 36.097804071380715,
-112.13296079730024, 36.168769146801104
]),
loop : true,
width : 4.0
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString('green').withAlpha(0.7)),
distanceDisplayCondition : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(1000, 30000)
},
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});
scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
geometryInstances : instance2,
appearance : new Cesium.PolylineColorAppearance()
}));
Members
true
, each geometry instance will only be pickable with Scene#pick
. When false
, GPU memory is saved.
-
Default Value:
true
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.
-
Default Value:
undefined
-
Default Value:
true
classificationType : ClassificationType
-
Default Value:
ClassificationType.BOTH
Draws the bounding sphere for each draw command in the primitive.
-
Default Value:
false
If true, draws the shadow volume for each geometry in the primitive.
-
Default Value:
false
readonly geometryInstances : Array|GeometryInstance
undefined
if options.releaseGeometryInstances
is true
when the primitive is constructed.
Changing this property after the primitive is rendered has no effect.
-
Default Value:
undefined
-
Default Value:
false
GroundPolylinePrimitive#update
is called.
readonly readyPromise : Promise.<GroundPolylinePrimitive>
true
, the primitive does not keep a reference to the input geometryInstances
to save memory.
-
Default Value:
true
-
Default Value:
true
Methods
Returns:
Name | Type | Description |
---|---|---|
scene |
Scene | The current scene. |
Returns:
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed
will result in a DeveloperError
exception. Therefore,
assign the return value (undefined
) to the object as done in the example.
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
e = e && e.destroy();
See:
GeometryInstance
.
Name | Type | Description |
---|---|---|
id |
* |
The id of the GeometryInstance . |
Returns:
Throws:
-
DeveloperError : must call update before calling getGeometryInstanceAttributes.
Example:
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
If this object was destroyed, it should not be used; calling any function other than
isDestroyed
will result in a DeveloperError
exception.
Returns:
true
if this object was destroyed; otherwise, false
.
Viewer
or CesiumWidget
render the scene to
get the draw commands needed to render this primitive.
Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered:
Throws:
-
DeveloperError : For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.
-
DeveloperError : All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.