UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.73 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as t}from"tslib";import{Loadable as e}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{open as o}from"../../../core/workers.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../geometry/Extent.js";import{toParquetJSONGeometryType as u}from"../../support/parquetUtils.js";import l from"../../../rest/support/FeatureSet.js";let c=class extends e{constructor(t){super(t),this.type="parquet"}load(t){const e=null!=t?t.signal:null;return this.addResolvingPromise(this._initialize(e)),Promise.resolve(this)}destroy(){this._connection?.destroy()}async openPorts(){return await this.load(),this._connection.openPorts()}setCustomParameters(t){this._proxy.setCustomParameters(t).catch(()=>{r.getLogger(this).warn("Failed to update customParameters")})}async updateFiles(t){await this._proxy.updateFiles(t)}async queryFeaturesJSON(t,e={}){return await this.load(e),this._proxy.queryFeatures(t.toJSON(),{signal:e?.signal})}async queryFeatures(t,e={}){const r=await this.queryFeaturesJSON(t,{signal:e?.signal});return l.fromJSON(r)}async queryObjectIds(t,e){return await this._proxy.queryObjectIds(t.toJSON(),{signal:e?.signal})}async queryFeatureCount(t,e){return this._proxy.queryFeatureCount(t.toJSON(),{signal:e?.signal})}async queryExtent(t,e){if(null==this.layer.geometryEncoding)return r.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};const s=await this._proxy.queryExtent(t.toJSON(),{signal:e?.signal});return{count:s.count,extent:n.fromJSON(s.extent)}}async _initialize(t){this._connection=await o("ParquetSourceWorker",{strategy:"dedicated",signal:t,registryTarget:this}),s(t),this._proxy=this._connection.createInvokeProxy();const{layerDefinition:e,capabilities:r}=await this._proxy.load({urls:this.layer.urls.items,fields:this.layer.fields?.map(t=>t.toJSON()),geometryType:this.layer.geometryType?u(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),geometryEncoding:this.layer.geometryEncoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters});s(t),this.sourceJSON=e,this.capabilities=r}};t([i()],c.prototype,"type",void 0),t([i({constructOnly:!0})],c.prototype,"layer",void 0),t([i()],c.prototype,"sourceJSON",void 0),t([i()],c.prototype,"capabilities",void 0),c=t([a("esri.layers.graphics.sources.ParquetSource")],c);export{c as ParquetSource};