UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 837 B
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{createEuclideanPlanarAreaCache as e,euclideanHorizontalPlanarArea as r,euclideanPlanarArea as t}from"./euclideanAreaMeasurementUtils.js";import{MeasurementWorkerHandle as n}from"./MeasurementWorkerHandle.js";const o=n=>({async autoAreaByElevationMode(o,a,i=e(),s){if("on-the-ground"===a){if(u(o.spatialReference)){const{area:e}=await n(o,{unit:"square-meters",curveType:"geodesic"},s);return e}return r(o,i)}return t(o,i)},async autoArea2D(r,t=e(),n){return this.autoAreaByElevationMode(r,"on-the-ground",t,n)}});let a=null;async function i(){if(!a){const e=new n;e.preloadGeodetic(),a=o(e.geodeticArea.bind(e))}return a}function u(e){const{isGeographic:r,isWebMercator:t}=e;return r||t}export{i as loadAutomaticAreaMeasurementUtils,u as useGeodesicAreaMeasurement};