@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.07 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{computeRenderCoordinates as t,computeTileCenterRenderCoordinates as r}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as o}from"./symbolizationUtils.js";import{Attribute as n}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as a}from"../../../../webgl-engine/lib/VertexAttribute.js";class i{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext.createEncoder();this.materialId=e.createMaterial("hud"),e.createDirectRenderer(this.materialId),await e.dispatch(),this._loaded=!0}async createAddCommand(i){const s=this._context.renderCommandContext.createEncoder();if(null==this.materialId)throw new Error("expected material not to be null");const{featureCount:l,id:d}=i;if(0===l)return s;const m=t(i,this._context),c=r(i,this._context),h=new Float64Array([0,0,1]),w=new Float64Array([255,255,255,255]),u=new Float64Array([24,24]),A=new Float64Array([0,0,0,1]),y=new Float64Array([0,0]),_=new Float64Array([0]),f=new Uint32Array(l);for(let e=0;e<l;++e)f[e]=e;const x=new Uint32Array(l);for(let e=0;e<l;++e)x[e]=0;const C=new n(m,f,3,!0),I=new n(h,x,3,!0),b=new n(y,x,2,!0),g=new n(w,x,4,!0),p=new n(_,x,1,!0),E=new n(u,x,2,!0),F=new n(A,x,4,!0),O=[[a.POSITION,C],[a.NORMAL,I],[a.UV0,b],[a.COLOR,g],[a.ROTATION,p],[a.SIZE,E],[a.CENTEROFFSETANDDISTANCE,F]],R={attributes:o(O),objectAndLayerIdColor:void 0,transformation:e(),materialId:this.materialId};return s.addDirectRendererGeometry(d,R,c),s}async createRemoveCommand(e){const t=this._context.renderCommandContext.createEncoder();return t.removeDirectRendererGeometry(e.id),t}}export{i as TestSymbol};