/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{getCentroidOptimizedGeometry as e}from"./centroid.js";import r from"./OptimizedGeometry.js";class o{constructor(t=null,e={},r,o,s=0){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=o,this.displayId=s}static fromJSON(t){const e=t.geometry?r.fromJSON(t.geometry):null,s=t.centroid?r.fromJSON(t.centroid):null,i=t.objectId;return new o(e,t.attributes,s,i)}weakClone(){const t=new o(this.geometry,this.attributes,this.centroid,this.objectId);return t.displayId=this.displayId,t}clone(){const t=this.geometry?.clone(),e=new o(t,{...this.attributes},this.centroid?.clone(),this.objectId);return e.displayId=this.displayId,e}ensureCentroid(t){return this.centroid??=e(this.geometry),this.centroid}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}}function s(t){return!!t.geometry?.coords?.length}class i extends o{}export{o as OptimizedFeature,i as OptimizedFeatureWithGeometry,s as hasGeometry};
