UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.88 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{LineCapStyle as r}from"../../../../../../../symbols/cim/enums.js";import{spritePadding as s}from"../../../definitions.js";import{packBitset as o}from"../fill/meshWriterUtils.js";import{LineMeshWriter as i,LineVertexSpec as n}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as a,bitsetLineScaleDash as c,bitsetLineIsSdf as u}from"../shaders/constants.js";import{DataType as p}from"../../../../../../webgl/enums.js";const m={createComputedParams:t=>t,optionalAttributes:n.optionalAttributes,attributes:{...n.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:r})=>o([[a,t],[c,e],[u,r]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:r,height:o}=t,i=e.x+s,n=e.y+s;return[i,n,i+r,n+o]}},accumulatedDistance:{type:p.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:p.HALF_FLOAT,count:1,pack:({offsetAlongLine:e})=>t(e)},capType:{type:p.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case r.Butt:case"butt":return 0;case r.Square:case"square":return 1;case r.Round:case"round":return 2;default:return 0}}}}};class l extends i{constructor(t,e,r,s){super(t,e,r,s),this.vertexSpec=m,this._tessellationOptions.textured=!0}_write(t,r,s){const o=s??e.fromFeatureSetReaderCIM(r);if(!o)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(t,r,o,i?.textureBinding)}}export{l as TexturedLineMeshWriter,m as texturedLineVertexSpec};