/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import o from"./Analysis.js";import t from"./ElevationProfile/ElevationProfileDisplayUnits.js";import i from"./ElevationProfile/ElevationProfileLineGround.js";import{ElevationProfileLineCollection as r}from"./ElevationProfile/elevationProfileLineTypes.js";import s from"./ElevationProfile/ElevationProfileViewOptions.js";import{equals as l}from"../core/arrayUtils.js";import n from"../core/Collection.js";import{referenceSetter as a}from"../core/collectionUtils.js";import p from"../core/Logger.js";import{equalsMaybe as f}from"../core/maybe.js";import{property as m,subclass as y}from"../core/accessorSupport/decorators.js";import v from"../geometry/Polyline.js";import{geometryEquals as h}from"../layers/graphics/dehydratedFeatureComparison.js";import{getGraphicEffectiveElevationInfo as u}from"../support/elevationInfoUtils.js";import g from"../symbols/support/ElevationInfo.js";import{isValidInputPath as c}from"../views/analysis/ElevationProfile/elevationProfileGeometryUtils.js";let d=class extends o{constructor(e){super(e),this.type="elevation-profile",this.geometry=null,this.displayUnits=new t,this.viewOptions=new s,e?.profiles||(this.profiles=new n([new i]))}initialize(){const e=e=>!e?.declaredClass?.startsWith("esri.widgets.ElevationProfile")||(p.getLogger(this).errorOnce("Classes from the 'esri/widgets/ElevationProfile' namespace are meant for use with the Elevation Profile widget and are not supported in the 'profiles' collection of the ElevationProfileAnalysis. Use classes from 'esri/analysis/ElevationProfile' instead."),!1);this.profiles.on("before-changes",o=>{e(o.item)||o.preventDefault()});for(const o of Array.from(this.profiles))e(o)||this.profiles.remove(o)}get elevationInfo(){return this._get("elevationInfo")}set elevationInfo(e){this._set("elevationInfo",e)}get profiles(){return this._get("profiles")}set profiles(e){const o=this._get("profiles"),t=e??new n;this._set("profiles",a(t,o))}get valid(){return c(this.geometry)}equals(e){return this===e||super.equals(e)&&h(this.geometry,e.geometry)&&f(this.elevationInfo,e.elevationInfo)&&l(this.profiles.toArray(),e.profiles.toArray(),(e,o)=>e.equals(o))&&this.displayUnits.equals(e.displayUnits)&&this.viewOptions.equals(e.viewOptions)}clear(){this.geometry=null,this.elevationInfo=null}setGeometryFromFeature(e){e.geometry&&"polyline"===e.geometry.type?(this.geometry=e.geometry,this.elevationInfo=new g({...u(e)})):p.getLogger(this).errorOnce("The feature's geometry must be a polyline to set it as the geometry of the ElevationProfileAnalysis.")}};e([m({type:["elevation-profile"]})],d.prototype,"type",void 0),e([m({type:v})],d.prototype,"geometry",void 0),e([m({type:g})],d.prototype,"elevationInfo",null),e([m({type:r,nonNullable:!0})],d.prototype,"profiles",null),e([m({type:t,nonNullable:!0})],d.prototype,"displayUnits",void 0),e([m()],d.prototype,"valid",null),e([m({type:s,nonNullable:!0})],d.prototype,"viewOptions",void 0),d=e([y("esri.analysis.ElevationProfileAnalysis")],d);const P=d;export{P as default};
