// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../Color ../../core/handleUtils ../../core/memoize ../../core/reactiveUtils ../../core/SetUtils ../../core/unitUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../chunks/vec32 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../geometry/ellipsoidUtils ../../geometry/support/ray ../../layers/support/ElevationQuery ../../views/3d/support/hitTest ../../views/3d/webgl-engine/lib/Intersector ../../views/3d/webgl-engine/lib/IntersectorInterfaces ../../views/3d/webgl-engine/lib/intersectorUtilsConversions ./ElevationProfileLine".split(" "), function(d,v,C,D,w,E,F,e,c,S,T,G,H,x,I,y,J,z,K,L,M,N){function O({view:a,inputGraphicUid:b,maxIntersectionDistance:h},f){for(const g of f)if(!(null!=g.distanceInRenderSpace&&g.distanceInRenderSpace>h)&&(f=M.toGraphic(g,a),null==f||A(f)!==b))return g;return null}function A(a){if(a.layer&&"objectIdField"in a.layer){const b=a.attributes[a.layer.objectIdField];if(b)return`o-${a.layer.id}-${b}`}return`u-${a.uid}`}c=class extends N{constructor(a){super(a);this.type="view";this.color=new v("#cf4ccf");this.viewVisualizationEnabled= !0;this.exclude=this.include=null;this.numSamplesForPreview=50;this.numSamplesPerChunk=25;this._getQueryElevationDependencies=D.memoize((b,h,f,g,q,n,k)=>({inputGraphicUid:null!=b?A(b):null,visibleLayers:h,maxIntersectionDistance:f,intersectOptions:g,view:q,stationary:n,spatialReference:k}));this._vecA=x.create();this._vecB=x.create();this._ray=y.create()}get minDemResolution(){const a=this._viewModel?.view;if(null==a||"3d"!==a.type)return null;const b=a.pointsOfInterest?.focus?.worldUnitsPerContentPixel; return null==b?null:b*F.getMetersPerVerticalUnitForSR(a.spatialReference)}get queryElevationDependencies(){const a=this._view;return a?this._getQueryElevationDependencies(this._viewModel?.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,a,a.stationary,a.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter(a=>a.visible).toArray()??[]}get _intersectOptions(){var a=this._view;if(null==a||a.destroyed)return{};const b=z.externalToInternalIntersectOptions(a, {include:this.include,exclude:this.exclude});a=z.externalToInternalIntersectOptions(a,{exclude:this._pointCloudLayers});b.exclude=E.union(b.exclude,a.exclude);return b}get _pointCloudLayers(){const a=this._view;return null==a?[]:a.allLayerViews.toArray().filter(b=>"point-cloud"===b.layer?.type).map(b=>b.layer)}get _view(){const a=this._viewModel?.view;return null!=a&&"3d"===a.type?a:null}get _maxIntersectionDistance(){const a=this._view;return a?.renderCoordsHelper?I.getReferenceEllipsoid(a.spatialReference).radius/ a.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){var a=this._view;if(null==a)return null;a=K.newIntersector(a.state.viewingMode);const b=a.options;b.hud=!1;b.invisibleTerrain=!1;b.backfacesTerrain=!1;b.selectionMode=!1;b.store=L.StoreResults.ALL;return a}async queryElevation(a,{noDataValue:b,signal:h}){const f=this.queryElevationDependencies;if(null==f)throw Error("ElevationProfileLineInput: no dependencies");const g=this._intersector;if(null==g)throw Error("ElevationProfileLineInput: no view"); const {intersectOptions:q,view:n,spatialReference:k}=f,r=n.renderCoordsHelper,P=n.sceneIntersectionHelper,B=this._vecA,p=this._vecA,l=this._vecB,Q=this._ray;if(!k)return{geometry:a,noDataValue:b};h=await J.GeometryDescriptor.fromGeometry(a).project(k,h);if(!h)return{geometry:a,noDataValue:b};a=h.coordinates;const R=a.length;for(let t=0;tthis._onChange();return C.handlesGroup([super.attach(a),w.watch(()=>this.queryElevationDependencies,b),w.on(()=>a.elevationProvider,"elevation-change",b,{onListenerAdd:b,onListenerRemove:b})])}};d.__decorate([e.property({type:v,nonNullable:!0})],c.prototype,"color",void 0);d.__decorate([e.property()],c.prototype,"viewVisualizationEnabled",void 0);d.__decorate([e.property()], c.prototype,"include",void 0);d.__decorate([e.property()],c.prototype,"exclude",void 0);d.__decorate([e.property({readOnly:!0})],c.prototype,"minDemResolution",null);d.__decorate([e.property()],c.prototype,"queryElevationDependencies",null);d.__decorate([e.property()],c.prototype,"_visibleLayers",null);d.__decorate([e.property()],c.prototype,"_intersectOptions",null);d.__decorate([e.property()],c.prototype,"_pointCloudLayers",null);d.__decorate([e.property()],c.prototype,"_view",null);d.__decorate([e.property()], c.prototype,"_maxIntersectionDistance",null);d.__decorate([e.property()],c.prototype,"_intersector",null);return c=d.__decorate([G.subclass("esri.widgets.ElevationProfile.ElevationProfileLineView")],c)});