UNPKG

@arcgis/core

Version:

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

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