@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 3.34 kB
JavaScript
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{isNone as t,isSome as s}from"../../../../core/maybe.js";import{screenPointObjectToArray as o}from"../../../../core/screenUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{c,n as a,g as p,a as m}from"../../../../chunks/vec3.js";import{a as l,c as d}from"../../../../chunks/vec3f64.js";import{create as u,copy as h,fromPoints as f}from"../../../../geometry/support/ray.js";import{sv2d as y}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as g}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as I}from"./LineOfSightIntersectionResult.js";import{isI3sIntersectorResult as j}from"../../layers/i3s/Intersector.js";import{fromScreen as v}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as w}from"../../terrain/Intersector.js";import{newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as P,IntersectorType as R}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as S}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let U=class extends r{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=b(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=P.MIN}getScreenPointIntersection(e){const r=o(e,y.get()),t=v(this.view.state.camera,r,_);return this._getRayIntersection(t)}_getRayIntersection(e,r){if(t(e)||t(this.view.sceneIntersectionHelper))return null;this.intersector.options.store=P.MIN,this.view.sceneIntersectionHelper.intersectToolIntersectorRay(e,this.intersector,r);const o=this.intersector.results.min,i=d();if(!o.getIntersectionPoint(i))return null;const n=this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference),c=l(o.normal);if(j(o))return new I({type:R.OBJECT,id:`${o.target.layerUid}/${o.target.nodeIndex}/${o.target.componentIndex}`,mapPoint:n,renderPoint:i,normal:c,ray:h(e),graphic:null});if(w(o))return new I({type:R.TERRAIN,id:o.target.lij.slice(),mapPoint:n,renderPoint:i,normal:c,ray:h(e),graphic:null});const a=S(o,this.view);if(s(a)){const r=a.layer,t=a.sourceLayer;let s;if(t)if("scene"===t.type)s=g(a,t.objectIdField);else s=a.uid;else s=a.uid;return new I({type:R.OBJECT,id:`${r?.uid}/${s}`,mapPoint:n,renderPoint:i,normal:c,ray:h(e),graphic:a})}return null}updateFromGroundIntersection(e,r,t){const o=O,i=C,n=L,d=T;c(i,e),this.view.renderCoordsHelper.worldUpAtPosition(i,n),a(n,n);const u=this.view.basemapTerrain.visibleElevationBounds,h=u?Math.abs(u.max-u.min):100,y=r>=0?1:-1;p(d,n,y*(h+Math.abs(r))),m(o,i,d),f(o,i,_);const g=this._getRayIntersection(_,{include:this._terrainIntersectionOptionsLayerUids});return s(g)?(p(d,n,y*r),m(t,g.renderPoint,d),l(g.normal)):(c(t,e),null)}};e([i()],U.prototype,"view",void 0),e([i()],U.prototype,"intersector",void 0),U=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],U);const O=d(),C=d(),L=d(),T=d(),_=u();export{U as LineOfSightRayIntersector};