@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
99 lines (98 loc) • 7.17 kB
TypeScript
import type VolumeMeasurementAnalysis from "../../../analysis/VolumeMeasurementAnalysis.js";
import type AnalysisView3D from "./AnalysisView3D.js";
import type VolumeMeasurementError from "./VolumeMeasurement/VolumeMeasurementError.js";
import type VolumeMeasurementResult from "./VolumeMeasurement/VolumeMeasurementResult.js";
import type { AbortOptions } from "../../../core/promiseUtils.js";
import type { VolumeMeasurementPlacementResult } from "./VolumeMeasurement/types.js";
/**
* Represents the analysis view of a [VolumeMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/)
* after it has been added to [SceneView.analyses](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#analyses).
*
* The VolumeMeasurementAnalysisView3D is responsible for rendering a [VolumeMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/)
* using custom visualizations. The properties
* on the analysis view provide developers with the ability to query measured results. If the result is unavailable,
* the [error](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#error) property provides the details on the cause.
*
* 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
* // retrieve analysis view for analysis
* const analysis = new VolumeMeasurementAnalysis();
* view.analyses.add(analysis); // add to the scene view
* const analysisView = await view.whenAnalysisView(analysis);
* ```
*
* > [!WARNING]
* >
* > **Things to consider:**
* >
* > - When using the "cut-fill" [VolumeMeasurementAnalysis.measureType](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/#measureType) in [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#interactive) mode, hover over the shift manipulator, press `Tab` to activate the tooltip input mode, and enter the elevation of the target surface.
* > - 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/).
*
* @beta
* @since 4.34
* @see [VolumeMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/)
* @see [VolumeMeasurementResult](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult/)
* @see [VolumeMeasurementError](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurement/VolumeMeasurementError/)
* @see [Async cancellation with AbortController](https://developers.arcgis.com/javascript/latest/async-cancellation-with-abortcontroller/)
* @see [Sample - Volume measurement analysis object](https://developers.arcgis.com/javascript/latest/sample-code/analysis-volume-measurement/)
*/
export default abstract class VolumeMeasurementAnalysisView3D extends AnalysisView3D {
/** The volume measurement analysis object associated with the analysis view. */
get analysis(): VolumeMeasurementAnalysis;
/**
* Error encountered while calculating the analysis result. The error has well defined names that can be used
* to provide specific error feedback to the user. See [VolumeMeasurementError](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurement/VolumeMeasurementError/)
* for the list of possible error names.
*/
get error(): VolumeMeasurementError | null | undefined;
/**
* Enables interactivity for the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#analysis).
* When set to `true` the input geometry can be edited interactively.
*
* @default false
*/
accessor interactive: boolean;
/**
* Result of the volume measurement. Results are calculated asynchronously and should be
* watched for changes.
*/
get result(): VolumeMeasurementResult | null | undefined;
/** The analysis view type. */
get type(): "volume-measurement-view-3d";
/** When `true`, the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#analysis) is visualized in the view. */
get visible(): boolean;
set visible(value: boolean | null | undefined);
/**
* Starts the interactive placement of a new polygon for the volume measurement analysis.
*
* If the analysis does not have a [VolumeMeasurementAnalysis.geometry](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/#geometry) yet, the method
* allows drawing it interactively in the view. Otherwise, clicking in the view will remove the previous geometry and
* start a new placement operation.
*
* 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.
*
* Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#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.34
* @example
* // cancel the placement operation at some later point
* // by calling abortController.abort()
* const abortController = new AbortController();
*
* try {
* await analysisView.place({ signal: abortController.signal });
* } catch (error) {
* if (error.name === "AbortError") {
* console.log("Placement operation was cancelled.");
* }
* }
*/
place(options?: AbortOptions | null | undefined): Promise<VolumeMeasurementPlacementResult>;
}