UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.07 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{baseObjectMemory as t,estimateStringMemory as e}from"../../../../../../core/memoryEstimations.js";import{generateId as r}from"../utils.js";import{FeatureDataSubset as i}from"./FeatureDataSubset.js";class s{constructor(t){this._tile=t,this.id=r(`featureData-${t.id}-`),this._enabled=new Array(t.featureCount).fill(!0)}get tileId(){return this._tile.id}get featureCount(){return this._tile.featureCount}get usedMemory(){return t+e(this.id)}get extent(){return this._tile.descriptor.extent}get isFullyEnabled(){return this._enabled.every((t=>t))}getObjectId(t){return this._tile.getObjectId(t)}getAttribute(t,e){return this._tile.getAttribute(t,e)}getAttributeAsTimestamp(t,e){return this._tile.getAttribute(t,e)}getAttributes(t){return this._tile.getAttributes(t)}getCoordinates(t,e,r){return this._tile.getCoordinates(t,e,r)}getOptimizedGeometry(t){return this._tile.getOptimizedGeometry(t)}getCentroid(t,e){return this._tile.getCentroid(t,e)}getBounds(t){return this._tile.getBounds(t)}getBoundingBox(t){return this._tile.getBoundingBox(t)}getObjectIdsArray(t,e,r){return this._tile.getObjectIdsArray(t,e,r)}getCoordinatesArray(t,e,r){return this._tile.getCoordinatesArray(t,e,r)}objectIds(t){return this._tile.objectIds(t)}subset(t){return new i(this,t)}disableObjectIds(t){if(0===t.size)return;const{_enabled:e}=this,r=new Array;for(const i of this._allFeatureIndices())e[i]&&t.has(this.getObjectId(i))&&r.push(i);if(0!==r.length)for(const i of r)e[i]=!1}setEnabled(t,e){this._enabled[t]=e}getEnabled(t){return this._enabled[t]}enableAll(){this._enabled.fill(!0)}getVisibilityArray(t,e=this._allFeatureIndices(),r=0){const{_enabled:i}=this;for(const s of e)t[r++]=Number(i[s]);return r}*enabledObjectIds(t=this._allFeatureIndices()){const{_enabled:e}=this;for(const r of t)e[r]&&(yield this.getObjectId(r))}*_allFeatureIndices(){const{featureCount:t}=this;for(let e=0;e<t;++e)yield e}}export{s as FeatureData};