/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../../chunks/_rollupPluginBabelHelpers","../../../../../chunks/tslib.es6","../../../../../core/Accessor","../../../../../core/reactiveUtils","../../../../../core/accessorSupport/decorators/property","../../../../../core/arrayUtils","../../../../../core/has","../../../../../core/accessorSupport/ensureType","../../../../../core/accessorSupport/decorators/subclass","../../../../../geometry/projection","../../../../../geometry/projectionEllipsoid","./MeasurementData","../../support/UnitNormalizer"],(function(e,t,r,a,o,s,n,i,l,c,u,p,h,m){"use strict";e.AreaMeasurementController=function(e){function r(t){return e.call(this,t)||this}t._inheritsLoose(r,e);var a=r.prototype;return a.initialize=function(){const{spatialReference:e}=this.view,t=p.getSphericalPCPF(e),r=t===p.SphericalECEFSpatialReference?p.WGS84ECEFSpatialReference:t,a=!e||u.canProjectWithoutEngine(e,r)?r:e,s=new m.UnitNormalizer(a);this._measurementDataManager=new h.MeasurementDataManager(this.view,s),this.own([this.analysisViewData.path.on("change",(()=>this._update())),o.watch((()=>this.analysisViewData.cursorPoint),(()=>this._update()),o.sync),o.watch((()=>this.analysisViewData.mode),(()=>this._update()),o.sync)]),this._update()},a._update=function(e=!1){const{analysisViewData:t,view:r}=this,a={maxRelativeErrorCoplanar:.005,maxRelativeErrorAlmostCoplanar:.01,verticalAngleThreshold:80};this._measurementDataManager.update(t.path,t.cursorPoint,r,t.validMeasurement,a,t.mode,e)&&(t.measurementData=this._measurementDataManager.getData())},r}(a),r.__decorate([s.property({constructOnly:!0})],e.AreaMeasurementController.prototype,"view",void 0),r.__decorate([s.property({constructOnly:!0})],e.AreaMeasurementController.prototype,"analysis",void 0),r.__decorate([s.property({constructOnly:!0})],e.AreaMeasurementController.prototype,"analysisViewData",void 0),e.AreaMeasurementController=r.__decorate([c.subclass("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementController")],e.AreaMeasurementController),Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
