UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.84 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as n,subclass as s}from"../../../../core/accessorSupport/decorators.js";import i from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as a}from"../../../../layers/LayerConstants.js";import{QueryEngine as o}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import y from"../../../../rest/support/FeatureSet.js";import l from"../../../../rest/support/Query.js";const c=o;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 l({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:n}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:i.fromJSON(n)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){const r=this._ensureQueryJSON(e),n=await this._dataQueryEngine.executeQuery(r,t);if(e?.returnGeometry){const{processQueryGeometries:e}=await import("./I3SQueryResultGeometry.js");return e(this.layerView,n)}return y.fromJSON(n)}_ensureQueryJSON(e){return null==e?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||a,t="esriGeometryPolygon",r=this.layer.fieldsIndex?.toJSON()||new u([]),n=this.layerView.view.resourceController.scheduler,s=this.spatialReference.toJSON(),i=this.priority,o=this.spatialIndex;return this._dataQueryEngineInstance=new c({hasZ:!0,hasM:!1,geometryType:t,fieldsIndex:r,timeInfo:null,spatialReference:s,featureIdInfo:{type:"object-id",fieldName:e},featureStore:o,scheduler:n,priority:i}),this._dataQueryEngineInstance}};e([n({constructOnly:!0})],p.prototype,"layerView",void 0),e([n({constructOnly:!0})],p.prototype,"priority",void 0),e([n({constructOnly:!0})],p.prototype,"spatialIndex",void 0),e([n()],p.prototype,"spatialReference",null),e([n()],p.prototype,"layer",null),e([n()],p.prototype,"defaultQueryJSON",null),p=e([s("esri.views.3d.layers.i3s.I3SQueryEngine")],p);export{p as I3SQueryEngine};