Line of sight analysis, that is, through-view analysis, establishes line-of-sight analysis based on observer points and target points, and analyzes the results in the scene.
Name | Type | Description |
---|---|---|
scene |
Scene | Scene object. |
Throws:
-
DeveloperError : Specify the scene.
Example:
//Create a visual analysis
var sightline = new Cesium.Sightline(scene);
Demo:
Members
-
hiddenColor : Color
-
Gets or sets the invisible part of the color of the view.
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 ;
-
Gets or sets the observer's location. The position is represented by an array of longitude, latitude, and elevation.
Example:
var sightline = new Cesium.Sightline(scene); //Set the observer's position sightline .viewPosition = [120, 40, 100]; //Get the observer's location var value= sightline .viewPosition;
-
visibleColor : Color
-
Gets or sets the visible portion of the color of the view.
Example:
var sightline = new Cesium.Sightline(scene); var color = new Cesium.Color(0, 1, 0); //Set the visible part of the color sightline .visibleColor = color; //Get visible part color var value= sightline .visibleColor ;
Methods
-
Add a target point.
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:
Returns true if the addition succeeds, otherwise returns false.Example:
var sightline = new Cesium.Sightline(scene); sightline.addTargetPoint({ postion : [120, 40, 50], name : “first” });
-
Perform a visual analysis.
Example:
var sightline = new Cesium.Sightline(scene); sightline.build();
-
Get obstacles.
Name Type Description name
String Target point name. func
Object Callback. Returns:
Object.isViewer,Object.position Look through the latitude and longitude. -
Get a set of IDS collections that analyze all obstacle objects.
Returns:
Returns a k-v object, the key is the S3M layer ID, and the value is the object IDS array. -
Get the layer's corresponding viewport visibility.
Name Type Description index
Number index. Returns:
visibleThrows:
-
DeveloperError : the index is 0~3
-
-
Remove all target points.
Example:
var sightline = new Cesium.Sightline(scene); sightline.removeAllTargetPoint();
-
Remove the target point of the specified name.
Name Type Description name
String The name of the target point to be removed. Returns:
Returns true if the removal succeeds, otherwise returns false.Example:
var sightline = new Cesium.Sightline(scene); var flag = sightline.removeTargetPoint(“first”);
-
Set the layer to correspond to viewport visibility.
Name Type Description index
Number index. Throws:
-
DeveloperError : the index is 0~3
-