UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

86 lines (85 loc) 4.76 kB
import type ShadowCastAnalysis from "../../../analysis/ShadowCastAnalysis.js"; import type AnalysisView3D from "./AnalysisView3D.js"; import type { ScreenPoint } from "../../../core/types.js"; /** * Represents the analysis view of a [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/) after it has been added to * [SceneView.analyses](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#analyses). * * The ShadowCastAnalysisView3D is responsible for rendering a [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/) * using custom visualizations. The [methods](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ShadowCastAnalysisView3D/#getDurationAtScreen) * on the analysis view provide developers with the ability to obtain the specific shadow duration at the certain * [point](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenPoint) on the screen or to [disable](#interactive) the shadow tooltip attached to the cursor. * * 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 ShadowCastAnalysis(); * view.analyses.add(analysis); // add to the scene view * const analysisView = await view.whenAnalysisView(analysis); * ``` * * @since 5.0 * @see [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/) * @see [DiscreteOptions](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCast/DiscreteOptions/) * @see [MinDurationOptions](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCast/MinDurationOptions/) * @see [TotalDurationOptions](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCast/TotalDurationOptions/) * @see [Sample - Shadow Cast analysis object](https://developers.arcgis.com/javascript/latest/sample-code/analysis-shadow-cast/) * @see [Sample - Analysis objects](https://developers.arcgis.com/javascript/latest/sample-code/analysis-objects/) * @see [Shadow Cast component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-shadow-cast/) */ export default abstract class ShadowCastAnalysisView3D extends AnalysisView3D { /** * The shadow cast analysis associated with the analysis view. * * @since 5.0 */ get analysis(): ShadowCastAnalysis; /** * Displays the shadow tooltip attached to the cursor. Set to `false` to disable it. * * @default true * @since 5.0 */ accessor interactive: boolean; /** * The analysis view type. * * @since 5.0 */ get type(): "shadow-cast-view-3d"; /** * Whether the analysis is currently being updated. * * @since 5.0 */ get updating(): boolean; /** * When `true`, the [analysis](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ShadowCastAnalysisView3D/#analysis) is visualized in the view. * * Only one [ShadowCastAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ShadowCastAnalysis/) at a time can be visible in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * When a shadow cast analysis is made visible by setting this property to `true`, all other shadow cast analysis * views are automatically hidden. * * @since 5.0 */ accessor visible: boolean; /** * Returns the time (in milliseconds) spent in shadow for a certain point on the screen. * * @param point - The point on the screen for which shadow cast is calculated. * @returns A promise that resolves to the duration (in milliseconds) spent in shadow for the given screen point. * @since 5.0 * @example * // use getDurationAtScreen method from the analysis view once available * const analysisView = await view.whenAnalysisView(shadowCastAnalysis); * * // get shadow duration at the pointer location * view.on("pointer-move", async (event) => { * // duration in milliseconds * const duration = await analysisView.getDurationAtScreen({ x: event.x, y: event.y }); * // ... do something with the duration * }); */ getDurationAtScreen(point: ScreenPoint): Promise<number>; }