UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.62 kB
import{isSome as r,isNone as t,applySome as e}from"../../../../core/maybe.js";import{l as n}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/vec3f64.js";import{diameter as a}from"../../../../geometry/support/aaBoundingBox.js";import{a as o}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as c,isI3sIntersectorResult as u,isVoxelIntersectorResult as s}from"../../layers/i3s/Intersector.js";import{isTerrainIntersectorResult as l,isOverlayIntersectorResult as p}from"../../terrain/Intersector.js";import{isObjectIntersectorResult as g,isHudIntersectorResult as f}from"./intersectorUtils.js";import{isLodIntersectorResult as m}from"./lodRendering/Intersector.js";function d(r,t){return g(r)||f(r)?B(r.target?.object.metadata,t):l(r)?t.map?.ground:c(r)||u(r)||p(r)||s(r)?B(r.target,t):null}function h(t,e){const n=y(t,e);return r(n)&&"graphic"===n.type?n.graphic:null}function y(r,e){if(t(r))return null;if(g(r)||f(r))return j(r.target?.object.metadata,e);if(c(r)){const t=r.target.createGraphic();return{type:"graphic",graphic:t,layer:t.layer}}if(s(r)){const t=r.target.createVoxelGraphic();return{type:"graphic",graphic:t,layer:t.layer}}return p(r)||m(r)?j(r.target,e):u(r)?U(r.target,e):null}function j(r,e){if(t(r)||t(r.graphicUid))return null;const n=B(r,e);if(t(n))return null;if(n===e.graphics)return t(e.graphicsView)||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid);const i=e.allLayerViews.find((r=>r.layer===n));return!i||i.suspended||t(r.graphicUid)?null:"getHit"in i?i.getHit(r.graphicUid):null}function U(r,e){const n=B(r,e);if(t(n))return null;const i=e.allLayerViews.find((r=>r.layer===n));return i&&!i.suspended&&"getGraphicFromIntersectorTarget"in i?b(i.getGraphicFromIntersectorTarget(r)):null}function V(r,e){const n=B(r,e);if(t(n))return null;const i=e.allLayerViews.find((r=>r.layer===n));return i&&!i.suspended&&"getAABBFromIntersectorTarget"in i?i.getAABBFromIntersectorTarget(r):null}function b(t){return r(t)?{type:"graphic",graphic:t,layer:t.layer}:null}function B(e,n){return!e||t(e.layerUid)?null:r(n.graphicsView)&&e.layerUid===n.graphicsView.processor.layer.id?n.graphics:n.map.findLayerByUid(e.layerUid)}function w(r,t){if(g(r)||f(r))return o(r.target.object.boundingVolumeWorldSpace.bounds);if(m(r)){n(L,r.transformation);const t=Math.max(L[0],L[1],L[2]);return r.target.baseBoundingSphere.radius*t}return u(r)?e(V(r.target,t),(r=>.5*a(r))):null}function I(r){return!g(r)&&!f(r)&&(m(r)?r.target.numLodLevels>1:!!u(r))}const L=i();export{w as getIntersectedFeatureBSRadius,I as hasLod,h as toGraphic,y as toHit,d as toOwner};