/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{baseObjectMemory as t}from"../../../../../../core/memoryEstimations.js";import{generateId as e}from"../utils.js";class s{constructor(t,s){this._parent=t,this._subsetIndices=s,this.id=e(`featureDataSubset-${t.id}-`)}get tileId(){return this._parent.tileId}get extent(){return this._parent.extent}get featureCount(){return this._subsetIndices.length}get usedMemory(){return this._parent.usedMemory+t+this._subsetIndices.byteLength}get isFullyEnabled(){for(const t of this._subsetIndices)if(!this._parent.getEnabled(t))return!1;return!0}getObjectId(t){return this._parent.getObjectId(this._subsetIndices[t])}getAttribute(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributeAsTimestamp(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributes(t){return this._parent.getAttributes(this._subsetIndices[t])}getCoordinates(t,e,s){return this._parent.getCoordinates(this._subsetIndices[t],e,s)}getOptimizedGeometry(t){return this._parent.getOptimizedGeometry(this._subsetIndices[t])}getCentroid(t,e){return this._parent.getCentroid(this._subsetIndices[t],e)}getBounds(t){return this._parent.getBounds(this._subsetIndices[t])}getBoundingBox(t){return this._parent.getBoundingBox(this._subsetIndices[t])}getObjectIdsArray(t,e,s){return this._parent.getObjectIdsArray(t,this._translatedIndices(e),s)}getCoordinatesArray(t,e,s){return this._parent.getCoordinatesArray(t,this._translatedIndices(e),s)}objectIds(t){return this._parent.objectIds(this._translatedIndices(t))}subset(t){const{_subsetIndices:e}=this,r=new Uint32Array(t.length);for(let s=0;s<r.length;++s)r[s]=e[t[s]];return new s(this._parent,r)}disableObjectIds(t){if(0===t.size)return;const{featureCount:e}=this,s=new Array;for(let r=0;r<e;++r)this.getEnabled(r)&&t.has(this.getObjectId(r))&&s.push(r);if(0!==s.length)for(const r of s)this.setEnabled(r,!1)}setEnabled(t,e){this._parent.setEnabled(this._subsetIndices[t],e)}getEnabled(t){return this._parent.getEnabled(this._subsetIndices[t])}enableAll(){const{_subsetIndices:t,_parent:e}=this;for(const s of t)e.setEnabled(s,!0)}getVisibilityArray(t,e,s){return this._parent.getVisibilityArray(t,this._translatedIndices(e),s)}enabledObjectIds(t){return this._parent.enabledObjectIds(this._translatedIndices(t))}*_translatedIndices(t){const{_subsetIndices:e}=this;if(null!=t)for(const s of t)yield e[s];else yield*e}}export{s as FeatureDataSubset};
