UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.57 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import r from"../../../../../../../Color.js";import e from"../../../../../../../core/Error.js";import t from"../../../../../../../core/Logger.js";import{LineCapStyle as n,CapType as o,LineJoinStyle as s,JoinType as c}from"../../../../../../../symbols/cim/enums.js";const i=()=>t.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.meshWriterUtils"),u=0,a=100;function m(r,e){return[!!r?.minScale&&e.scaleToZoom(r.minScale)||u,!!r?.maxScale&&e.scaleToZoom(r.maxScale)||a]}function f(r){return 1<<r}function l(r){let e=0;for(const[t,n]of r)n&&(e|=1<<t);return e}function g(t){let n;if(!t)return[0,0,0,0];if("string"==typeof t){const o=r.fromString(t);if(!o)return i().errorOnce(new e("mapview:mesh-processing","Unable to parse string into color",{color:t})),[0,0,0,0];n=o.toArray()}else n=t;const[o,s,c,u]=n;return[o*(u/255),s*(u/255),c*(u/255),u]}function h(r){switch(r){case"butt":case n.Butt:return o.BUTT;case"round":case n.Round:return o.ROUND;case"square":case n.Square:return o.SQUARE}}function p(r){switch(r){case"bevel":case s.Bevel:return c.BEVEL;case"miter":case s.Miter:return c.MITER;case"round":case s.Round:return c.ROUND}}function d(r,e){return Math.round(Math.min(Math.sqrt(r*e),255))}function S(r,e){return Math.round(r*e)/e}export{f as getBitMask,m as getMinMaxZoom,l as packBitset,d as packByteSqrt,S as packRounded,g as processColorInput,h as processLineCapInput,p as processLineJoinInput};