UNPKG

@arcgis/map-components

Version:
162 lines (160 loc) • 9.71 kB
/// <reference types="@arcgis/core/interfaces.d.ts" /> /// <reference types="../../index.d.ts" /> import { PublicLitElement as LitElement, JsxNode, TargetedEvent } from '@arcgis/lumina'; import { Use } from '@arcgis/lumina/controllers'; import { ArcgisReferenceElement } from '../../utils/component-utils'; import { default as AreaMeasurement3dViewModel } from './AreaMeasurement3dViewModel'; declare const useViewModel: (component: LitElement & Pick<AreaMeasurement3dViewModel, never> & import('../../controllers/useViewModel').ViewModelControllerUses<AreaMeasurement3dViewModel>) => AreaMeasurement3dViewModel; /** * The Area Measurement 3D component can be added to a [Scene](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-scene/) * component to calculate and display area and perimeter of polygons. * * [![measurement-area-3d](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/3D_AreaMeasurement_widget.png)](https://developers.arcgis.com/javascript/latest/sample-code/measurement-3d/) * * How the area and perimeter are computed depends on the scene's spatial reference and the length of the measured perimeter. * * In **geographic coordinate systems** (GCS) and in **Web Mercator**: * - If the measurement's perimeter is below 100 km, they are computed in a Euclidean manner, * in an [ECEF](https://en.wikipedia.org/wiki/ECEF) coordinate system (or equivalent on other planets). * - If the perimeter is above 100 km, they are computed geodetically, and the visualization takes * the curvature of the planet into consideration. * * In **projected coordinate systems** (PCS), apart from Web Mercator, the area and perimeter * are always calculated in a Euclidean manner (in their respective PCS). * * The area may be visualized and calculated in two ways: * 1. If all the vertices are mostly coplanar (lying on the same plane), * the measurement polygon is formed on that plane, and area and perimeter are calculated from its geometry. * 2. If the vertices don't form a planar surface, the measurement polygon * is projected to a horizontal plane, and area and perimeter are calculated from its geometry. * * ![area-measurement-3d-types](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/area-measurement-3d-types.png) * * When the component is active, a horizontal "laser" line is drawn which indicates the height at the current mouse position. * This line can help in analyzing the heights of objects relative to each other and the terrain. * * **Things to consider** * * * Area Measurement 3D is designed to work in the Scene component. For measurements in the [Map](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-map/) * component, use [Area Measurement 2D](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-area-measurement-2d/). * * Snapping is enabled by default. Holding the `CTRL` key disables it. * * Layer types currently supported for snapping are: * [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html), * [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html) (except Mesh geometries), * [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html), * [WFSLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WFSLayer.html), * [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html), * [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html), * and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html). * * **See also** * * - [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.html) * - [Sample - Measurement in 3D](https://developers.arcgis.com/javascript/latest/sample-code/measurement-3d/) * - [Sample - Analysis objects](https://developers.arcgis.com/javascript/latest/sample-code/analysis-objects/) * * [Read more...](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-area-measurement-3d/) */ export declare class ArcgisAreaMeasurement3d extends LitElement { /** * The [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-AreaMeasurementAnalysis.html) * created or modified by the component. * * When connecting the Area Measurement 3D component to the [Scene](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-scene/) * component, it automatically creates an empty analysis and adds it to the Scene's * [analyses](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-scene/#analyses) collection. * Whenever the component is destroyed, the analysis is automatically removed from the collection. * * Alternatively, a programmatically created analysis can be provided to the component. * Then, the application itself needs to add it to and later remove it from the Scene's analyses collection. * * ```js * // Create the analysis. * const areaMeasurementAnalysis = new AreaMeasurementAnalysis({ * geometry: new Polygon({ * spatialReference: { latestWkid: 3857, wkid: 102100 }, * rings: [ * [ * [-13624861.22274897, 4550346.5519295, 63.378210234455764], * [-13624935.305160372, 4550273.144585712, 63.37829629518092], * [-13624995.61798748, 4550334.030096778, 63.37819860037416], * [-13624921.53589075, 4550407.42357004, 63.3783810287714], * [-13624861.22274897, 4550346.5519295, 63.378210234455764] * ] * ] * }) * }); * // Get the Scene and measurement component and wait until they are ready. * const viewElement = document.querySelector("arcgis-scene"); * await viewElement.viewOnReady(); * const areaMeasurement3d = document.querySelector("arcgis-area-measurement-3d"); * await areaMeasurement3d.componentOnReady(); * // Add the analysis to the Scene component. * viewElement.analyses.add(areaMeasurementAnalysis); * // Connect the analysis to the measurement component: * areaMeasurement3d.analysis = areaMeasurementAnalysis; * ``` */ analysis: __esri.AreaMeasurementAnalysis; /** * If true, the component will not be destroyed automatically when it is * disconnected from the document. This is useful when you want to move the * component to a different place on the page, or temporarily hide it. If this * is set, make sure to call the [destroy](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-area-measurement-3d/#destroy) method when you are done to * prevent memory leaks. * * @default false */ autoDestroyDisabled: boolean; /** * Icon which represents the component. * Typically used when the component is controlled by another component (e.g. by the Expand component). * * @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/) * @default "measure-area" */ icon?: HTMLCalciteIconElement["icon"]; /** The component's default label. */ label?: string; /** @default "bottom-left" */ position: __esri.UIPosition; /** * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene. * * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component) */ referenceElement?: ArcgisReferenceElement | string; /** * The component's state. The values mean the following: * * * `disabled` - not ready yet * * `ready` - ready for measuring * * `measuring` - currently measuring * * `measured` - measuring has finished */ readonly state: "ready" | "disabled" | "measuring" | "measured"; /** * Unit system (imperial, metric) or specific unit used for displaying the area values. Possible values are listed in * [unitOptions](#unitOptions). */ unit: __esri.SystemOrAreaUnit; /** * List of available units and unit systems (imperial, metric) that are shown in the component's dropdown. * 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](#unit) values can only be a subset of this list. */ unitOptions: __esri.SystemOrAreaUnit[]; /** Clears the current measurement. */ clear(): Promise<void>; /** Permanently destroy the component. */ destroy(): Promise<void>; /** Starts a new measurement. */ start(): Promise<void>; /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */ readonly arcgisPropertyChange: TargetedEvent<this, { name: "state" | "analysis"; }>; /** Emitted when the component associated with a map or scene view is is ready to be interacted with. */ readonly arcgisReady: TargetedEvent<this, void>; } export {};