import { Watchable } from 'apprt-core/Types'; import Polyline from '@arcgis/core/geometry/Polyline'; import Polygon from '@arcgis/core/geometry/Polygon'; import { SystemOrAreaUnit, SystemOrLengthUnit } from '@arcgis/core/core/units'; /** * Measurement mode. * - `off`: No measurement is active. * - `area`: Area measurement is active. * - `distance`: Distance measurement is active. */ type Measurement2DMode = "off" | "area" | "distance"; /** * Measurement state. * - `disabled`: Measurement is disabled (corresponds to `off` mode). * - `ready`: Measurement is ready to start. * - `measuring`: Measurement is in progress. * - `measured`: Measurement is finished. */ type Measurement2DState = "disabled" | "ready" | "measuring" | "measured"; /** * {@link Watchable} properties of {@link Measurement2DModel}. */ interface Measurement2DModelProperties { /** * Measurement mode. */ readonly mode: Measurement2DMode; /** * Measurement state. */ readonly state: Measurement2DState; /** * Measurement unit is either unit system (metric, imperial) or a specific unit. * Available if the {@link mode} is set to `area` or `distance`. */ readonly unit: SystemOrAreaUnit | SystemOrLengthUnit; /** * Locale specific representation of the length including the unit. * Available if the {@link mode} is set to `distance`. */ readonly distance: string; /** * Locale specific representation of the area including the unit. * Available if the {@link mode} is set to `area`. */ readonly area: string; /** * Locale specific representation of the perimeter including the unit. * Available if the {@link mode} is set to `area`. */ readonly perimeter: string; /** * The measurement geometry. * Available if the {@link mode} is set to `area` or `distance`. * If mode is `area`, the geometry is a polygon. * If mode is `distance`, the geometry is a polyline. */ readonly geometry: Polyline | Polygon; /** * Distance always in meters. * Available if the {@link mode} is set to `distance`. */ readonly rawDistance: number; /** * Area always in square meter. * Available if the {@link mode} is set to `area`. */ readonly rawArea: number; /** * Perimeter always in meters. * Available if the {@link mode} is set to `area`. */ readonly rawPerimeter: number; } /** * A model, providing access to the current measurement state. * It is available as service `measurement-2d.Model`. * * See {@link Measurement2DModelProperties} for documentation of class members. */ interface Measurement2DModel extends Measurement2DModelProperties, Watchable { } export type { Measurement2DMode, Measurement2DModel, Measurement2DModelProperties, Measurement2DState };