@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.42 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as e,doubleSubArray as t}from"../../../../geometry/support/DoubleArray.js";import{CounterClockwiseMode as n,ringsToTriangulationInfo as r}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as i}from"../../layers/graphics/elevationAlignmentUtils.js";import{drapedZ as s}from"../../terrain/OverlayRenderer.js";function p(o,t,s,p){const l="polygon"===o.type?n.CCW_IS_HOLE:n.NONE,a="polygon"===o.type?o.rings:o.paths,{position:u,outlines:f}=r(a,!!o.hasZ,l,o.spatialReference),m=e(u.length),g=i(u,o.spatialReference,0,m,0,u,0,u.length/3,t,s,p),y=null!=g;return{lines:y?c(f,u,m):[],projectionSuccess:y,sampledElevation:g}}function l(e,t){const i="polygon"===e.type?n.CCW_IS_HOLE:n.NONE,p="polygon"===e.type?e.rings:e.paths,{position:l,outlines:a}=r(p,!1,i),u=o(l,e.spatialReference,0,l,t,0);for(let o=2;o<l.length;o+=3)l[o]=s;return{lines:u?c(a,l):[],projectionSuccess:u}}function c(o,e,n=null){const r=new Array;for(const{index:i,count:s}of o){if(s<=1)continue;const o=3*i,p=3*s;r.push({position:t(e,3*i,3*s),mapPositions:null!=n?t(n,o,p):void 0})}return r}export{p as geometryToRenderInfo,l as geometryToRenderInfoDraped};