/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{generateUID as e}from"../../../../../core/uid.js";import{getProjector as t,copy3 as o}from"../../../../../geometry/projection/projectors.js";function r(t=""){return`${t}${e()}`}function n(e,r,n,s,a){const l=s.spatialReference,i=t(r,l);if(null==i)return e;let f=t=>[e[t],e[t+1],e[t+2]];i!==o&&(f=t=>(i(e,t,c,0),[c[0],c[1],c[2]]));const u=e.length/3,d=n.mode;switch(n.mode){case"on-the-ground":for(let t=0;t<u;++t){const o=3*t,[r,n]=f(o);e[o+2]=s.getElevation(r,n,0,s.spatialReference,"ground")??0}break;case"relative-to-ground":case"relative-to-scene":{const t="relative-to-ground"===d?"ground":"scene";for(let o=0;o<u;++o){const r=3*o,[c,l,i]=f(r),u=n.calculateOffsetRenderUnits(a),d=s.getElevation(c,l,0,s.spatialReference,t)??0;e[r+2]=i+u+d}}break;case"absolute-height":for(let t=0;t<u;++t){const o=3*t,r=e[o+2],c=n.calculateOffsetRenderUnits(a);e[o+2]=r+c}}return e}const c=new Float64Array(3);export{n as applyElevationAlignment,r as generateId};
