import type Viewshed from "../../../analysis/Viewshed.js"; import type ViewshedAnalysis from "../../../analysis/ViewshedAnalysis.js"; import type AnalysisView3D from "./AnalysisView3D.js"; import type { ViewshedPlacementOptions, ViewshedPlacementResult } from "./Viewshed/types.js"; /** * Represents the analysis view of a [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) * after it has been added to [SceneView.analyses](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#analyses). * * The ViewshedAnalysisView3D is responsible for rendering a [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) * using custom visualizations. * * It allows to create new viewsheds interactively using the [place()](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#place) method, * or to make existing viewsheds selectable and editable by enabling the [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) property. * To select a viewshed, hover and click on its observer. * * The view for an analysis can be retrieved using [SceneView.whenAnalysisView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenAnalysisView) * similar to how layer views are retrieved for layers using [SceneView.whenLayerView()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#whenLayerView). * * ```js * // create new analysis and add it to the view * const analysis = new ViewshedAnalysis(); * view.analyses.add(analysis); * * // retrieve analysis view * const analysisView = await view.whenAnalysisView(analysis); * ``` * * > [!WARNING] * > * > **Things to consider:** * > * Snapping, tooltips, display units, and input units used during interactive placement and editing are inherited from * [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/). * > * Snapping is enabled by default. This can be temporarily disabled by holding the `CTRL` key. * > * Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) (except Mesh geometries), * > [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/), * > [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/). * * @since 4.30 * @see [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) * @see [Viewshed](https://developers.arcgis.com/javascript/latest/references/core/analysis/Viewshed/) * @see [ViewshedLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/) * @see [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/) * @see [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/) * @see [Sample - Interactive viewshed analysis](https://developers.arcgis.com/javascript/latest/sample-code/analysis-viewshed/) * @see [Sample - Analysis objects](https://developers.arcgis.com/javascript/latest/sample-code/analysis-objects/) * @see [3D viewshed overview](https://developers.arcgis.com/documentation/spatial-analysis-services/3d-visual/3d-viewshed/) * @see [Async cancellation with AbortController](https://developers.arcgis.com/javascript/latest/async-cancellation-with-abortcontroller/) */ export default abstract class ViewshedAnalysisView3D extends AnalysisView3D { /** The viewshed analysis object associated with the analysis view. */ get analysis(): ViewshedAnalysis; /** * Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis). * When set to `true` and the analysis includes any valid [ViewshedAnalysis.viewsheds](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/#viewsheds), * they become selectable and editable. * * Viewsheds can be removed with the `Delete` key. * * @default false */ accessor interactive: boolean; /** * The viewshed currently selected for interactive editing. * * When [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) is `true`, any viewshed in the * [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis) can be selected * and its properties can be edited by interacting with the manipulators in the view. */ accessor selectedViewshed: Viewshed | null | undefined; /** The analysis view type. */ get type(): "viewshed-view-3d"; /** When `true`, the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis) is visualized in the view. */ get visible(): boolean; set visible(value: boolean | null | undefined); /** * Starts the interactive creation of new viewsheds and adds them to the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis). * * The first click in the scene places the observer point and the second sets the viewshed's orientation and distance. * * The creation process will finish when the user double-clicks the mouse or presses the escape key. * To stop the creation programmatically, pass an abort signal as an argument when calling the method. * * This method is similar to the [place()](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#place) method, but it allows to create multiple viewsheds in a row. * * By default, the observer is created at absolute height. * Optionally, by specifying the options of the method, * you can change the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/). * * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) to `true`. * * @param options - An object specifying additional placement options, including elevation information and an abort signal. * @returns A promise which resolves when creation is completed successfully or rejected if it is * canceled. * @example * const abortController = new AbortController(); * * try { * await analysisView.createViewsheds({ * signal: abortController.signal, * // optional elevation info * elevationInfo: { mode: "relative-to-ground", offset: 1.5 }, * }); * } catch (error) { * if (error.name === "AbortError") { * console.log("Creation operation was cancelled."); * } * } * * // cancel the creation operation at some later point * abortController.abort(); */ createViewsheds(options?: ViewshedPlacementOptions | null | undefined): Promise; /** * Starts the interactive placement of a single viewshed, adding it to the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#analysis). * * The first click in the scene places the observer point and the second sets the viewshed's orientation and distance. * * 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. * * By default, the observer is created at absolute height. * Optionally, by specifying the options of the method, * you can change the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/). * * Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/#interactive) to `true`. * * @param options - An object specifying additional options. * @returns A promise which * resolves when the operation is completed successfully or rejected if it is canceled. * @since 4.33 * @example * const abortController = new AbortController(); * * try { * await analysisView.place({ * signal: abortController.signal, * // optional elevation info * elevationInfo: { mode: "relative-to-ground", offset: 1.5 }, * }); * } catch (error) { * if (error.name === "AbortError") { * console.log("Placement operation was cancelled."); * } * } * * // cancel the placement operation at some later point * abortController.abort(); */ place(options?: ViewshedPlacementOptions | null | undefined): Promise; }