@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.26 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"./Analysis.js";import{equals as r}from"../core/arrayUtils.js";import o from"../core/Logger.js";import{equalsMaybe as s}from"../core/maybe.js";import{measurementAreaUnits as i}from"../core/units.js";import{property as n,subclass as l}from"../core/accessorSupport/decorators.js";import a from"../geometry/Polygon.js";let m=class extends t{constructor(e){super(e),this.type="area-measurement",this.unit=null}set geometry(e){e?(e.rings.length>1&&o.getLogger(this).warn("Measuring polygons with multiple rings is not supported."),this._set("geometry",e.clone())):this._set("geometry",null)}get valid(){const{geometry:e}=this;if(e&&e.rings.length>0){const t=e.rings[0];if(t.length>3&&r(t.at(0),t.at(-1)))return!0}return!1}clear(){this.geometry=null}equals(e){return this===e||super.equals(e)&&this.unit===e.unit&&s(this.geometry,e.geometry)}};e([n({type:["area-measurement"],readOnly:!0})],m.prototype,"type",void 0),e([n({value:null,type:a})],m.prototype,"geometry",null),e([n({type:i,value:null})],m.prototype,"unit",void 0),e([n({readOnly:!0})],m.prototype,"valid",null),m=e([l("esri.analysis.AreaMeasurementAnalysis")],m);const p=m;export{p as default};