Class: HighlightArea

HighlightArea

HighlightArea(高亮区域)相关的操作
一般通过api.highlightArea调用其方法


<protected> new HighlightArea()

See:

Extends

Methods


add(data, fn)

添加一个或多个HighlightArea对象

Parameters:
Name Type Description
data object | array

对象或者数组,对于每一个对象支持以下属性:

  • id (string) 字符串类型的ID

  • groupId (string) 可选,Group分组

  • userData (string) 可选,用户自定义数据

  • coordinates (array) 多边形坐标数组(二维数组),取值示例

  • color (Color) 多边形高亮颜色,支持四种格式,取值示例

  • heightRange (array) 高亮染色区域高度范围:[min,max],数组元素取值范围:[任意浮点数],取值说明:Z坐标的区间,只有Z值这这个区间的模型才会被染色

  • intensity (number) 高亮颜色的强度,取值范围:[0~1000]

  • depthTest (boolean) 是否做深度检测,默认为true(DepthTest=true会被遮挡,false的话不会被遮挡)

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


clear(fn)

删除场景中所有的HighlightArea

Parameters:
Name Type Description
fn function

可选的回调函数,请参考二次开发:异步接口调用方式


delete(ids, fn)

删除一个或多个HighlightArea对象

Parameters:
Name Type Description
ids string | array

要删除的HighlightArea对象的ID或者ID数组(可以删除一个或者多个)

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


focus(ids, distance, flyTime, rotation, fn)

自动定位到合适的观察距离

Parameters:
Name Type Description
ids string | array

HighlightArea对象的ID或者ID数组

distance number

可选参数,观察点距离目标点(被拍摄物体)的距离,取值范围:[0.01~任意正数],如果设置为0或者不设置,系统自动计算

flyTime number

可选参数,相机飞行的时间,取值范围:[0~任意正数],单位:秒,默认值2秒

rotation array

可选参数,相机旋转的欧拉角:[Pitch,Yaw,Roll],数组元素类型:(number),取值范围:Pitch[-90~90] Yaw[-180~180] Roll[0]

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


get(ids, fn)

根据ID获取HighlightArea的详细信息

Parameters:
Name Type Description
ids string | array

要获取的HighlightArea对象ID或者ID数组(可以获取一个或者多个)

fn function

可选的回调函数,请参考二次开发:异步接口调用方式

Example
高亮区域的详细信息
{
            "id":	"1",
            "coordinates":	[],
            "color":	[1.000000, 0.000000, 0.000000, 0.800000],
            "heightRange":	[0.000000, 100.000000],
            "intensity":	5.000000
        }

hide(ids, fn)

隐藏HighlightArea

Parameters:
Name Type Description
ids string | array

HighlightArea对象的ID或者ID数组

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setColor(id, newVal, fn)

设置颜色

Parameters:
Name Type Description
id any

HighlightArea对象的ID

newVal Color

新的颜色值,支持四种格式,取值示例

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setCoordinates(id, newVal, fn)

设置坐标

Parameters:
Name Type Description
id any

HighlightArea对象的ID

newVal array

新的坐标值

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setDepthTest(id, newVal, fn)

设置是否做深度检测

Parameters:
Name Type Description
id any

HighlightArea对象的ID

newVal boolean

是否做深度检测

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setHeightRange(id, newVal, fn)

设置高度范围

Parameters:
Name Type Description
id any

HighlightArea对象的ID

newVal array

高亮染色区域高度范围:[min,max]

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setIntensity(id, newVal, fn)

设置亮度

Parameters:
Name Type Description
id any

HighlightArea对象的ID

newVal number

新的亮度值

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


show(ids, fn)

显示HighlightArea

Parameters:
Name Type Description
ids string | array

HighlightArea对象的ID或者ID数组

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


update(data, fn)

修改一个或多个HighlightArea对象

Parameters:
Name Type Description
data object | array

对象或者数组,数据结构请参考add方法

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


updateBegin()

用于批量多次修改对象的属性

在开始修改之前调用updateBegin,然后可以多次调用setXXX方法,最后调用updateEnd提交修改更新数据
注意:
updateBegin不是异步调用,不需要await,也没有回调函数参数

Inherited From:
Overrides:
Example
__g.xxx.updateBegin();
for (let i = 0; i < 1000; i++) {
     __g.xxx.setColor(i, Color.Yellow);
} 
__g.xxx.updateEnd(function () {
     log('update finished!');
});

updateEnd(fn)

用于批量多次修改对象的属性,与updateBegin配套使用
注意:
updateEnd是异步调用,可以用回调函数也可以await

Parameters:
Name Type Description
fn function

可选的回调函数,请参考二次开发:异步接口调用方式

Inherited From:
Overrides: