cong-gis-viewer
Version:
The minimal recommended setup for an app using Cesium with Webpack 5
2 lines • 6.08 kB
JavaScript
/*! For license information please see createCoplanarPolygonGeometry.js.LICENSE.txt */
import{a as et}from"./chunk-6W2TVXDY.js";import{a as U}from"./chunk-TW7T3OJP.js";import"./chunk-NSYXLK76.js";import{a as y}from"./chunk-QX4ZGQIG.js";import"./chunk-VBA7BAEC.js";import{a as I}from"./chunk-AYJ4ONX4.js";import{a as $}from"./chunk-LOUU3TR2.js";import"./chunk-EU6MOGEX.js";import"./chunk-75LITNK5.js";import{a as u}from"./chunk-IQ5VZFOA.js";import"./chunk-ZS2W345Z.js";import"./chunk-XS3SI335.js";import{b as ot}from"./chunk-NXJBWKCJ.js";import{a as tt}from"./chunk-QG27EHKP.js";import"./chunk-XTD56O4T.js";import"./chunk-MQA5R2TD.js";import"./chunk-BNIMZJFI.js";import{a as J}from"./chunk-UENNBKKY.js";import{a as X}from"./chunk-ZV2BSYVW.js";import{b as W,c as Y,d as z}from"./chunk-3WTHA73F.js";import{d as K}from"./chunk-MEAQKBL7.js";import{f as Q}from"./chunk-RKBLQ2M4.js";import{a as N}from"./chunk-K3VQHMI6.js";import{a as i,c as x,d as m,e as P}from"./chunk-UTRPTI5S.js";import{a as q}from"./chunk-TFNGIACM.js";import"./chunk-ISVCOS3X.js";import"./chunk-XUAQFAMT.js";import{a as f}from"./chunk-OW23VKVW.js";import{b as B}from"./chunk-LKAZ42NI.js";import{e as g}from"./chunk-MYHWD27O.js";var st=new i,at=new et,pt=new x,lt=new x,mt=new i,ft=new i,ut=new i,V=new i,yt=new i,ht=new i,nt=new Q,dt=new P,gt=new P,Pt=new i;function wt(t,e,n,o,r,a,s,c,p){let l=t.positions,u=ot.triangulate(t.positions2D,t.holes);u.length<3&&(u=[0,1,2]);let m=J.createTypedArray(l.length,u.length);m.set(u);let h=dt;if(0!==o){let t=Q.fromAxisAngle(s,o,nt);if(h=P.fromQuaternion(t,h),e.tangent||e.bitangent){t=Q.fromAxisAngle(s,-o,nt);let n=P.fromQuaternion(t,gt);c=i.normalize(P.multiplyByVector(n,c,c),c),e.bitangent&&(p=i.normalize(i.cross(s,c,p),p))}}else h=P.clone(P.IDENTITY,h);let y=lt;e.st&&(y.x=n.x,y.y=n.y);let d=l.length,f=3*d,k=new Float64Array(f),A=e.normal?new Float32Array(f):void 0,w=e.tangent?new Float32Array(f):void 0,j=e.bitangent?new Float32Array(f):void 0,T=e.st?new Float32Array(2*d):void 0,v=0,_=0,E=0,F=0,b=0;for(let t=0;t<d;t++){let o=l[t];if(k[v++]=o.x,k[v++]=o.y,k[v++]=o.z,e.st)if(g(r)&&r.positions.length===d)T[b++]=r.positions[t].x,T[b++]=r.positions[t].y;else{let t=a(P.multiplyByVector(h,o,st),pt);x.subtract(t,y,t);let e=q.clamp(t.x/n.width,0,1),i=q.clamp(t.y/n.height,0,1);T[b++]=e,T[b++]=i}e.normal&&(A[_++]=s.x,A[_++]=s.y,A[_++]=s.z),e.tangent&&(w[F++]=c.x,w[F++]=c.y,w[F++]=c.z),e.bitangent&&(j[E++]=p.x,j[E++]=p.y,j[E++]=p.z)}let L=new X;return e.position&&(L.position=new z({componentDatatype:N.DOUBLE,componentsPerAttribute:3,values:k})),e.normal&&(L.normal=new z({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:A})),e.tangent&&(L.tangent=new z({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:w})),e.bitangent&&(L.bitangent=new z({componentDatatype:N.FLOAT,componentsPerAttribute:3,values:j})),e.st&&(L.st=new z({componentDatatype:N.FLOAT,componentsPerAttribute:2,values:T})),new Y({attributes:L,indices:m,primitiveType:W.TRIANGLES})}function E(t){let e=(t=f(t,f.EMPTY_OBJECT)).polygonHierarchy,n=t.textureCoordinates;B.defined("options.polygonHierarchy",e);let o=f(t.vertexFormat,u.DEFAULT);this._vertexFormat=u.clone(o),this._polygonHierarchy=e,this._stRotation=f(t.stRotation,0),this._ellipsoid=m.clone(f(t.ellipsoid,m.default)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=y.computeHierarchyPackedLength(e,i)+u.packedLength+m.packedLength+(g(n)?y.computeHierarchyPackedLength(n,x):1)+2}E.fromPositions=function(t){return t=f(t,f.EMPTY_OBJECT),B.defined("options.positions",t.positions),new E({polygonHierarchy:{positions:t.positions},vertexFormat:t.vertexFormat,stRotation:t.stRotation,ellipsoid:t.ellipsoid,textureCoordinates:t.textureCoordinates})},E.pack=function(t,e,n){return B.typeOf.object("value",t),B.defined("array",e),n=f(n,0),n=y.packPolygonHierarchy(t._polygonHierarchy,e,n,i),m.pack(t._ellipsoid,e,n),n+=m.packedLength,u.pack(t._vertexFormat,e,n),n+=u.packedLength,e[n++]=t._stRotation,g(t._textureCoordinates)?n=y.packPolygonHierarchy(t._textureCoordinates,e,n,x):e[n++]=-1,e[n++]=t.packedLength,e};var _t=m.clone(m.UNIT_SPHERE),At=new u,bt={polygonHierarchy:{}};E.unpack=function(t,e,n){B.defined("array",t),e=f(e,0);let o=y.unpackPolygonHierarchy(t,e,i);e=o.startingIndex,delete o.startingIndex;let r=m.unpack(t,e,_t);e+=m.packedLength;let a=u.unpack(t,e,At);e+=u.packedLength;let s=t[e++],c=-1===t[e]?void 0:y.unpackPolygonHierarchy(t,e,x);g(c)?(e=c.startingIndex,delete c.startingIndex):e++;let p=t[e++];return g(n)||(n=new E(bt)),n._polygonHierarchy=o,n._ellipsoid=m.clone(r,n._ellipsoid),n._vertexFormat=u.clone(a,n._vertexFormat),n._stRotation=s,n._textureCoordinates=c,n.packedLength=p,n},E.createGeometry=function(t){let e=t._vertexFormat,n=t._polygonHierarchy,o=t._stRotation,r=t._textureCoordinates,a=g(r),s=n.positions;if(s=tt(s,i.equalsEpsilon,!0),s.length<3)return;let c=mt,p=ft,l=ut,u=yt,m=ht;if(!U.computeProjectTo2DArguments(s,V,u,m))return;if(c=i.cross(u,m,c),c=i.normalize(c,c),!i.equalsEpsilon(V,i.ZERO,q.EPSILON6)){let e=t._ellipsoid.geodeticSurfaceNormal(V,Pt);i.dot(c,e)<0&&(c=i.negate(c,c),u=i.negate(u,u))}let h=U.createProjectPointsTo2DFunction(V,u,m),d=U.createProjectPointTo2DFunction(V,u,m);e.tangent&&(p=i.clone(u,p)),e.bitangent&&(l=i.clone(m,l));let f=y.polygonsFromHierarchy(n,a,h,!1),k=f.hierarchy,x=f.polygons,A=a?y.polygonsFromHierarchy(r,!0,(function(t){return t}),!1).polygons:void 0;if(0===k.length)return;s=k[0].outerRing;let P=K.fromPoints(s),w=y.computeBoundingRectangle(c,d,s,o,at),j=[];for(let t=0;t<x.length;t++){let n=new I({geometry:wt(x[t],e,w,o,a?A[t]:void 0,d,c,p,l)});j.push(n)}let T=$.combineInstances(j)[0];T.attributes.position.values=new Float64Array(T.attributes.position.values),T.indices=J.createTypedArray(T.attributes.position.values.length/3,T.indices);let v=T.attributes;return e.position||delete v.position,new Y({attributes:v,indices:T.indices,primitiveType:T.primitiveType,boundingSphere:P})};var Z=E;function kt(t,e){return g(e)&&(t=Z.unpack(t,e)),Z.createGeometry(t)}var Xt=kt;export{Xt as default};