UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 3.63 kB
/* 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{destroyMaybe as t}from"../../../../core/maybe.js";import{throwIfAborted as s,createAbortError as o}from"../../../../core/promiseUtils.js";import{difference as i}from"../../../../core/SetUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromFeatureSetJSON as l}from"../../../../layers/graphics/dehydratedFeatures.js";import{runQuery as n,executeQuery as y}from"../../../../rest/query/operations/query.js";import{PBFDecoder as c}from"../../support/PBFDecoder.js";let p=class extends r{constructor(e){super(e)}get implicitFields(){const e=this.layer.outFields?.includes("*");if(!e)return new Set;const r=new Set(this.layerView.requiredFields),t=new Set(this.layerView.availableFields);return i(t,r)}get queryFeaturesDehydrated(){const{layer:e}=this,r=e.capabilities,t=r&&r.query,i=t&&t.supportsFormatPBF,u=e.parsedUrl;if(i){null==this._decoder&&(this._decoder=new c(this.controller));const r={sourceSpatialReference:e.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:f};return(e,t)=>n(u,e,"pbf",this._createRequestOptions(t)).then((e=>(s(t),null!=this._decoder?this._decoder.invoke({buffer:e.data,options:r},t.signal):Promise.reject(o()))))}return(r,t)=>y(u,r,e.spatialReference,this._createRequestOptions(t)).then((e=>l(e.data,{maxStringAttributeFields:this.implicitFields,maxStringAttributeLength:f})))}queryFeatureCount(e,r){return this.layer.queryFeatureCount(e,r)}destroy(){this._decoder=t(this._decoder)}_createRequestOptions(e){return{...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([u({constructOnly:!0})],p.prototype,"layer",void 0),e([u({constructOnly:!0})],p.prototype,"layerView",void 0),e([u({constructOnly:!0})],p.prototype,"controller",void 0),e([u({readOnly:!0})],p.prototype,"implicitFields",null),e([u({readOnly:!0})],p.prototype,"queryFeaturesDehydrated",null),p=e([a("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],p);let d=class extends r{constructor(e){super(e)}queryFeaturesDehydrated(e,r){return this.layer.queryFeatures(e,r)}};e([u({constructOnly:!0})],d.prototype,"layer",void 0),d=e([a("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileOGCServiceQuery3D")],d);let m=class extends r{constructor(e){super(e)}queryFeaturesDehydrated(e,r){return this.source.queryFeaturesJSON(e,r).then(l,(t=>{if(t&&"query-features-json:unsupported"===t.name)return this.layer.queryFeatures(e,r);throw t}))}queryFeatureCount(e,r){return this.layer.queryFeatureCount(e,r)}};function h(e,r){const{layer:t}=e;return"feature"===t.type&&"feature-layer"===t.source.type||"catalog-footprint"===t.type?new p({layer:t,layerView:e,controller:r}):"feature"===t.type&&"memory"===t.source.type||"csv"===t.type||"geojson"===t.type||"oriented-imagery"===t.type||"wfs"===t.type?new m({layer:t,source:t.source}):"ogc-feature"===t.type?new d({layer:t}):null}e([u({constructOnly:!0})],m.prototype,"layer",void 0),e([u({constructOnly:!0})],m.prototype,"source",void 0),m=e([a("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D")],m);const f=1024;export{h as createFeatureTileQuery3D};