UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.3 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{getEndpoint as t,cloneCurve as e}from"../../../../geometry/support/curves/curveUtils.js";import{create as r,markAsTarget as n,fromValues as d}from"../../sketch/normalizedPoint.js";import{DrapedEdgeSnappingCandidate as a}from"../candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as o}from"../candidates/EdgeSnappingCandidate.js";import{VertexSnappingCandidate as i}from"../candidates/VertexSnappingCandidate.js";function g(t,e){const{x:r,y:n}=t,a="3d"===e&&null!=t.z?t.z:0;return d(r,n,a)}function c(r,n){if(!r)return null;const d=t(r)[2]??0,a="3d"===n?d:0,o=e(r);return t(o)[2]=a,o}function s(t,e,d){switch(t.type){case"edge":return t.draped?new a({edgeStart:g(t.start,e),edgeEnd:g(t.end,e),targetPoint:n(g(t.target,e)),objectId:t.objectId,getGroundElevation:d}):new o({edgeStart:g(t.start,e),edgeEnd:g(t.end,e),targetPoint:n(g(t.target,e)),objectId:t.objectId,isDraped:!1,curve:c(t.curve,e)});case"vertex":return new i({targetPoint:n(g(t.target,e)),objectId:t.objectId,isDraped:!1,originalTargetPoint:r(t.target.x,t.target.y,t.target.z)})}}function p(t,e){return"3d"===t?.type?(r,n)=>t.elevationProvider.getElevation(r,n,0,e,"ground"):()=>null}export{s as convertSnappingCandidate,p as makeGetGroundElevation};