@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.32 kB
JavaScript
import{_ as e}from"../../../../chunks/tslib.es6.js";import{HandleOwner as r}from"../../../../core/HandleOwner.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{removeMaybe as o,abortMaybe as i,isNone as s,applySome as a}from"../../../../core/maybe.js";import{isAborted as n}from"../../../../core/promiseUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{EdgeWorkerHandle as l}from"../../../3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js";import{SceneLayerSnappingSourceWorkerHandle as p}from"./sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js";let h=class extends r{get updating(){return this.updatingHandles.updating}constructor(e){super(e),this.availability=1,this._abortController=new AbortController}destroy(){this._tracker=o(this._tracker),this._abortController=i(this._abortController)}initialize(){const{view:e}=this,r=e.resourceController;this._edgeWorker=new l((e=>r.immediate.schedule(e))),this._workerHandle=new p({renderCoordsHelper:this.view.renderCoordsHelper,schedule:e=>r.immediate.schedule(e),fetchEdgeLocations:async(e,r)=>{if(s(this._tracker))throw new Error("tracker-not-initialized");return this._tracker.fetchEdgeLocations(e,this._edgeWorker,r)}}),this.updatingHandles.addPromise(this._setupLayerView()),this.handles.add([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=a(this._abortController,(e=>e.signal)),r=await this.getLayerView();s(r)||n(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))}}))}};e([d({constructOnly:!0})],h.prototype,"getLayerView",void 0),e([d({constructOnly:!0})],h.prototype,"view",void 0),e([d({readOnly:!0})],h.prototype,"updating",null),e([d({readOnly:!0})],h.prototype,"availability",void 0),h=e([c("esri.views.interactive.snapping.featureSources.I3SSnappingSource")],h);export{h as I3SSnappingSource};