@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.44 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import t from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as r}from"./FeatureSetReader.js";class n extends r{constructor(t,r,n,s,i,d=new Uint32Array(s.size())){super(t),this._fields=r,this._geometryInfo=n,this._inner=s,this._chunkId=i,this._displayIds=d,this._index=-1,this.usedMemory=e,this._size=this._inner.size();const o=t.featureIdInfo;"object-id"===o.type&&(this._objectIdFieldIndex=this._fields.get(o.fieldName)?.index),this._chunkId>65535&&console.error("Exceeded max allowed parquet reader size")}destroy(){super.destroy(),this._inner.free()}get fields(){return this._fields}get geometryType(){return this._geometryInfo.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return null}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){return null!=this._objectIdFieldIndex?this._inner.readAttribute(this._index,this._objectIdFieldIndex):this._index<<16|this._chunkId}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new n(this.metadata,this._fields,this._geometryInfo,this._inner,this._chunkId,this._displayIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}readGeometryForDisplayTransformed(e){const[r,n]=e.translate,[s,i]=e.scale,d=this._inner.readGeometryTransformed(this._index,r,n,s,i);return d?new t(d.readLengthsUnsafe(),d.readCoordsUnsafe()):null}_readGeometry(e){const r=this._inner.readCoords(this._index),n=this._inner.readLengths(this._index);return r&&n?new t(n,r):null}_readX(){return this._readGeometry()?.coords[0]}_readY(){return this._readGeometry()?.coords[1]}_readServerCentroid(){return null}_readAttribute(e,t){const r=this.fields.get(e);if(!r)return;if(null==r.index)return this.getObjectId();const n=this._inner.readAttribute(this._index,r.index);if(null==n)return n;const s=this.fields.isDateField(r.name);return t?null==n?n:s?new Date(n):n:n}_readAttributes(){const e={};for(const t of this._fields.fields)null!=t.index?this._inner.hasField(t.index)&&(e[t.name]=this._readAttribute(t.name,!1)):e.__OBJECTID=this.getObjectId();return e}}export{n as FeatureSetReaderParquet};