new Sightline(scene)
视线分析,即通视分析,根据观察者点位和目标点建立视线分析,并在场景中分析得到结果。
| Name | Type | Description |
|---|---|---|
scene |
Scene |
场景对象。 |
- Demo:
Throws:
-
scene are required。
- Type
- DeveloperError
Example
//创建通视分析
var sightline = new SuperMap3D.Sightline(scene);
Members
-
hiddenColorColor
-
获取或设置通视分析的不可见部分颜色。
- Default Value: SuperMap3D.Color(1.0,0.0,0.0,1.0)
Example
var sightline = new SuperMap3D.Sightline(scene);
var color = new SuperMap3D.Color(1, 0, 0);
//设置不可见部分的颜色
sightline .hiddenColor = color;
//获取不可见部分的颜色
var value= sightline .hiddenColor ;
lineWidthnumber
获取或设置通视线的宽度。
- Default Value: 1.0
viewPositionArray
获取或设置观察者的位置。位置由经度、纬度和高程组成的数组表示。
- Default Value: [0.0,0.0,0.0]
Example
var sightline = new SuperMap3D.Sightline(scene);
//设置观察者的位置
sightline .viewPosition = [120, 40, 100];
//获取观察者的位置
var value= sightline .viewPosition;
visibleColorColor
获取或设置通视分析的可见部分颜色。
- Default Value: SuperMap3D.Color(0.0,1.0,0.0,1.0)
Example
var sightline = new SuperMap3D.Sightline(scene);
var color = new SuperMap3D.Color(0, 1, 0);
//设置可见部分颜色
sightline .visibleColor = color;
//获取可见部分颜色
var value= sightline .visibleColor ;
Methods
-
addTargetPoint(){boolean}
-
添加目标点。
Name Type Description options.positionArray.<number> 位置信息,由经度、纬度和高程组成的数组表示。
options.namestring 目标点的名称。
Returns:
Type Description boolean 添加成功返回true,否则返回false。 Example
var sightline = new SuperMap3D.Sightline(scene); sightline.addTargetPoint({ postion : [120, 40, 50], name : “first” }); -
build()
-
执行通视分析。
Example
var sightline = new SuperMap3D.Sightline(scene); sightline.build(); -
destroy()
-
销毁通视分析对象持有的资源
-
getVisibleInViewport(index){boolean}
-
获得图层对应视口可见性。
Name Type Description indexnumber 索引。
Throws:
-
the index is 0~8
- Type
- DeveloperError
Returns:
Type Description boolean visible 可见性。 -
-
removeAllTargetPoint()
-
移除所有目标点。
Example
var sightline = new SuperMap3D.Sightline(scene); sightline.removeAllTargetPoint(); -
removeTargetPoint(name){boolean}
-
移除指定名称的目标点。
Name Type Description namestring 待移除的目标点名称。
Returns:
Type Description boolean 移除成功返回true,否则返回false。 Example
var sightline = new SuperMap3D.Sightline(scene); var flag = sightline.removeTargetPoint(“first”); -
setVisibleInViewport(index)
-
设置图层对应视口可见性。
Name Type Description indexnumber 索引。
Throws:
-
the index is 0~8
- Type
- DeveloperError
-
-
update()
-
private