@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.29 kB
JavaScript
import{isSome as o}from"../../../../core/maybe.js";import{projectBuffer as e}from"../../../../geometry/projection.js";import{CounterClockwiseMode as n,pathsToTriangulationInfo as t}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as r}from"../../layers/graphics/elevationAlignmentUtils.js";import{DRAPED_Z as i}from"../../terrain/OverlayRenderer.js";import{newDoubleArray as s,doubleSubArray as l}from"../../webgl-engine/lib/DoubleArray.js";function p(o,e,i,l){const p="polygon"===o.type?n.CCW_IS_HOLE:n.NONE,c="polygon"===o.type?o.rings:o.paths,{position:m,outlines:u}=t(c,!!o.hasZ,p),g=s(m.length),f=r(m,o.spatialReference,0,g,0,m,0,m.length/3,e,i,l),y=null!=f;return{lines:y?a(u,m,g):[],projectionSuccess:y,sampledElevation:f}}function c(o,r){const s="polygon"===o.type?n.CCW_IS_HOLE:n.NONE,l="polygon"===o.type?o.rings:o.paths,{position:p,outlines:c}=t(l,!1,s),m=e(p,o.spatialReference,0,p,r,0,p.length/3);for(let e=2;e<p.length;e+=3)p[e]=i;return{lines:m?a(c,p):[],projectionSuccess:m}}function a(e,n,t=null){const r=new Array;for(const{index:i,count:s}of e){if(s<=1)continue;const e=3*i,p=3*s;r.push({position:l(n,3*i,3*s),mapPositions:o(t)?l(t,e,p):void 0})}return r}export{p as geometryToRenderInfo,c as geometryToRenderInfoDraped};