GroundPolylinePrimitive

new Cesium.GroundPolylinePrimitive(options)

GroundPolylinePrimitive表示覆盖在Scene中的地形或三维瓷砖上的多段线。

Only to be used with GeometryInstances containing GroundPolylineGeometry.

Name Type Description
options Object optional 具有以下属性的对象:
Name Type Default Description
geometryInstances Array | GeometryInstance optional 包含基本多段线几何体的几何体
appearance Appearance optional 用于渲染多段线的外观。在PolylineMaterialAppearance上,默认为白色Material
show Boolean true optional 确定是否显示此原语。
interleave Boolean false optional 61166几何体交错渲染时,可以稍微提高66属性的渲染性能。
releaseGeometryInstances Boolean true optionaltrue时,原语不保留对输入geometryInstances的引用以节省内存。
allowPicking Boolean true optional 当为true时,每个几何体实例将只能使用Scene#pick进行拾取。当false时,保存GPU内存。
asynchronous Boolean true optional 确定原语是异步创建还是阻塞直到准备就绪。If false initializerRailHeights()必须首先调用。
classificationType ClassificationType ClassificationType.BOTH optional 确定是对地形、三维分幅还是两者都进行分类。
debugShowBoundingVolume Boolean false optional 仅用于调试。确定是否显示了该图元的命令的边界球体。
debugShowShadowVolume Boolean false optional 仅用于调试。确定是否绘制基本体中每个几何体的阴影体积。必须是true对创作有影响。
Example:
// 1. Draw a polyline on terrain with a basic color material

var 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.

var instance = 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 : instance,
  appearance : new Cesium.PolylineColorAppearance()
}));

Members

readonly allowPicking : Boolean

当为true时,每个几何体实例将只能使用Scene#pick进行拾取。当false时,保存GPU内存。
Default Value: true
Appearance是用来给这个原始人着色的。每个几何体 实例以相同的外观着色。一些表象,比如 PolylineColorAppearance允许给每个实例唯一 属性。
Default Value: undefined

readonly asynchronous : Boolean

确定几何体实例是否将在web工作器上创建和批处理。
Default Value: true
确定是对地形、三维分幅还是两者都进行分类。
Default Value: ClassificationType.BOTH

debugShowBoundingVolume : Boolean

此属性仅用于调试;它不用于生产用途,也不进行优化。

Draws the bounding sphere for each draw command in the primitive.

Default Value: false

readonly debugShowShadowVolume : Boolean

此属性仅用于调试;它不用于生产用途,也不进行优化。

If true, draws the shadow volume for each geometry in the primitive.

Default Value: false

readonly geometryInstances : Array|GeometryInstance

使用此基本体渲染的几何体实例。今年五月 如果是options.releaseGeometryInstances,则为undefined 构造原语时为true

Changing this property after the primitive is rendered has no effect.

Default Value: undefined

readonly interleave : Boolean

确定几何体顶点属性是否交错,这可以稍微提高渲染性能。
Default Value: false

readonly ready : Boolean

确定基本体是否已完成并准备好渲染。如果这个属性是 真的,下一次GroundPolylinePrimitive#update 被称为。
获取在原语准备呈现时解析的承诺。

readonly releaseGeometryInstances : Boolean

true时,原语不保留对输入geometryInstances的引用以节省内存。
Default Value: true
确定是否显示原语。这会影响所有几何体 原语中的实例。
Default Value: true

Methods

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

初始化最小和最大地形高度。只有在创建 同步的GroundPolylinePrimitive。
Returns:
一个一旦地形高度被加载就可以解决的承诺。

static Cesium.GroundPolylinePrimitive.isSupported(scene)Boolean

检查给定场景是否支持GroundPolylinePrimitives。 GroundPolylinePrimitives需要支持WEBGL_depth_纹理扩展。
Name Type Description
scene Scene 当前场景。
Returns:
当前场景是否支持GroundPolylinePrimitives。
销毁此对象持有的WebGL资源。销毁一个对象允许确定性 释放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:
Example:
e = e && e.destroy();
See:

getGeometryInstanceAttributes(id)Object

返回GeometryInstance的每个实例的可修改属性。
Name Type Description
id * GeometryInstance的id。
Returns:
属性格式的类型化数组,如果不是id为的实例,则为未定义数组。
Throws:
  • DeveloperError :必须在调用getGeometryInstanceAttributes之前调用update。
Example:
var attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);

isDestroyed()Boolean

如果此对象已销毁,则返回true;否则返回false。

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.

Returns:
如果此对象被销毁,则为true;否则为false
See:
ViewerCesiumWidget将场景渲染到 获取渲染此基本体所需的draw命令。

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,必须调用GRUndPolylinePrimitives.initializeTerrainHeights()并等待返回的承诺解决。
  • DeveloperError :所有geometryInstance必须具有颜色属性才能将PolylineColorAppearance与GroundPolylinePrimitive一起使用。