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