@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 7.7 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import{ClonableMixin as t}from"../core/Clonable.js";import i from"../core/Collection.js";import o from"../core/Error.js";import has from"../core/has.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as n}from"../core/object.js";import{watch as p}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{reader as l}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import m from"../geometry/Extent.js";import y from"../geometry/SpatialReference.js";import c from"../graphic/ParquetGraphicOrigin.js";import f from"./Layer.js";import{ParquetSource as h}from"./graphics/sources/ParquetSource.js";import{BlendLayer as g}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{FeatureEffectLayer as v}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as w}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{OrderedLayer as O}from"./mixins/OrderedLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{labelsVisible as q,legendEnabled as E,popupEnabled as F}from"./support/commonProperties.js";import I from"./support/FeatureTemplate.js";import P from"./support/Field.js";import{defineFieldProperties as S}from"./support/fieldProperties.js";import{fixRendererFields as T}from"./support/fieldUtils.js";import R from"./support/LabelClass.js";import{reader as L}from"./support/labelingInfo.js";import U from"./support/ParquetGeometryEncodingLocation.js";import _ from"./support/ParquetGeometryEncodingWkb.js";import{parquetGeometryTypeKebabDict as D}from"./support/parquetUtils.js";import{rendererTypes as z}from"../renderers/support/typeUtils.js";import C from"../rest/support/Query.js";import{t as Q}from"../chunks/persistableUrlUtils.js";import{createPopupTemplate as k}from"../support/popupUtils.js";const G=S(),J="__OBJECTID",M={types:{key:"type",base:null,typeMap:{wkb:_,location:U}},json:{name:"layerDefinition.geometryEncoding",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"geometryEncoding"}}}}};let N=class extends(w(v(g(O(x(b(s(j(t(f)))))))))){constructor(e){super(e),this.copyright=null,this.definitionExpression=null,this.displayOptimization=null,this.fields=null,this.fieldsIndex=null,this.geometryEncoding=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new c(this),this.labelsVisible=!0,this.labelingInfo=null,this.objectIdField=J,this.operationalLayerType="ParquetLayer",this.outFields=null,this.persistenceEnabled=!!has("parquetlayer-persistence-enabled"),this.popupTemplate=null,this.source=null,this.spatialReference=null,this.templates=null,this.title="Parquet",this.type="parquet",this.urls=new i}destroy(){this.source?.destroy()}async load(e){return this.addResolvingPromise(this._load(e)),this.addHandles([p(()=>this.urls,e=>this.source?.updateFiles(e.items)),p(()=>this.customParameters,e=>this.source?.setCustomParameters(e))]),this}get capabilities(){return this.source?.capabilities}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,r,t,i){const o=e.filter(e=>!(e.name===J&&"oid"===e.type)).map(e=>e.toJSON(i));n(t,o,r)}get isTable(){return null==this.geometryEncoding&&null==this.displayOptimization}set renderer(e){T(e,this.fieldsIndex),this._set("renderer",e)}readUrls(e){return new i("files"===e.type?e.urls:[])}writeUrls(e,r,t,i){const s=[];if(e?.length){i={blockedRelativeUrls:i?.blockedRelativeUrls};for(let r of e)r=Q(r,i),r&&s.push(r)}s.length?r.source={type:"files",urls:s}:i.messages?.push(new o("parquet-layer:missing-urls","Missing or empty 'urls'",{layer:this}))}createPopupTemplate(e){return k(this,e)}createQuery(){const e=new C;return e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1",e}async createSource(e){const r=new h({layer:this});return await r.load(e),r}getFieldDomain(e,r){return null}getField(e){return this.fieldsIndex.get(e)}async queryFeatures(e,r){await this.load();const t=await this.source.queryFeatures(this._normalizeQuery(e),r),i=this.graphicOrigin;if(t?.features)for(const o of t.features)o.layer=o.sourceLayer=this,o.origin=i;return t}async queryObjectIds(e,r){return await this.load(),this.source.queryObjectIds(this._normalizeQuery(e),r)}async queryFeatureCount(e,r){return await this.load(),this.source.queryFeatureCount(this._normalizeQuery(e),r)}async queryExtent(e,r){return await this.load(),this.source.queryExtent(this._normalizeQuery(e),r)}_normalizeQuery(e){return C.from(e)??this.createQuery()}async _load(e){const r=await this.createSource(e);this._set("source",r),this.read(r.sourceJSON,{origin:"service"}),["fields"].forEach(e=>this.revertToOrigin(e,"service")),T(this.renderer,this.fieldsIndex),null==this.spatialReference&&(this.spatialReference=y.WGS84)}};e([a({readOnly:!0,json:{read:!1,write:!1}})],N.prototype,"capabilities",null),e([a({type:String})],N.prototype,"copyright",void 0),e([a({readOnly:!0})],N.prototype,"defaultPopupTemplate",null),e([a({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],N.prototype,"definitionExpression",void 0),e([a()],N.prototype,"displayOptimization",void 0),e([a({type:[P],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],N.prototype,"fields",void 0),e([d("fields")],N.prototype,"writeFields",null),e([a(G.fieldsIndex)],N.prototype,"fieldsIndex",void 0),e([a(M)],N.prototype,"geometryEncoding",void 0),e([a({type:m,json:{name:"extent"}})],N.prototype,"fullExtent",void 0),e([a({type:D.apiValues,json:{name:"layerDefinition.geometryType",read:{reader:D.read},write:{writer:D.write,ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"geometryType",reader:D.read}}}}})],N.prototype,"geometryType",void 0),e([a({readOnly:!0,clonable:!1})],N.prototype,"graphicOrigin",void 0),e([a(q)],N.prototype,"labelsVisible",void 0),e([a({type:[R],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:L},write:!0}})],N.prototype,"labelingInfo",void 0),e([a(E)],N.prototype,"legendEnabled",void 0),e([a()],N.prototype,"file",void 0),e([a({type:String,readOnly:!0})],N.prototype,"objectIdField",void 0),e([a({type:["ParquetLayer"]})],N.prototype,"operationalLayerType",void 0),e([a(G.outFields)],N.prototype,"outFields",void 0),e([a(F)],N.prototype,"popupEnabled",void 0),e([a({type:r,json:{name:"popupInfo",write:!0}})],N.prototype,"popupTemplate",void 0),e([a({types:z,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{read:{source:"drawingInfo.renderer"}}}}})],N.prototype,"renderer",null),e([a({type:h,readOnly:!0,cast:null,json:{read:!1}})],N.prototype,"source",void 0),e([a({type:y,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"extent.spatialReference"}}}}})],N.prototype,"spatialReference",void 0),e([a({type:[I]})],N.prototype,"templates",void 0),e([a()],N.prototype,"title",void 0),e([a({json:{read:!1},readOnly:!0})],N.prototype,"type",void 0),e([a({type:i.ofType(String),json:{name:"source",write:{isRequired:!0,ignoreOrigin:!0}}})],N.prototype,"urls",void 0),e([l("urls")],N.prototype,"readUrls",null),e([d("urls")],N.prototype,"writeUrls",null),N=e([u("esri.layers.ParquetLayer")],N);const V=N;export{V as default};