UNPKG

@arcgis/core

Version:

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

163 lines (161 loc) • 11.4 kB
import type Graphic from "../../Graphic.js"; import type Accessor from "../../core/Accessor.js"; import type Collection from "../../core/Collection.js"; import type { ReadonlyArrayOrCollection } from "../../core/Collection.js"; import type { SystemOrLengthUnit } from "../../core/units.js"; import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js"; import type { InteractionStartOptions, ElevationProfileLineUnion, EffectiveUnits, ElevationProfileState } from "./types.js"; import type { GraphicProperties } from "../../Graphic.js"; import type { ElevationProfileLineViewProperties } from "./ElevationProfileLineView.js"; import type { ElevationProfileLineQueryProperties } from "./ElevationProfileLineQuery.js"; import type { ElevationProfileLineInputProperties } from "./ElevationProfileLineInput.js"; import type { ElevationProfileLineGroundProperties } from "./ElevationProfileLineGround.js"; /** @deprecated since version 5.0. Use the [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfileAnalysis/) or [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-elevation-profile/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */ export interface ElevationProfileViewModelProperties extends Partial<Pick<ElevationProfileViewModel, "highlightEnabled" | "hoveredChartPosition" | "uniformChartScaling" | "unit" | "unitOptions" | "view">> { /** * The input path along which elevation will be queried in order to generate an elevation profile. * * Typically not set when creating the widget. In this case the widget starts empty, * and waits for the user to either draw a new profile or generate a profile from selecting a line feature. * The result of this action populates `input`. * `input` can be set when constructing the widget, or set or changed at runtime. * The input graphic must contain a geometry of type [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/). * Symbol and attributes of the input graphic are ignored. */ input?: GraphicProperties | null; /** * Collection of elevation profile lines which are to be generated and displayed in the widget's * chart. See the different profile line types for details on usage and behavior. * * Once an elevation profile is generated, each line will contain the raw data used to * generate the chart and statistics. * The order of the profiles within the collection determines the drawing order on the chart. * * In a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) [ElevationProfileLineView](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineView/) * is not supported. */ profiles?: ReadonlyArrayOrCollection<((ElevationProfileLineGroundProperties & { type: "ground" }) | (ElevationProfileLineInputProperties & { type: "input" }) | (ElevationProfileLineQueryProperties & { type: "query" }) | (ElevationProfileLineViewProperties & { type: "view" }))> | null; } /** * Provides the logic for the [ElevationProfile](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/) widget. * * How distance values are computed depends on the map's spatial reference: * * In geographic coordinate systems (GCS) and in Web Mercator, distances are computed geodetically. * * In projected coordinate systems (PCS), apart from Web Mercator, distances are computed in a Euclidean manner (in their respective PCS). * * @deprecated since version 5.0. Use the [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfileAnalysis/) or [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-elevation-profile/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). * @since 4.18 * @see [ElevationProfile](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/) widget - Deprecated since 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-elevation-profile/) instead. * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern) * @see [ElevationProfileLineGround](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineGround/) - Deprecated since 5.0. Use [ElevationProfileLineGround](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfile/ElevationProfileLineGround/) instead. * @see [ElevationProfileLineInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineInput/) - Deprecated since 5.0. Use [ElevationProfileLineInput](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfile/ElevationProfileLineInput/) instead. * @see [ElevationProfileLineQuery](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineQuery/) - Deprecated since 5.0. Use [ElevationProfileLineQuery](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfile/ElevationProfileLineQuery/) instead. * @see [ElevationProfileLineView](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineView/) - Deprecated since 5.0. Use [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/references/core/analysis/ElevationProfile/ElevationProfileLineScene/) instead. */ export default class ElevationProfileViewModel extends Accessor { constructor(properties?: ElevationProfileViewModelProperties); /** * Units which have been selected according to the magnitude of the elevations and distances * that are to be displayed in the widget, according to the selected unit or unit system. */ get effectiveUnits(): EffectiveUnits; /** * Whether the graphic used as [ElevationProfile.input](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/#input) * is highlighted. The highlight color and opacity can be changed in * [SceneView.highlights](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#highlights). * * @default true * @since 4.20 */ accessor highlightEnabled: boolean; /** * The position, in the range [0, 1], being hovered in the graph. We'll use * this to determine which samples are being hovered and mark their position * in the view. */ accessor hoveredChartPosition: number | null | undefined; /** * The input path along which elevation will be queried in order to generate an elevation profile. * * Typically not set when creating the widget. In this case the widget starts empty, * and waits for the user to either draw a new profile or generate a profile from selecting a line feature. * The result of this action populates `input`. * `input` can be set when constructing the widget, or set or changed at runtime. * The input graphic must contain a geometry of type [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/). * Symbol and attributes of the input graphic are ignored. */ get input(): Graphic | null | undefined; set input(value: GraphicProperties | null | undefined); /** * Collection of elevation profile lines which are to be generated and displayed in the widget's * chart. See the different profile line types for details on usage and behavior. * * Once an elevation profile is generated, each line will contain the raw data used to * generate the chart and statistics. * The order of the profiles within the collection determines the drawing order on the chart. * * In a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) [ElevationProfileLineView](https://developers.arcgis.com/javascript/latest/references/core/widgets/ElevationProfile/ElevationProfileLineView/) * is not supported. */ get profiles(): Collection<ElevationProfileLineUnion>; set profiles(value: ReadonlyArrayOrCollection<((ElevationProfileLineGroundProperties & { type: "ground" }) | (ElevationProfileLineInputProperties & { type: "input" }) | (ElevationProfileLineQueryProperties & { type: "query" }) | (ElevationProfileLineViewProperties & { type: "view" }))> | null); /** The progress, between 0 and 1 of generating all the configured elevation profiles. */ get progress(): number; /** * The current state of the view model that can be used for rendering the UI * of the widget. * * Value | Description * ------------|------------- * disabled | widget is being created * ready | widget is ready. No path configured and no interactive operation ongoing. * creating | user is creating a new input path. * created | input path is configured but no interactive operation is ongoing. * selecting | user is selecting an existing input path. * selected | user selected an existing input path. * * @default "disabled" */ get state(): ElevationProfileState; /** * Whether the chart should use a uniform scale for the X and Y axes. When a * uniform scale is applied, the X axis will display the same distance units * per pixel as the elevation units per pixel displayed in the Y axis. * * @default false * @since 4.20 */ accessor uniformChartScaling: boolean; /** Unit system (imperial, metric) or specific unit used for displaying the elevation and distance values. */ accessor unit: SystemOrLengthUnit; /** List of available units and unit systems (imperial, metric) for displaying the elevation and distance values. */ accessor unitOptions: SystemOrLengthUnit[]; /** A reference to the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). */ accessor view: MapViewOrSceneView | null | undefined; /** * Stops a creation/selection operation and restores the previously configured * input path. */ cancel(): void; /** Clears the existing profile and stops any interaction. */ clear(): void; /** * If mode is "sketch" (the default), switches to the "creating" state in * which the user can draw a new line. If the mode is "select", switches to * the "selecting" state and lets the user click on the view to select an * existing line. * * If any line is present, when the first point is drawn or an existing line * is selected, the previous input is discarded. * * @param options - Start options. */ start(options?: InteractionStartOptions): void; /** * Stops a creation/selection operation. * If the current operation is a "sketch" and the input has at least two * committed points (not being dragged), the input is kept. Otherwise * the input is set to null. */ stop(): void; }