UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.93 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as r}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as t}from"../../../../geometry/support/aaBoundingBox.js";import{getPointOnPath as n,getPathLength as o}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{applyElevationAlignmentForHUD as l}from"./elevationAlignmentUtils.js";import{computeCentroid as s}from"./graphicUtils.js";import{Object3D as c}from"../../webgl-engine/lib/Object3D.js";function a(e,r,t,n,o){if(u(e,r))return null;t.localOrigin=d(e,r);const i=new c({geometries:[t],castShadow:!1,layerViewUid:e.layerViewUid,graphicUid:o,usesVerticalDistanceToGround:!0});return{object:i,sampledElevation:l(i,r,e.elevationProvider,e.renderCoordsHelper,n)}}function p(e,r,t,n){if(u(r,t))return null;return l(e,t,r.elevationProvider,r.renderCoordsHelper,n)}function u(e,n){const o=e.clippingExtent;return!!o&&(r(n,g,e.elevationProvider.spatialReference),!t(o,g))}function m(e,t,n){const o=e.elevationContext,l=n.spatialReference;r(t,g,l),o.centerPointInElevationSR=i(g[0],g[1],t.hasZ?g[2]:0,null!=l?l:null)}function f(e){switch(e.type){case"point":return e;case"polygon":case"extent":return s(e);case"polyline":{const r=e.paths[0];if(!r||0===r.length)return null;const t=n(r,o(r)/2);return i(t[0],t[1],t[2],e.spatialReference)}case"mesh":return e.extent.center}return null}function d(e,t){return r(t,g,e.renderCoordsHelper.spatialReference),e.localOriginFactory.getOrigin(g)}const g=e();export{a as createStageObject,m as extendPointGraphicElevationContext,d as getLocalOriginForPoint,f as placePointOnGeometry,p as updateStageObjectGeometry};