A GroundPolylinePrimitive represents a polyline draped over the terrain or 3D Tiles in the
Scene.
仅用于含有 GroundPolylineGeometry 的几何内存.
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
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
When
true, each geometry instance will only be pickable with Scene#pick. When false, GPU memory is saved.
-
Default Value:
true
appearance : Appearance
The
Appearance used to shade this primitive. Each geometry
实例以相同的外观遮蔽。 一些外表,比如说
PolylineColorAppearance allow giving each instance unique
properties.
-
Default Value:
undefined
确定是否创建几何实例并在网络工人上进行分批.
-
Default Value:
true
classificationType : ClassificationType
确定是否对地形、3D平面或两者进行分类.
-
Default Value:
ClassificationType.BOTH
此属性仅用于调试;不用于生产,也不优化.
绘制原始中每个绘图命令的边框.
-
Default Value:
false
此属性仅用于调试;不用于生产,也不优化.
如果真实,则为原始中的每一几何绘制阴影音量.
-
Default Value:
false
readonly geometryInstances : Array|GeometryInstance
用这个原始的几何学实例。 这可能
如果 NT 0 未定义 NT 1 如果 NT 4
is
true when the primitive is constructed.
原始化后改变这个属性没有效果.
-
Default Value:
undefined
确定几何顶点属性是否互换,这可以略微改善渲染性能.
-
Default Value:
false
确定原始的是否完整,是否准备制成. 如果这是
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.
-
Default Value:
true
确定是否将显示原始文件 。 这影响到所有几何
原始中的例子.
-
Default Value:
true
Methods
初始化最小和最大地形高度. 只有您正在创建
GroundPolylinePrimitive synchronously.
Returns:
一旦地形高度升空 承诺就能解决.
检查给定的 NT 0 是否支持 GroundPolyline Primmitives .
GroundPolyline Primmitives需要支持WEBGL 深度 纹理扩展.
| Name | Type | Description |
|---|---|---|
scene |
Scene | 目前的场景. |
Returns:
当前场景是否支持 GroundPolyline Primmitives .
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.
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:
Returns the modifiable per-instance attributes for a
GeometryInstance.
| Name | Type | Description |
|---|---|---|
id |
* |
The id of the GeometryInstance. |
Returns:
在属性格式中键入的数组, 如果无 id 实例, 则未定义 .
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.
Called when
Viewer or CesiumWidget render the scene to
获得使这个原始化所需的绘图命令.
不要直接调用此函数 。 记录下来的只是 列出场景拍摄时可能宣传的例外情况:
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.