@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 4.81 kB
JavaScript
import t from"../../../../Color.js";import{toHSV as e,toRGB as i}from"../../../../core/colorUtils.js";import{b as l}from"../../../../chunks/vec4f64.js";import{ExtensionType as o}from"../visualElements/ExtendedLineVisualElement.js";import{RenderOccludedFlag as s}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as n}from"../../webgl-engine/materials/lineStippleUtils.js";const r={main:new t([255,127,0]),selected:new t([255,255,255]),staged:new t([12,207,255]),outline:new t([0,0,0,.5]),selectedOutline:new t([255,255,255])},h=.3;function c(t,e){const i=t.clone();return i.a*=e,i}function a(t,l){const o=t.clone(),s=e(o);s.s*=l;const n=i(s);return o.r=n.r,o.g=n.g,o.b=n.b,o}function d(t,e){if(e)for(const i in e)t[i]=e[i]}class u{constructor(t){this.color=r.main,this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=s.Opaque,d(this,t)}}class p{constructor(t){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=r.main,this.outlineColor=r.outline,this.renderOccluded=s.Opaque,this.hoverOutlineColor=r.selectedOutline,d(this,t)}apply(t,e){const i=this[t];e.setParameters({color:P(i),transparent:"color"!==t||i.a<1,renderOccluded:this.renderOccluded})}}class g{constructor(t){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.color=c(r.main,.5),this.hoverColor=r.main,this.renderOccluded=s.Transparent,this.minSquaredEdgeLength=900,d(this,t)}apply(t,e){const i=this[t];e.setParameters({color:P(i),transparent:i.a<1,renderOccluded:this.renderOccluded})}}class f{constructor(t){this.vertex=new p({color:r.main,outlineColor:r.outline}),this.edge=new p({color:a(c(r.main,2/3),.5),outlineColor:c(r.outline,.5),size:8,collisionPadding:8}),this.selected=new p({color:r.selected,outlineColor:r.outline}),this.edgeOffset=new g,d(this,t)}}class w{constructor(t){this.color=r.selected,this.width=1.5,this.stipplePattern=n(5),this.stippleOffColor=r.outline,this.falloff=0,this.innerWidth=1.5,this.innerColor=r.selected,this.renderOccluded=s.OccludeAndTransparent,d(this,t)}apply(t){t.color=P(this.color),t.width=this.width,t.stipplePattern=this.stipplePattern,t.stippleOffColor=P(this.stippleOffColor),t.falloff=this.falloff,t.innerWidth=this.innerWidth,t.innerColor=P(this.innerColor),t.renderOccluded=this.renderOccluded}}class C{constructor(t){this.color=r.selected,this.size=4,this.outlineSize=1,this.outlineColor=r.outline,this.shape="square",d(this,t)}apply(t){t.color=P(this.color),t.size=this.size,t.outlineSize=this.outlineSize,t.outlineColor=P(this.outlineColor),t.primitive=this.shape}}class m{constructor(t){this.innerColor=r.selected,this.innerWidth=1,this.glowColor=r.main,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=h,this.globalAlphaContrastBoost=1.5,this.radius=3,this.heightFillColor=r.main,d(this,t)}apply(e,i=1){const l={glowColor:t.toUnitRGB(this.glowColor),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:t.toUnitRGB(this.innerColor),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*i,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in e?e.style=l:e.laserlineStyle=l}}class O{constructor(t){this.outline=new w({color:r.outline,renderOccluded:s.OccludeAndTransparentStencil,stippleOffColor:r.selected,stipplePattern:n(5),width:1.5,innerWidth:0}),this.staged=new w({color:r.selected,renderOccluded:s.OccludeAndTransparentStencil,innerColor:r.staged,stippleOffColor:r.outline,stipplePattern:n(5),width:1.5}),this.shadowStyle=new m({globalAlpha:h,glowColor:r.main,glowFalloff:8,glowWidth:8,innerColor:r.selected,innerWidth:1}),d(this,t)}}class A{constructor(t){this.outline=new C({color:r.selected,outlineColor:r.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new m({globalAlpha:h,glowColor:r.main,glowFalloff:1.5,glowWidth:6,innerColor:r.selected,innerWidth:1,radius:2}),d(this,t)}}class W extends w{constructor(t){super(),this.extensionType=o.GROUND_RAY,d(this,t)}}class b{constructor(t){this.lineGraphics=new O,this.pointGraphics=new A,this.heightPlane=new m({globalAlpha:h,glowColor:r.main,glowFalloff:8,glowWidth:8,innerColor:r.selected,innerWidth:1}),this.heightBox=new m({globalAlpha:h,glowColor:r.main,glowFalloff:8,glowWidth:8,innerColor:r.selected,innerWidth:0,heightFillColor:r.main}),this.zVerticalLine=new W({color:c(r.main,5*h/3),falloff:2,innerColor:c(r.selected,0),renderOccluded:s.OccludeAndTransparent,stipplePattern:null,width:5,extensionType:o.GROUND_RAY}),this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,d(this,t)}}class z{constructor(t){this.visualElements=new b,this.reshapeManipulators=new f,this.zManipulator=new u,d(this,t)}colorToVec4(t){return P(t)}}function P(e){return l(t.toUnitRGBA(e))}const y=new z;export{p as VertexManipulatorStyle,r as colors,y as settings};