LineOfSightAnalysisView3D

ESM: import LineOfSightAnalysisView3D from "@arcgis/core/views/3d/analysis/LineOfSightAnalysisView3D.js";
CDN: const LineOfSightAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/LineOfSightAnalysisView3D.js");
Class: @arcgis/core/views/3d/analysis/LineOfSightAnalysisView3D

Represents the analysis view of a LineOfSightAnalysis after it has been added to SceneView.analyses.

The LineOfSightAnalysisView3D is responsible for rendering a LineOfSightAnalysis using custom visualizations.

It allows to create an observer and/or targets interactively using the place() method, query analysis results, or make an existing analysis editable by enabling the interactive property.

The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.

// retrieve analysis view for analysis
const analysis = new LineOfSightAnalysis();
sceneView.analyses.add(analysis); // add to the view
const analysisView = await view.whenAnalysisView(analysis);
See also

Property Overview

Name Type Summary Class

The line of sight analysis object associated with the analysis view.

LineOfSightAnalysisView3D

Enables interactivity for the associated analysis.

LineOfSightAnalysisView3D

Analysis results for each target.

LineOfSightAnalysisView3D

The analysis view type.

LineOfSightAnalysisView3D

When true, the analysis is visualized in the view.

LineOfSightAnalysisView3D

Property Details

analysis

Property
analysis LineOfSightAnalysisreadonly

The line of sight analysis object associated with the analysis view.

interactive

Property
interactive Boolean

Enables interactivity for the associated analysis. When set to true, manipulators will be displayed, allowing users to click and drag to edit the analysis if it has a valid observer and targets. Right-clicking a target will remove it.

This property is automatically set to true when the analysis is assigned to a Line Of Sight component.

Default Value:false

results

Property
results Collection<(LineOfSightAnalysisResult|null|undefined)>readonly

Analysis results for each target.

The order of results matches the order of targets, so if the index of the target is known the collection can be indexed directly:

const analysisView = await view.whenAnalysisView(lineOfSightAnalysis);
const result = analysisView.results.at(targetIdx);

Given a target object, the results collection can also be searched:

const result = analysisView.results.find((result) => result.target === targetObject);

type

Property
type Stringreadonly

The analysis view type.

For LineOfSightAnalysisView3D the type is always "line-of-sight-view-3d".

visible

Property
visible Boolean

When true, the analysis is visualized in the view.

Method Overview

Name Return Type Summary Class

Starts the interactive placement of an observer and/or targets on the analysis.

LineOfSightAnalysisView3D

Method Details

place

Method
place(options){Promise<LineOfSightPlacementResult>}

Starts the interactive placement of an observer and/or targets on the analysis.

If the analysis does not have a valid observer yet, this method will allow placing an observer, which can be followed by zero or more targets. Otherwise, if it already has a valid observer, it will allow placing targets.

The placement operation will finish when the user presses the escape key. To stop the placing programmatically, pass an abort signal as an argument when calling the method. The promise resolves when the operation is productive, i.e. an oberver or any targets were added. Otherwise, if nothing was added or signal was aborted, the promise is rejected.

Calling this method sets interactive to true.

Parameters
optional

An object specifying additional options.

Specification
optional

Abort signal which can be used to stop or cancel the operation.

Returns
Type Description
Promise<LineOfSightPlacementResult> A promise which resolves when the operation is completed successfully - i.e. the user places an observer and/or target(s), leaving the analysis in a valid state. Otherwise, the promise is rejected.
Example
const abortController = new AbortController();

try {
  await analysisView.place({ signal: abortController.signal });
} catch (error) {
  if (error.name === "AbortError") {
    console.log("Placement operation was cancelled.");
  }
}

// cancel the placement operation at some later point
abortController.abort();

Type Definitions

LineOfSightPlacementResult

Type Definition
LineOfSightPlacementResult

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.