@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.13 kB
JavaScript
/*
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 t from"../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as s}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 i from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as o}from"../../../../layers/LayerConstants.js";import{QueryEngine as a}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import y from"../../../../rest/support/FeatureSet.js";import c from"../../../../rest/support/Query.js";const l=a;let p=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on("visible-geometry-changed",(()=>this.spatialIndex.events.emit("changed"))))}destroy(){this._dataQueryEngineInstance=r(this._dataQueryEngineInstance),this._set("layerView",null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.i3slayer}get defaultQueryJSON(){return new c({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:i.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){const r=this._ensureQueryJSON(e),s=await this._dataQueryEngine.executeQuery(r,t);if(e?.returnGeometry){const{processQueryGeometries:e}=await import("./I3SQueryResultGeometry.js");return e(this.layerView,s)}return y.fromJSON(s)}_ensureQueryJSON(e){return null==e?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||o,t="esriGeometryPolygon",r=this.layer.fieldsIndex?.toJSON()||new u([]),s=this.layerView.view.resourceController.scheduler,n=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new l({hasZ:!0,hasM:!1,geometryType:t,fieldsIndex:r,timeInfo:null,spatialReference:n,featureIdInfo:{type:"object-id",fieldName:e},featureStore:a,scheduler:s,priority:i}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],p.prototype,"layerView",void 0),e([s({constructOnly:!0})],p.prototype,"priority",void 0),e([s({constructOnly:!0})],p.prototype,"spatialIndex",void 0),e([s()],p.prototype,"spatialReference",null),e([s()],p.prototype,"layer",null),e([s()],p.prototype,"defaultQueryJSON",null),p=e([n("esri.views.3d.layers.i3s.I3SQueryEngine")],p);export{p as I3SQueryEngine};