cong-gis-viewer
Version:
The minimal recommended setup for an app using Cesium with Webpack 5
2 lines • 5.45 kB
JavaScript
/*! For license information please see chunk-S6F2UFMI.js.LICENSE.txt */
import{a as Z}from"./chunk-A3LWLQUH.js";import{a as R}from"./chunk-ZS2W345Z.js";import{a as ae,b as v,f as _,g as se,h as le}from"./chunk-RKBLQ2M4.js";import{a as e,b as ce,c as $,e as j}from"./chunk-UTRPTI5S.js";import{a as Q}from"./chunk-TFNGIACM.js";var we={ROUNDED:0,MITERED:1,BEVELED:2},L=Object.freeze(we),g=[new e,new e],ge=new e,pe=new e,xe=new e,Se=new e,Te=new e,Ee=new e,Be=new e,Ce=new e,ze=new e,P=new e,W=new e,I={},ee=new ce;function Ae(e,t){let n=new Array(e.length);for(let r=0;r<e.length;r++){let a=e[r];ee=t.cartesianToCartographic(a,ee),n[r]=ee.height,e[r]=t.scaleToGeodeticSurface(a,a)}return n}function te(t,n,r,a){let o,l=t[0],i=t[1],c=e.angleBetween(l,i),s=Math.ceil(c/a),u=new Array(s);if(n===r){for(o=0;o<s;o++)u[o]=n;return u.push(r),u}let g=(r-n)/s;for(o=1;o<s;o++){let e=n+o*g;u[o]=e}return u[0]=n,u.push(r),u}var X=new e,Y=new e;function Oe(t,n,r,a){let o=new R(r,a),l=o.projectPointOntoPlane(e.add(r,t,X),X),i=o.projectPointOntoPlane(e.add(r,n,Y),Y),c=$.angleBetween(l,i);return i.x*l.y-i.y*l.x>=0?-c:c}var je=new e(-1,0,0),N=new v,De=new v,re=new j,Me=j.IDENTITY.clone(),ve=new e,Ne=new ae,ie=new e;function D(t,n,r,a,o,l,i,c){let s=ve,u=Ne;N=se.eastNorthUpToFixedFrame(t,o,N),s=v.multiplyByPointAsVector(N,je,s),s=e.normalize(s,s);let g=Oe(s,n,t,o);re=j.fromRotationZ(g,re),ie.z=l,N=v.multiplyTransformation(N,v.fromRotationTranslation(re,ie,De),N);let m=Me;m[0]=i;for(let t=0;t<c;t++)for(let t=0;t<r.length;t+=3)u=e.fromArray(r,t,u),u=j.multiplyByVector(m,u,u),u=v.multiplyByPoint(N,u,u),a.push(u.x,u.y,u.z);return a}var Ve=new e;function ne(t,n,r,a,o,l,i){for(let c=0;c<t.length;c+=3)a=D(e.fromArray(t,c,Ve),n,r,a,o,l[c/3],i,1);return a}function be(e,t){let n=e.length,r=new Array(6*n),a=0,o=t.x+t.width/2,l=t.y+t.height/2,i=e[0];r[a++]=i.x-o,r[a++]=0,r[a++]=i.y-l;for(let t=1;t<n;t++){i=e[t];let n=i.x-o,c=i.y-l;r[a++]=n,r[a++]=0,r[a++]=c,r[a++]=n,r[a++]=0,r[a++]=c}return i=e[0],r[a++]=i.x-o,r[a++]=0,r[a++]=i.y-l,r}function fe(e,t){let n=e.length,r=new Array(3*n),a=0,o=t.x+t.width/2,l=t.y+t.height/2;for(let t=0;t<n;t++)r[a++]=e[t].x-o,r[a++]=0,r[a++]=e[t].y-l;return r}var me=new _,ue=new e,he=new j;function ye(t,n,r,a,o,l,i,c,s,u){let g,m,f,y=e.angleBetween(e.subtract(n,t,P),e.subtract(r,t,W)),d=a===L.BEVELED?0:Math.ceil(y/Q.toRadians(5));if(g=o?j.fromQuaternion(_.fromAxisAngle(e.negate(t,P),y/(d+1),me),he):j.fromQuaternion(_.fromAxisAngle(t,y/(d+1),me),he),n=e.clone(n,ue),d>0){let r=u?2:1;for(let a=0;a<d;a++)n=j.multiplyByVector(g,n,n),m=e.subtract(n,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(n,W),i=D(f,m,c,i,l,s,1,r)}else m=e.subtract(n,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(n,W),i=D(f,m,c,i,l,s,1,1),r=e.clone(r,ue),m=e.subtract(r,t,P),m=e.normalize(m,m),o||(m=e.negate(m,m)),f=l.scaleToGeodeticSurface(r,W),i=D(f,m,c,i,l,s,1,1);return i}I.removeDuplicatesFromShape=function(e){let t=e.length,n=[];for(let r=t-1,a=0;a<t;r=a++){let t=e[r],o=e[a];$.equals(t,o)||n.push(o)}return n},I.angleIsGreaterThanPi=function(t,n,r,a){let o=new R(r,a),l=o.projectPointOntoPlane(e.add(r,t,X),X),i=o.projectPointOntoPlane(e.add(r,n,Y),Y);return i.x*l.y-i.y*l.x>=0};var Fe=new e,Ge=new e;I.computePositions=function(t,n,r,a,o){let l=a._ellipsoid,i=Ae(t,l),c=a._granularity,s=a._cornerType,u=o?be(n,r):fe(n,r),m=o?fe(n,r):void 0,f=r.height/2,y=r.width/2,d=t.length,w=[],h=o?[]:void 0,p=ge,B=pe,E=xe,j=Se,v=Te,S=Ee,A=Be,N=Ce,T=ze,x=t[0],z=t[1];j=l.geodeticSurfaceNormal(x,j),p=e.subtract(z,x,p),p=e.normalize(p,p),N=e.cross(j,p,N),N=e.normalize(N,N);let b,R,O=i[0],G=i[1];o&&(h=D(x,N,m,h,l,O+f,1,1)),T=e.clone(x,T),x=z,B=e.negate(p,B);for(let n=1;n<d-1;n++){let r=o?2:1;if(z=t[n+1],x.equals(z)){le("Positions are too close and are considered equivalent with rounding error.");continue}p=e.subtract(z,x,p),p=e.normalize(p,p),E=e.add(p,B,E),E=e.normalize(E,E),j=l.geodeticSurfaceNormal(x,j);let a=e.multiplyByScalar(j,e.dot(p,j),Fe);e.subtract(p,a,a),e.normalize(a,a);let m=e.multiplyByScalar(j,e.dot(B,j),Ge);if(e.subtract(B,m,m),e.normalize(m,m),Q.equalsEpsilon(Math.abs(e.dot(a,m)),1,Q.EPSILON7))w=D(T,N,u,w,l,O+f,1,1),T=x;else{E=e.cross(E,j,E),E=e.cross(j,E,E),E=e.normalize(E,E);let t=1/Math.max(.25,e.magnitude(e.cross(E,B,P))),n=I.angleIsGreaterThanPi(p,B,x,l);n?(v=e.add(x,e.multiplyByScalar(E,t*y,E),v),S=e.add(v,e.multiplyByScalar(N,y,S),S),g[0]=e.clone(T,g[0]),g[1]=e.clone(S,g[1]),b=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,N,u,w,l,b,1),N=e.cross(j,p,N),N=e.normalize(N,N),A=e.add(v,e.multiplyByScalar(N,y,A),A),s===L.ROUNDED||s===L.BEVELED?ye(v,S,A,s,n,l,w,u,G+f,o):(E=e.negate(E,E),w=D(x,E,u,w,l,G+f,t,r)),T=e.clone(A,T)):(v=e.add(x,e.multiplyByScalar(E,t*y,E),v),S=e.add(v,e.multiplyByScalar(N,-y,S),S),g[0]=e.clone(T,g[0]),g[1]=e.clone(S,g[1]),b=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,N,u,w,l,b,1),N=e.cross(j,p,N),N=e.normalize(N,N),A=e.add(v,e.multiplyByScalar(N,-y,A),A),s===L.ROUNDED||s===L.BEVELED?ye(v,S,A,s,n,l,w,u,G+f,o):w=D(x,E,u,w,l,G+f,t,r),T=e.clone(A,T)),B=e.negate(p,B)}O=G,G=i[n+1],x=z}g[0]=e.clone(T,g[0]),g[1]=e.clone(x,g[1]),b=te(g,O+f,G+f,c),R=Z.generateArc({positions:g,granularity:c,ellipsoid:l}),w=ne(R,N,u,w,l,b,1),o&&(h=D(x,N,m,h,l,G+f,1,1)),d=w.length;let M=o?d+h.length:d,V=new Float64Array(M);return V.set(w),o&&V.set(h,d),V};var $e=I;export{L as a,$e as b};