Scene.
仅适用于包含以下内容的 GeometryInstances 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内存。 , 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
如果为 true,则为图元中的每个几何体绘制阴影体积。 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.
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 |
* |
的 ID The id of the GeometryInstance. |
返回: Returns:
抛出: Throws:
-
DeveloperError :必须在调用 getGeometryInstanceAttributes 之前调用 update。 : 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.
另见: See:
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 :对于同步 GroundPolylinePrimitives,您必须调用 GroundPolylinePrimitives.initializeTerrainHeights() 并等待返回的 Promise 解析。 : For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.
-
DeveloperError :所有 GeometryInstance 必须具有颜色属性才能将 PolylineColorAppearance 与 GroundPolylinePrimitive 结合使用。 : All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.
