@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.02 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import e from"../../../../core/Handles.js";import{watch as t,initial as r}from"../../../../core/reactiveUtils.js";import{fromTranslation as i,mul as o,fromXRotation as s,fromYRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{displayFocusMultiplier as m}from"../Slice/sliceToolConfig.js";import{viewshedToolManipulatorConfiguration as p}from"./ViewshedConfiguration.js";import{Manipulator3D as f}from"../../interactive/Manipulator3D.js";import{RenderObject as h}from"../../interactive/RenderObject.js";import{createTubeGeometry as d,createExtrudedTriangle as u}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as g}from"../../webgl-engine/materials/ColorMaterial.js";class j extends f{constructor(t,r){super({view:t,autoScaleRenderObjects:!1,worldSized:!1,radius:p.collisionRadius}),this._handles=new e,this._setupManipulatorVisual(r)}destroy(){this._handles.remove(),super.destroy()}_setupManipulatorVisual(e){const t=this._createMaterial(),r=1,f=[c(0,0,0),c(0,0,r)],u=d(t,f,e,16,!1),g=d(t,f,e*m,16,!1),j=w(!1,t,e),v=w(!0,t,e),M=n();i(M,f[f.length-1]),o(M,M,s(b,Math.PI/2)),o(M,M,a(b,Math.PI/2)),j.transformation=M,v.transformation=M,this.renderObjects=[new h(u,1),new h(g,2),new h(j,1),new h(v,2)];const _=c(0,p.getScaleOrientArrowTipLength(!0),0),x=l(_,_,M),O=[...f,x];this.collisionType={type:"line",paths:[O]}}_createMaterial(){const e=new g({cullFace:2,renderOccluded:4,isDecoration:!0});return this._handles.add(t(()=>this.view.effectiveTheme.accentColor.toUnitRGBA(),t=>e.setParameters({color:t}),r)),e}}function w(e,t,r){const i=p.getScaleOrientArrowTipLength(e);let o=2*r;e&&(o*=m);const s=i/2;return u(t,i,s,s,o,0)}const b=n();export{j as ViewshedArrowManipulator};