UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.57 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{destroyHandle as t}from"../../../../core/handleUtils.js";import{removeMaybe as o,abortMaybe as s}from"../../../../core/maybe.js";import{isAborted as i}from"../../../../core/promiseUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{EdgeWorkerHandle as c}from"../../../3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js";import{SceneLayerSnappingSourceWorkerHandle as l}from"./sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js";let p=class extends r{get updating(){return this._updatingHandles.updating}constructor(e){super(e),this.availability=1,this._updatingHandles=new d,this._abortController=new AbortController}destroy(){this._tracker=o(this._tracker),this._abortController=s(this._abortController),this._updatingHandles.destroy()}initialize(){const{view:e}=this,r=e.resourceController;this._edgeWorker=new c(h(r)),this._workerHandle=new l({renderCoordsHelper:this.view.renderCoordsHelper,schedule:h(r),fetchEdgeLocations:async(e,r)=>{if(null==this._tracker)throw new Error("tracker-not-initialized");return this._tracker.fetchEdgeLocations(e,this._edgeWorker,r)}}),this._updatingHandles.addPromise(this._setupLayerView()),this.addHandles([t(this._workerHandle),t(this._edgeWorker)])}async fetchCandidates(e,r){return this._workerHandle.fetchCandidates(e,r)}refresh(){}async _setupLayerView(){if(this.destroyed)return;const e=this._abortController?.signal,r=await this.getLayerView();null==r||i(e)||(this._tracker=r.trackSnappingSources({add:(r,t)=>{this._updatingHandles.addPromise(this._workerHandle.add({id:r,bounds:t},e))},remove:r=>{this._updatingHandles.addPromise(this._workerHandle.remove({id:r},e))}}))}};function h(e){return r=>e.immediate.schedule(r)}e([a({constructOnly:!0})],p.prototype,"getLayerView",void 0),e([a({constructOnly:!0})],p.prototype,"view",void 0),e([a({readOnly:!0})],p.prototype,"updating",null),e([a({readOnly:!0})],p.prototype,"availability",void 0),p=e([n("esri.views.interactive.snapping.featureSources.I3SSnappingSource")],p);export{p as I3SSnappingSource};