@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
187 lines (183 loc) • 9.92 kB
TypeScript
import type AreaMeasurementAnalysis from "../../analysis/AreaMeasurementAnalysis.js";
import type Accessor from "../../core/Accessor.js";
import type SceneView from "../../views/SceneView.js";
import type { SystemOrAreaUnit } from "../../core/units.js";
import type { MeasurementMode } from "../../views/analysis/types.js";
import type { AreaMeasurementAnalysisProperties } from "../../analysis/AreaMeasurementAnalysis.js";
/** @deprecated since version 4.33. Use the [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/) or [Area Measurement 3D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/) 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 AreaMeasurement3DViewModelProperties extends Partial<Pick<AreaMeasurement3DViewModel, "view">> {
/**
* The area measurement analysis object being created or modified by the view model.
*
* If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In
* this case, the analysis will also be automatically removed from the view when the view model is destroyed.
*
* @since 4.23
* @example
* // Construct an area measurement analysis object outside of the view model
* const analysis = new AreaMeasurementAnalysis({
* geometry: {
* type: "polygon", // autocasts as new Polygon()
* rings: [
* [-73.9817, 40.7681],
* [-73.9582, 40.8005],
* [-73.9495, 40.7968],
* [-73.9730, 40.7644],
* [-73.9817, 40.7681]
* ]
* }
* });
*
* // Ensure that the analysis is added to the view
* view.analyses.add(analysis);
*
* // Frame the analysis in the view
* view.goTo(analysis.extent);
*
* // Pass the analysis object as a constructor parameter to modify it using the view model
* const viewModel = new AreaMeasurement3DViewModel({
* analysis: analysis,
* view: view
* });
*/
analysis?: AreaMeasurementAnalysisProperties;
/**
* Unit system (imperial, metric) or specific unit used for displaying the area values.
* Possible values are listed in [unitOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel/#unitOptions).
*/
unit?: SystemOrAreaUnit | null;
/**
* List of available units and unit systems (imperial, metric) for displaying the area values.
* By default, the following units are included: `metric`, `imperial`, `square-inches`, `square-feet`, `square-us-feet`, `square-yards`, `square-miles`, `square-meters`, `square-kilometers`, `acres`, `ares`, `hectares`.
* Possible [unit](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel/#unit) values can only be a subset of this list.
*/
unitOptions?: SystemOrAreaUnit[] | null;
}
/**
* Provides the logic for the [AreaMeasurement3D](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/).
*
* @deprecated since version 4.33. Use the [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/) or [Area Measurement 3D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/) 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.7
* @see [AreaMeasurement3D](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/) widget - _Deprecated since 4.33. Use the [Area Measurement 3D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/) instead._
* @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
*/
export default class AreaMeasurement3DViewModel extends Accessor {
constructor(properties?: AreaMeasurement3DViewModelProperties);
/**
* The area measurement analysis object being created or modified by the view model.
*
* If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In
* this case, the analysis will also be automatically removed from the view when the view model is destroyed.
*
* @since 4.23
* @example
* // Construct an area measurement analysis object outside of the view model
* const analysis = new AreaMeasurementAnalysis({
* geometry: {
* type: "polygon", // autocasts as new Polygon()
* rings: [
* [-73.9817, 40.7681],
* [-73.9582, 40.8005],
* [-73.9495, 40.7968],
* [-73.9730, 40.7644],
* [-73.9817, 40.7681]
* ]
* }
* });
*
* // Ensure that the analysis is added to the view
* view.analyses.add(analysis);
*
* // Frame the analysis in the view
* view.goTo(analysis.extent);
*
* // Pass the analysis object as a constructor parameter to modify it using the view model
* const viewModel = new AreaMeasurement3DViewModel({
* analysis: analysis,
* view: view
* });
*/
get analysis(): AreaMeasurementAnalysis;
set analysis(value: AreaMeasurementAnalysisProperties);
/** The current measurement of the area. */
get measurement(): Measurement | null;
/**
* The view model's state.
*
* Value | Description
* ------------|-------------
* disabled | not ready yet
* ready | ready for measuring
* measuring | currently measuring
* measured | measuring has finished
*
* @default "disabled"
*/
get state(): "disabled" | "ready" | "measuring" | "measured";
/**
* Unit system (imperial, metric) or specific unit used for displaying the area values.
* Possible values are listed in [unitOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel/#unitOptions).
*/
get unit(): SystemOrAreaUnit;
set unit(value: SystemOrAreaUnit | null | undefined);
/**
* List of available units and unit systems (imperial, metric) for displaying the area values.
* By default, the following units are included: `metric`, `imperial`, `square-inches`, `square-feet`, `square-us-feet`, `square-yards`, `square-miles`, `square-meters`, `square-kilometers`, `acres`, `ares`, `hectares`.
* Possible [unit](https://developers.arcgis.com/javascript/latest/references/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel/#unit) values can only be a subset of this list.
*/
get unitOptions(): SystemOrAreaUnit[];
set unitOptions(value: SystemOrAreaUnit[] | null | undefined);
/** The view from which the widget will operate. */
view?: SceneView | null;
/**
* Clears the current measurement.
*
* @since 4.16
*/
clear(): void;
/**
* Starts a new measurement.
*
* @since 4.16
* @example
* const areaMeasurement3DViewModel = new AreaMeasurement3DViewModel({
* view: view,
* unit: "square-meters"
* });
*
* await areaMeasurement3DViewModel.start();
*/
start(): Promise<void>;
}
/**
* Measurement value.
*
* @deprecated since version 4.33. Use the [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/) or [Area Measurement 3D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/) 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 MeasurementValue {
/** Text representation of the value to be displayed in the widget or null, if it should not be displayed. */
readonly text: string | null;
/**
* State of the measurement value controlling how the value is displayed in the widget.
*
* Value | Description
* ------------|-------------
* available | measured value is available
* unavailable | measured value is not available due an incomplete measurement
* invalid | measured value is not available due to an invalid measurement configuration (e.g. self-intersecting polygon)
*/
readonly state: "available" | "unavailable" | "invalid";
}
/** @deprecated since version 4.33. Use the [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/) or [Area Measurement 3D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-area-measurement-3d/) 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 Measurement {
/**
* Describes the mode in which the measurement is computed. In `euclidean` mode, the area and perimeter length are computed from
* a flat polygon with straight segments on the perimeter in the [ECEF](https://en.wikipedia.org/wiki/ECEF) coordinate system.
* In `geodesic` mode, the area and perimeter length are computed from a geodesic polygon on the WGS84 ellipsoid.
*/
readonly mode: MeasurementMode;
/** Area of the polygon. */
readonly area: MeasurementValue;
/** Perimeter length of the polygon. */
readonly perimeterLength: MeasurementValue;
}