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