UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.67 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as r}from"../../../../geometry/projection/projectPointToVector.js";import{makeDehydratedPoint as i}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationInfo as n}from"../../../../support/elevationInfoUtils.js";import{evaluateElevationInfoAtPoint as s,SampleElevationInfo as a}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{extractExpressionInfo as f,createContext as c}from"./featureExpressionInfoUtils.js";async function l(l,m,d,j,u){const{elevationProvider:v,renderCoordsHelper:g}=l,{elevationInfo:I}=m,{pointsInFeatures:x,spatialReference:y}=j,h=t.fromJSON(y),w=f(I,!0),R=await c(w,h,u);e(u);const S=[],b=new Set,z=new Set,E=new p,P=i(0,0,0,t.WGS84),U=new a,C=o();P.spatialReference=h;const F=l.elevationProvider.spatialReference??l.spatialReference;for(const{objectId:e,points:o}of x){const t=d(e);if(null==t){for(const e of o)S.push(e.z??0);b.add(e);continue}t.isDraped&&z.add(e);const i=t.graphic.geometry;E.setFromElevationInfo(n(i,I)),E.updateFeatureExpressionInfoContext(R,t.graphic,m);for(const{x:e,y:n,z:a}of o)P.x=e,P.y=n,P.z=a??0,await r(P,C,F,0,{signal:u}),s(C,v,E,g,U),S.push(U.z)}return{elevations:S,drapedObjectIds:z,failedObjectIds:b}}export{l as elevationAlignPointsInFeatures};