Sightline

new Cesium.Sightline(scene)

Line-of-sight analysis, that is, line-of-sight analysis, establishes line-of-sight analysis based on the observer's point and target point, and analyzes the result in the scene.
Name Type Description
scene Scene Scene object.
Throws:
Example:
//Sightline
var sightline = new Cesium.Sightline(scene);
Demo:

Members

hiddenColor : Color

Gets or sets the color of the invisible part of the visibility analysis.
Example:
var sightline = new Cesium.Sightline(scene);
var color = new Cesium.Color(1, 0, 0);
//Set the color of the invisible part
sightline .hiddenColor = color;
//Get the color of the invisible part
var value= sightline .hiddenColor ;

lineWidth : Number

Gets or sets the width of the line of sight.

viewPosition : Array

Get or set the position of the observer. The location is represented by an array of longitude, latitude, and elevation.
Example:
var sightline = new Cesium.Sightline(scene);
//Set the position of the observer
sightline .viewPosition   = [120, 40, 100];
//Get the position of the observer
var value= sightline .viewPosition;

visibleColor : Color

Gets or sets the color of the visible part of the visibility analysis.
Example:
var sightline = new Cesium.Sightline(scene);
var color = new Cesium.Color(0, 1, 0);
//Set the visible part color
sightline .visibleColor = color;
//Get the visible part color
var value= sightline .visibleColor ;

Methods

addTargetPoint(options)Boolean

Add target points.
Name Type Description
options Object The object has the following properties.
Name Type Description
position Array Location information, represented by an array of longitude, latitude, and elevation.
name String The name of the target point.
Returns:
Return true if added successfully, otherwise false.
Example:
var sightline = new Cesium.Sightline(scene);
sightline.addTargetPoint({
postion : [120, 40, 50],
name : “first”
               });

build()

Excute sightline analysis.
Example:
var sightline = new Cesium.Sightline(scene);
sightline.build();

getBarrierPoint(name, func)Object

Obtain obstacle points.
Name Type Description
name String The name of the target point.
func Object Callback.
Returns:
Object.isViewer, Object.position can see the latitude and longitude.

getObjectIds()Object

Obtain the IDS collection of all obstacle objects for visibility analysis.
Returns:
Return a k-v object, the key is the S3M layer ID, and the value is the object IDS array.

getVisibleInViewport(index)Boolean

Obtain the visibility of the viewport corresponding to the layer.
Name Type Description
index Number Index.
Returns:
Visibility (optional)
Throws:

removeAllTargetPoint()

Remove all target points.
Example:
var sightline = new Cesium.Sightline(scene);
sightline.removeAllTargetPoint();

removeTargetPoint(name)Boolean

Remove the target point with the specified name.
Name Type Description
name String The name of the target point to be removed.
Returns:
Return true if the removal is successful, otherwise false.
Example:
var sightline = new Cesium.Sightline(scene);
var flag = sightline.removeTargetPoint(“first”);

setVisibleInViewport(index)

Set the visibility of the corresponding viewport of the layer.
Name Type Description
index Number Index.
Throws: