UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.4 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import e from"../../../../Color.js";import t from"../../../../core/Handles.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{fromTranslation as i,mul as s,fromXRotation as n,fromYRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as l}from"../../../../chunks/vec32.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{displayFocusMultiplier as f}from"../Slice/sliceToolConfig.js";import{viewshedToolManipulatorConfiguration as p}from"./ViewshedConfiguration.js";import{Manipulator3D as d}from"../../interactive/Manipulator3D.js";import{RenderObject as u}from"../../interactive/RenderObject.js";import{CullFaceOptions as h}from"../../webgl-engine/lib/basicInterfaces.js";import{createTubeGeometry as j,createExtrudedTriangle as g}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as w}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as b}from"../../webgl-engine/materials/ColorMaterial.js";import{ManipulatorStateFlags as v}from"../../../interactive/interfaces.js";class M extends d{constructor(e,r){super({view:e,autoScaleRenderObjects:!1,worldSized:!1,radius:p.collisionRadius}),this._handles=new t,this._setupManipulatorVisual(r)}destroy(){this._handles.remove(),super.destroy()}_setupManipulatorVisual(e){const t=this._createMaterial(),r=1,o=[m(0,0,0),m(0,0,r)],d=j(t,o,e,16,!1),h=j(t,o,e*f,16,!1),g=O(!1,t,e),w=O(!0,t,e),b=c();i(b,o[o.length-1]),s(b,b,n(_,Math.PI/2)),s(b,b,a(_,Math.PI/2)),g.transformation=b,w.transformation=b,this.renderObjects=[new u(d,v.Unfocused),new u(h,v.Focused),new u(g,v.Unfocused),new u(w,v.Focused)];const M=m(0,p.getScaleOrientArrowTipLength(!0),0),T=l(M,M,b),x=[...o,T];this.collisionType={type:"line",paths:[x]}}_createMaterial(){const t=new b({cullFace:h.Back,renderOccluded:w.OccludeAndTransparent,isDecoration:!0});return this._handles.add(r((()=>e.toUnitRGBA(this.view.effectiveTheme.accentColor)),(e=>t.setParameters({color:e})),o)),t}}function O(e,t,r){const o=p.getScaleOrientArrowTipLength(e);let i=2*r;e&&(i*=f);const s=o/2;return g(t,o,s,s,i,0)}const _=c();export{M as ArrowManipulator};