/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
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]]}},size:{type:i.UNSIGNED_BYTE,count:2,pack:({size:e})=>[e,e]},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,r){const i=r.getDisplayId(),o=this.evaluatedMeshParams.minPixelBuffer,s=Math.max(e(this.evaluatedMeshParams.size),o);let c,n;if("esriGeometryPoint"===r.geometryType)c=r.readXForDisplay(),n=r.readYForDisplay();else{const e=r.readCentroidForDisplay();if(!e)return;c=e?.coords[0],n=e?.coords[1]}t.recordStart(this.instanceId,this.attributeLayout),t.recordBounds(c,n,s,s);const a=t.vertexCount();this._writeVertex(t,i,c,n),t.indexWrite(a+0),t.indexWrite(a+1),t.indexWrite(a+2),t.indexWrite(a+1),t.indexWrite(a+3),t.indexWrite(a+2),t.recordEnd()}}export{s as PieChartMeshWriter};
