/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{getMinMaxZoom as t}from"../fill/meshWriterUtils.js";import{MeshWriter as r}from"../mesh/MeshWriter.js";import{DataType as i}from"../../../../../../webgl/enums.js";const o={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:i.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:i.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:i.UNSIGNED_BYTE,count:1,pack:e=>0},offset:{type:i.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:t})=>{const r=e(t),i=-r/2,o=-r/2;return[[i,o],[i+r,o],[i,o+r],[i+r,o+r]]}}},texCoords:{type:i.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},referenceSize:{type:i.UNSIGNED_BYTE,count:1,pack:({size:t})=>e(t)},zoomRange:{type:i.UNSIGNED_BYTE,count:2,pack:({scaleInfo:e},{tileInfo:r})=>t(e,r)}}};class s extends r{constructor(){super(...arguments),this.vertexSpec=o}_write(t,{target:r}){const i=r.getDisplayId(),o=this.evaluatedMeshParams.minPixelBuffer,s=Math.max(e(this.evaluatedMeshParams.size),o);let a,c;if("esriGeometryPoint"===r.geometryType)a=r.readXForDisplay(),c=r.readYForDisplay();else{const e=r.readCentroidForDisplay();if(!e)return;a=e?.coords[0],c=e?.coords[1]}t.recordStart(this.instanceId,this.attributeLayout),t.recordBounds(a,c,s,s);const n=t.vertexCount();this._writeVertex(t,i,a,c),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2),t.recordEnd()}}export{s as PieChartMeshWriter};
