Class: ODLine

ODLine

ODLine 迁徙线相关的操作
一般通过api.odline调用其方法,效果图如下:

迁徙线样式参数示例


new ODLine()

protected

See:

Extends

Methods


add(data, fn)

添加一个或多个ODLine对象

Parameters:
Name Type Description
data object | array

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

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

  • groupId (string) 可选,Group分组

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

  • color (Color) 颜色值,支持四种格式,取值示例

  • coordinates (array) 坐标点数组,只有2个元素,第1个元素是起点坐标,第2个元素是终点坐标

  • flowRate (number) 流速,取值范围:[0~1.0],默认值:0.5

  • intensity (number) 亮度,取值范围:[0.1~1000],默认值:0.5

  • bendDegree (number) 弯曲度,取值范围:[0~1.0],默认值:0.5

  • tiling (number) 材质贴图平铺比例,从起始位置开始平铺,超过的部分会按此比例生成新的区域,类似CSS的repeat。如果这个值 <= 0 使用自动计算按Polyline长度比例平铺, >0使用用户输入的值去平铺

  • lineThickness (number) 线宽,单位:米,默认值20

  • flowPointSizeScale (number) 运动点的缩放值,默认值20, 单位米

  • labelSizeScale (number) 两端点的缩放值,默认值100, 单位米

  • lineShape (number) ODLine模型样式 0:平面 1:柱体,默认值1

  • lineStyle (number) ODLine材质样式 0:纯色 1:箭头,2:流动点,默认值0(Style为2时建议手动设置Tiling 例如设为1)

  • flowShape (number) ODLine发光点样式 0:无 1:球体,默认值0(Shape为0即删除/隐藏,当Shape为0时设置Style无效)

  • startPointShape (number) StartPoint样式, default 0 ( 0 : None 1 : Sphere )

  • endPointShape (number) EndPoint样式, default 0 ( 0 : None 1 : Sphere )

  • startLabelShape (number) StartLabel样式, default 0 ( 0 : None 1 : Circle )

  • endLabelShape (number) EndLabel样式, default 0 ( 0 : None 1 : Circle )

fn function

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


clear(fn)

删除场景中所有的ODLine

Parameters:
Name Type Description
fn function

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


delete(ids, fn)

删除一个或多个ODLine对象

Parameters:
Name Type Description
ids string | array

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

fn function

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


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

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

Parameters:
Name Type Description
ids string | array

ODLine对象的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获取ODLine的详细信息

Parameters:
Name Type Description
ids string | array

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

fn function

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

Example
ODLine的详细信息
{
            "id":	"od1",
            "groupId":	"",
            "userData":	"",
            "coordinates":	[[492303.656250, 2487534.500000, 4.195000], [491391.562500, 2487777.500000, 4.200000]],
            "color":	[0.000000, 0.500000, 0.000000, 1.000000],
            "flowRate":	1.000000,
            "Brightness":	1.000000,
            "bendDegree":	0.500000,
            "tiling":	0.500000,
            "lineThickness":	15.000000,
            "flowSizeScale":	30.000000,
            "labelSizeScale":	1000.000000,
            "lineShape":	1,
            "lineStyle":	0,
            "flowShape":	1,
            "flowStyle":	0,
            "startPointShape":	1,
            "startPointStyle":	0,
            "endPointShape":	1,
            "endPointStyle":	0,
            "startLabelShape":	1,
            "startLabelStyle":	0,
            "endLabelShape":	1,
            "endLabelStyle":	0
        }

hide(ids, fn)

隐藏ODLine

Parameters:
Name Type Description
ids string | array

ODLine对象的ID或者ID数组

fn function

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


hideAll(fn)

隐藏所有ODLine

Parameters:
Name Type Description
fn function

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


setBendDegree(id, newVal, fn)

设置新的弯曲度

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setBrightness(id, newVal, fn)

设置新的亮度

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setColor(id, newVal, fn)

设置新的颜色值

Parameters:
Name Type Description
id string

字符串类型的ID

newVal Color

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

fn function

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


setCoordinates(id, newVal, fn)

设置坐标值

Parameters:
Name Type Description
id string

字符串类型的ID

newVal array

新值

fn function

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


setEndLabelShape(id, newVal, fn)

设置EndLabel样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setEndPointShape(id, newVal, fn)

设置EndPoint样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setflowPointSizeScale(id, newVal, fn)

设置运动点的缩放

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setFlowRate(id, newVal, fn)

设置新的流速

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setFlowShape(id, newVal, fn)

设置ODLine发光点样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setLabelSizeScale(id, newVal, fn)

设置两端点的缩放值

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setLineShape(id, newVal, fn)

设置ODLine模型样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setLineStyle(id, newVal, fn)

设置ODLine材质样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setLineThickness(id, newVal, fn)

设置线的厚度

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setStartLabelShape(id, newVal, fn)

设置StartLabel样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setStartPointShape(id, newVal, fn)

设置StartPoint样式

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


setTiling(id, newVal, fn)

设置材质贴图平铺

Parameters:
Name Type Description
id string

字符串类型的ID

newVal number

新值

fn function

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


show(ids, fn)

显示ODLine

Parameters:
Name Type Description
ids string | array

ODLine对象的ID或者ID数组

fn function

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


showAll(fn)

显示所有ODLine

Parameters:
Name Type Description
fn function

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


update(data, fn)

修改一个或多个ODLine对象

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: