UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.91 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{getScaling as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{diameter as t}from"../../../../geometry/support/aaBoundingBox.js";import{g as n}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as i,isI3sIntersectorResult as l,isVoxelIntersectorResult as a,isTiles3DIntersectorResult as o}from"../../layers/i3s/Intersector.js";import{isTerrainIntersectorResult as u,isOverlayIntersectorResult as c}from"../../terrain/Intersector.js";import{isObjectIntersectorResult as s,isHudIntersectorResult as g}from"./intersectorUtils.js";import{isLodIntersectorResult as p}from"./lodRendering/Intersector.js";function f(r,e){return s(r)||g(r)?U(r.target?.object,e):u(r)?e.map?.ground:i(r)||l(r)||c(r)||a(r)?U(r.target,e):null}function m(r,e){const t=h(r,e);return null!=t&&"graphic"===t.type?t.graphic:null}function h(r,e){if(null==r)return null;if(s(r)||g(r))return d(r.target?.object,e);if(i(r)){const e=r.target.createGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(a(r)){const e=r.target.createVoxelGraphic();return{type:"graphic",graphic:e,layer:e.layer}}if(o(r)){const e=r.target.createTiles3DGraphic();return{type:"graphic",graphic:e,layer:e.layer}}return c(r)||p(r)?d(r.target,e):l(r)?y(r.target,e):null}function d(r,e){if(null==r?.graphicUid)return null;const t=U(r,e);if(null==t)return null;if(t===e.graphics)return null==e.graphicsView||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid);const n=e.allLayerViews.find((r=>r.layer===t));return!n||n.suspended||null==r.graphicUid?null:"getHit"in n?n.getHit(r.graphicUid):null}function y(r,e){const t=U(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getGraphicFromIntersectorTarget"in n?b(n.getGraphicFromIntersectorTarget(r)):null}function j(r,e){const t=U(r,e);if(null==t)return null;const n=e.allLayerViews.find((r=>r.layer===t));return n&&!n.suspended&&"getAABBFromIntersectorTarget"in n?n.getAABBFromIntersectorTarget(r):null}function b(r){return null!=r?{type:"graphic",graphic:r,layer:r.layer}:null}function U(r,e){return null==r?.layerUid?null:null!=e.graphicsView&&r.layerUid===e.graphicsView.processor.layer.id?e.graphics:e.map.allLayers.find((e=>e.uid===r.layerUid))}function V(e,i){if(s(e)||g(e))return n(e.target.object.boundingVolumeWorldSpace.bounds);if(p(e)){r(B,e.transformation);const t=Math.max(B[0],B[1],B[2]);return e.target.baseBoundingSphere.radius*t}if(l(e)){const r=j(e.target,i);return r?.5*t(r):null}return null}function w(r){return!s(r)&&!g(r)&&(p(r)?r.target.numLodLevels>1:!!l(r))}const B=e();export{V as getIntersectedFeatureBSRadius,w as hasLod,m as toGraphic,h as toHit,f as toOwner};