/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{convertFlatToOptimizedGeometry as e,convertOptimizedGeometryToFlat as i}from"../../geometry/FlatGeometry.js";import{getCentroidOptimizedGeometry as s}from"./centroid.js";class r{constructor(t=null,e={},i,s,r=0,o=null){this.geometry=t,this.attributes=e,this.centroid=i,this.objectId=s,this.displayId=r,this.distance=o}weakClone(){return new r(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId,this.distance)}clone(){return new r(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId,this.distance)}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}ensureCentroid(t){return this.centroid??=s(this.geometry&&e(this.geometry)),this.centroid}}function o(t,{geometry:e,attributes:s,centroid:o,objectId:n,displayId:d,distance:h},c){return new r(e&&i(t,e,c),s,o,n,d,h)}export{r as FlatFeature,o as convertOptimizedFeatureToFlat};
