AreaMeasurementAnalysis.js 1.4 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as e}from"../chunks/tslib.es6.js";import r from"./Analysis.js";import{equals as t}from"../core/arrayUtils.js";import o from"../core/Logger.js";import{isNone as s,isSome as i}from"../core/maybe.js";import{measurementAreaUnits as n}from"../core/unitUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Polygon.js";let a=class extends r{constructor(e){super(e),this.type="area-measurement",this.unit=null}set geometry(e){s(e)?this._set("geometry",null):(e.rings.length>1&&o.getLogger(this.declaredClass).warn("Measuring polygons with multiple rings is not supported."),this._set("geometry",e.clone()))}get requiredPropertiesForEditing(){if(i(this.geometry)&&1===this.geometry.rings.length){const e=this.geometry.rings[0];if(e.length<=2||!t(e[0],e[e.length-1]))return[null]}return[this.geometry]}clear(){this.geometry=null}};e([l({type:["area-measurement"]})],a.prototype,"type",void 0),e([l({value:null,type:m})],a.prototype,"geometry",null),e([l({type:n,value:null})],a.prototype,"unit",void 0),e([l({readOnly:!0})],a.prototype,"requiredPropertiesForEditing",null),a=e([p("esri.analysis.AreaMeasurementAnalysis")],a);const u=a;export{u as default};