GroundPolylinePrimitive

new SuperMap3D.GroundPolylinePrimitive()

用于在场景中Scene地形表面或 3D Tiles上绘制贴地折线图元类 仅限用于包含GroundPolylineGeometry(地面折线几何体)的几何体实例GroundPolylineGeometry
Name Type Default Description
options.geometryInstances Array | GeometryInstance optional 包含GroundPolylineGeometry的GeometryInstances
options.appearance Appearance optional 用于渲染折线的外观(Appearance),默认在PolylineMaterialAppearancePolylineMaterialAppearance上使用白色MaterialMaterial
options.show Boolean true optional 确定此图元是否显示。
options.interleave Boolean false optional 当为true时,几何体顶点属性是交错的,这可以略微提高渲染性能,但会增加加载时间。
options.releaseGeometryInstances Boolean true optional 当为true时,图元不会保留对输入的geometryInstances的引用,以节省内存。
options.allowPicking Boolean true optional 当为true时,每个几何实例只能通过Scene#pick进行拾取。当为false时,可以节省 GPU 内存。
options.asynchronous Boolean true optional 确定图元是异步创建还是阻塞直到准备就绪。如果为false,则必须先调用initializeTerrainHeights()。
options.classificationType ClassificationType ClassificationType.BOTH optional 确定是否对地形、3D Tiles 或两者进行分类。
options.debugShowBoundingVolume Boolean false optional 仅用于调试。确定是否显示此图元命令的边界球体。
options.debugShowShadowVolume Boolean false optional 仅用于调试。确定是否绘制图元中每个几何体的阴影体积。必须在创建时设置为true才有效。
Example:
// 1. Draw a polyline on terrain with a basic color material

var instance = new SuperMap3D.GeometryInstance({
  geometry : new SuperMap3D.GroundPolylineGeometry({
     positions : SuperMap3D.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 SuperMap3D.GroundPolylinePrimitive({
  geometryInstances : instance,
  appearance : new SuperMap3D.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 SuperMap3D.GeometryInstance({
  geometry : new SuperMap3D.GroundPolylineGeometry({
     positions : SuperMap3D.Cartesian3.fromDegreesArray([
         -112.1340164450331, 36.05494287836128,
         -112.08821010582645, 36.097804071380715,
         -112.13296079730024, 36.168769146801104
     ]),
     loop : true,
     width : 4.0
  }),
  attributes : {
     color : SuperMap3D.ColorGeometryInstanceAttribute.fromColor(SuperMap3D.Color.fromCssColorString('green').withAlpha(0.7)),
     distanceDisplayCondition : new SuperMap3D.DistanceDisplayConditionGeometryInstanceAttribute(1000, 30000)
  },
  id : 'object returned when this instance is picked and to get/set per-instance attributes'
});

scene.groundPrimitives.add(new SuperMap3D.GroundPolylinePrimitive({
  geometryInstances : instance,
  appearance : new SuperMap3D.PolylineColorAppearance()
}));

Members

_polygonEntityId

矢量面内添矢量线

readonlyallowPicking : Boolean

当为true时,每个几何实例只能通过`Scene#pick`进行拾取。当为`false`时,可以节省 GPU 内存。
Default Value: true

appearance : Appearance

用于为这个图元着色的Appearance。 每个几何实例都使用相同的外观进行着色。 某些外观,如PolylineColorAppearance ,允许为每个实例提供独特的属性。
Default Value: undefined

readonlyasynchronous : Boolean

确定几何实例是否会在 Web Worker 中创建和批量处理。
Default Value: true

classificationType : ClassificationType

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

debugShowBoundingVolume : Boolean

这个属性仅用于调试 绘制图元中每个绘制命令的边界球体。
Default Value: false

readonlydebugShowShadowVolume : Boolean

这个属性仅用于调试 如果为true,则绘制图元中每个几何体的阴影体积。
Default Value: false

readonlygeometryInstances : Array|GeometryInstance

使用此图元渲染的几何实例。 如果在创建图元时options.releaseGeometryInstances为true,则此值可能未定义。 在图元渲染后更改此属性不会产生任何效果。
Default Value: undefined

readonlyinterleave : Boolean

Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
Default Value: false

readonlyready : Boolean

确定图元是否完整且准备好渲染。 如果此属性为true,则在下次调用GroundPolylinePrimitive#update时,图元将被渲染。

readonlyreadyPromise : Promise.<GroundPolylinePrimitive>

获取一个promise,当图元准备好渲染时,该promise将被解析。

readonlyreleaseGeometryInstances : Boolean

当为`true`时,图元不会保留对输入的geometryInstances的引用,以节省内存。
Default Value: true

show : Boolean

确定图元是否显示。这将影响图元中的所有几何实例。
Default Value: true

Methods

staticSuperMap3D.GroundPolylinePrimitive.initializeTerrainHeights()Promise

初始化地形的最小高度和最大高度。 只有在同步创建GroundPolylinePrimitive时才需要调用此方法。
Returns:
A promise that will resolve once the terrain heights have been loaded.

staticSuperMap3D.GroundPolylinePrimitive.isSupported(scene)Boolean

检查给定的Scene是否支持GroundPolylinePrimitives。 GroundPolylinePrimitives需要支持WEBGL_depth_texture扩展。
Name Type Description
scene Scene 当前场景。
Returns:
当前场景是否支持GroundPolylinePrimitives。

destroy()

销毁此对象持有的 WebGL 资源。销毁一个对象可以确定性地释放 WebGL 资源,而不是依赖垃圾回收器来销毁这个对象。 一旦一个对象被销毁,它就不应该再被使用;调用除isDestroyed之外的任何函数都将导致抛出一个DeveloperError异常。 因此,应该像示例中那样,将返回值(undefined)赋值给该对象。
Throws:
  • DeveloperError : 该对象已被销毁,即调用了`destroy()`方法。
Example:
e = e && e.destroy();
See:

getGeometryInstanceAttributes(id)Object

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

isDestroyed()Boolean

如果该对象已被销毁,则返回 true;否则返回 false。 调用除isDestroyed之外的任何函数都将导致抛出一个DeveloperError异常。
Returns:
如果该对象已被销毁,则为true;否则为false。
See:

update()

当Viewer或Widget渲染场景时,调用此方法以获取渲染此图元所需的绘制命令。 不要直接调用此方法。这里只是列出在渲染场景时可能传播的异常:
Throws:
  • DeveloperError : 对于同步的GroundPolylinePrimitive,您必须调用GroundPolylinePrimitive.initializeTerrainHeights()并等待返回的承诺解析。
  • DeveloperError : 要使用PolylineColorAppearance与GroundPolylinePrimitive,所有GeometryInstances都必须具有颜色属性。