UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.95 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{I3SSnappingSource as a}from"./I3SSnappingSource.js";let c=class extends r{get updating(){return this._i3sSources.some((e=>e.updating))}constructor(e){super(e),this.availability=1,this._i3sSources=[]}destroy(){this._i3sSources.forEach((e=>e.destroy())),this._i3sSources.length=0}initialize(){const{view:e}=this,r=this.layerSource.layer;this._i3sSources="building-scene"===r.type?this._getBuildingSceneI3SSources(e,r):[this._getSceneLayerI3SSource(e,r)]}async fetchCandidates(e,r){const t=await Promise.all(this._i3sSources.map((t=>t.fetchCandidates(e,r))));return s(r),t.flat()}refresh(){this._i3sSources.forEach((e=>e.refresh()))}_getBuildingSceneI3SSources(e,r){return r.allSublayers.toArray().map((t=>"building-component"===t.type?new a({getLayerView:async()=>(await e.whenLayerView(r)).whenSublayerView(t),view:e}):null)).filter(t)}_getSceneLayerI3SSource(e,r){return new a({getLayerView:async()=>{const t=await e.whenLayerView(r);return"scene-layer-graphics-3d"===t.type?void 0:t},view:e})}};e([i({constructOnly:!0})],c.prototype,"layerSource",void 0),e([i({constructOnly:!0})],c.prototype,"view",void 0),e([i({readOnly:!0})],c.prototype,"updating",null),e([i({readOnly:!0})],c.prototype,"availability",void 0),c=e([o("esri.views.interactive.snapping.featureSources.SceneLayerSnappingSource")],c);export{c as SceneLayerSnappingSource};