@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 3.04 kB
JavaScript
import e from"../../../../../../core/Logger.js";import{pt2px as t}from"../../../../../../core/screenUtils.js";import{CapType as i}from"../../../../../../symbols/cim/enums.js";import{premultiplyAlphaRGBAArray as r,premultiplyAlphaRGBA as s}from"../../color.js";import{SPRITE_PADDING as o,MIN_MAX_ZOOM_PRECISION_FACTOR as l,BITSET_TYPE_FILL_OUTLINE as n,BITSET_GENERIC_LOCK_COLOR as a,BITSET_LINE_SCALE_DASH as m,BITSET_GENERIC_CONSIDER_ALPHA_ONLY as c}from"../../definitions.js";import{i1616to32 as h}from"../../number.js";import{getCapType as p,getJoinType as f}from"../../Utils.js";import{LineMaterialKey as u,FillMaterialKey as d,hasOutlineFillSymbology as y}from"../../materialKey/MaterialKey.js";import{getLimitCosine as L,getMinMaxZoom as S,DEFAULT_MIN_ZOOM as _,DEFAULT_MAX_ZOOM as j}from"./util.js";import g from"./WGLBaseLineTemplate.js";import w from"./WGLMeshTemplate.js";class K extends(g(w)){constructor(e,t,i,r,s,o,p,f,d,y,S,_,j,g,w,K,P,x,b,O){super();const T=u.load(e);t&&(T.sdf=t.sdf,T.pattern=!0,T.textureBinding=t.textureBinding),this._capType=r,this._joinType=s,this._miterLimitCosine=L(o),this.tessellationProperties._fillColor=p,this.tessellationProperties._tl=f,this.tessellationProperties._br=d,this._hasPattern=y,this._isDashed=S,this._zOrder=P,this._effects=x,this._minMaxZoom=h(Math.round(b*l),Math.round(O*l)),this._materialKey=T.data;const M=(j?a:0)|(g?n:0)|(_?m:0)|(w?c:0);this.tessellationProperties._bitset=M,this.tessellationProperties._halfWidth=.5*i,this.tessellationProperties._halfReferenceWidth=.5*K,this.tessellationProperties.offset=0,this._initializeTessellator(!1)}static fromCIMLine(e,r,l){const n=e.color,a=e.scaleFactor||1,m=!!e.dashTemplate;let c=e.cap;m&&c===i.ROUND&&(c=i.SQUARE);const p=e.join,f=t(e.width)*a,u=t(e.referenceWidth),d=t(e.miterLimit),y=n&&s(n)||0,[L,_]=S(e.scaleInfo,l),j=!1;if(!r)return new K(e.materialKey,r,f,c,p,d,y,0,0,!1,m,e.scaleDash??!1,e.colorLocked??!1,j,e.sampleAlphaOnly,u,e.zOrder,e.effects,L,_);const{rect:g,width:w,height:P}=r,x=g.x+o,b=g.y+o,O=x+w,T=b+P,M=h(x,b),W=h(O,T),z=!1;return new K(e.materialKey,r,f,c,p,d,y,M,W,!0,m,e.scaleDash??!1,e.colorLocked??!1,z,e.sampleAlphaOnly,u,e.zOrder,e.effects,L,_)}static fromFillOutline(e){const t=d.load(e.materialKey);return y(t)&&e.outline&&"esriSLSSolid"===e.outline?.style?K.fromSimpleLine({hash:"",materialKey:e.materialKey,...e.outline},null,!0):null}static fromSimpleLine(e,i,s=!1){const{color:l}=e,n="esriSLSSolid"!==e.style&&"esriSLSNull"!==e.style,a=p(e.cap||"round"),m=f(e.join||"round");let c=l&&"esriSLSNull"!==e.style&&r(l)||0;"esriSLSNull"===e.style&&(c=0);const u=t(e.width),d=e.miterLimit;if(!i)return new K(e.materialKey,i,u,a,m,d,c,0,0,!1,n,!0,!1,s,!1,u,0,null,_,j);const{rect:y,width:L,height:S}=i,g=y.x+o,w=y.y+o,P=g+L,x=w+S,b=h(g,w),O=h(P,x);return new K(e.materialKey,i,u,a,m,d,c,b,O,!0,n,!0,!1,s,!1,u,0,null,_,j)}static fromPictureLineSymbol(t,i,r,s){return e.getLogger("esri.views.2d.engine.webgl.WGLLineTemplate").error("PictureLineSymbol support does not exist!"),null}}export{K as default};