new Cesium.GroundPolylinePrimitive(options)

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

仅用于含有 GroundPolylineGeometry 的几何内存.

Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
geometryInstances Array | GeometryInstance optional 含有地表聚合物的几何结构
appearance Appearance optional The Appearance used to render the polyline. Defaults to a white color Material on a PolylineMaterialAppearance.
show boolean true optional Determines if this primitive will be shown.
interleave boolean false optional When true, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.
releaseGeometryInstances boolean true optional When true, the primitive does not keep a reference to the input geometryInstances to save memory.
allowPicking boolean true optional When true, each geometry instance will only be pickable with Scene#pick. When false, GPU memory is saved.
asynchronous boolean true optional Determines if the primitive will be created asynchronously or block until ready. If false initializeTerrainHeights() must be called first.
classificationType ClassificationType ClassificationType.BOTH optional Determines whether terrain, 3D Tiles or both will be classified.
debugShowBoundingVolume boolean false optional For debugging only. Determines if this primitive's commands' bounding spheres are shown.
debugShowShadowVolume boolean false optional For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be true on creation to have effect.
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

readonly allowPicking : boolean

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

readonly asynchronous : boolean

确定是否创建几何实例并在网络工人上进行分批.
Default Value: true

classificationType : ClassificationType

确定是否对地形、3D平面或两者进行分类.
Default Value: ClassificationType.BOTH

debugShowBoundingVolume : boolean

此属性仅用于调试;不用于生产,也不优化.

绘制原始中每个绘图命令的边框.

Default Value: false

readonly debugShowShadowVolume : boolean

此属性仅用于调试;不用于生产,也不优化.

如果真实,则为原始中的每一几何绘制阴影音量.

Default Value: false

readonly geometryInstances : Array|GeometryInstance

用这个原始的几何学实例。 这可能 如果 NT 0 未定义 NT 1 如果 NT 4 is true when the primitive is constructed.

原始化后改变这个属性没有效果.

Default Value: undefined

readonly interleave : boolean

确定几何顶点属性是否互换,这可以略微改善渲染性能.
Default Value: false

readonly ready : boolean

确定原始的是否完整,是否准备制成. 如果这是 true, the primitive will be rendered the next time that GroundPolylinePrimitive#update is called.

readonly releaseGeometryInstances : boolean

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

show : boolean

确定是否将显示原始文件 。 这影响到所有几何 原始中的例子.
Default Value: true

Methods

static Cesium.GroundPolylinePrimitive.initializeTerrainHeights()Promise.<void>

初始化最小和最大地形高度. 只有您正在创建 GroundPolylinePrimitive synchronously.
Returns:
一旦地形高度升空 承诺就能解决.

static Cesium.GroundPolylinePrimitive.isSupported(scene)boolean

检查给定的 NT 0 是否支持 GroundPolyline Primmitives . GroundPolyline Primmitives需要支持WEBGL 深度 纹理扩展.
Name Type Description
scene Scene 目前的场景.
Returns:
当前场景是否支持 GroundPolyline Primmitives .

destroy()

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:

getGeometryInstanceAttributes(id)object

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);

isDestroyed()boolean

如果此对象被销毁, 返回真实; 否则, 错误 .

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:

update()

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.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.