@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 4.46 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{_ as e}from"../../../../../chunks/tslib.es6.js";import r from"../../../../../core/Evented.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as a,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import s from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as l}from"../../../../../geometry/projection.js";import m from"../../../../../geometry/SpatialReference.js";import{QueryEngine as d}from"../../../../../layers/graphics/data/QueryEngine.js";import c from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{FeatureData as f}from"./featureData/FeatureData.js";import{FeatureDataStore as h}from"./featureData/FeatureDataStore.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as _}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as g}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as S}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as C}from"../../../support/RenderCoordsHelper.js";let j=class extends r.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureDataStore=new h,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:r,viewingMode:t,baseQuery:n,url:o,objectIdField:f,capabilities:h,fieldsIndex:y,timeInfo:j,fullExtent:w}){const x=m.fromJSON(e),v=m.fromJSON(r);this._fetcher=new _(x,c.fromJSON(n),o,f,h),this._queryEngine=new d({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:f,fieldsIndex:y,availableFields:[f],spatialReference:e,featureStore:this._featureStore,timeInfo:j}),this._renderer=new S({viewSpatialReference:x,renderSpatialReference:v,renderCoordsHelper:C.create(t,v),renderCommandContext:new g({viewingMode:t,dispatchRenderCommandsCallback:(e,r)=>this.remoteClient.invoke("dispatchRenderCommands",e,{transferList:r})})}),this._defaultQueryJSON=new c({outSpatialReference:x}).toJSON();let R=null;if(null!=w){const e=s.fromJSON(w);await u(e.spatialReference,x),R=l(e,x)}return this._tileManager=new p({loadTile:(e,r)=>this._fetcher.fetch(e,r),createAddTileCommand:(e,r)=>this._createAddTileCommand(e,r),createRemoveTileCommand:e=>this._createRemoveTileCommand(e),extent:R}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),i),await this._renderer.load(),Q}async executeQuery(e,r){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),r)}}async executeQueryForIds(e,r){const t=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),r);return{result:Array.from(t)}}async executeQueryForCount(e,r){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),r)}}async executeQueryForExtent(e,r){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),r)}}async executeQueryForLatestObservations(e,r){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),r)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),Q}async _createAddTileCommand(e,r){const a=new f(e),i=await this._renderer.createAddCommand(a);return t(r),i.appendPipelineStateCommand((()=>{this._featureDataStore.add(a),this._featureStore.addTile(e)})),i}async _createRemoveTileCommand(e){const r=this._featureStore,t=this._featureDataStore,a=this._renderer,i=t.get(e);if(null==i)return null;const n=await a.createRemoveCommand(i);return n.appendPipelineStateCommand((()=>{t.remove(e),r.removeTile(e)})),n}_ensureQuery(e){return e??this._defaultQueryJSON}};e([n()],j.prototype,"updating",null),j=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],j);const w=j,Q={result:void 0};export{w as default};