UNPKG

cong-gis-viewer

Version:

The minimal recommended setup for an app using Cesium with Webpack 5

2 lines 6.05 kB
/*! For license information please see createPolylineGeometry.js.LICENSE.txt */ import{a as m}from"./chunk-45XN4A3L.js";import{a as N}from"./chunk-VBA7BAEC.js";import{a as U}from"./chunk-A3LWLQUH.js";import"./chunk-T2PCUASF.js";import{a as k}from"./chunk-IQ5VZFOA.js";import{a as le}from"./chunk-QG27EHKP.js";import"./chunk-XTD56O4T.js";import"./chunk-MQA5R2TD.js";import"./chunk-BNIMZJFI.js";import{a as se}from"./chunk-UENNBKKY.js";import{a as ce}from"./chunk-ZV2BSYVW.js";import{a as ne,b as re,c as ie,d as O}from"./chunk-3WTHA73F.js";import{d as oe}from"./chunk-MEAQKBL7.js";import"./chunk-RKBLQ2M4.js";import{a as x}from"./chunk-K3VQHMI6.js";import{a as p,d as u}from"./chunk-UTRPTI5S.js";import{a as J}from"./chunk-TFNGIACM.js";import"./chunk-ISVCOS3X.js";import"./chunk-XUAQFAMT.js";import{a as A}from"./chunk-OW23VKVW.js";import{a as V}from"./chunk-LKAZ42NI.js";import{e as h}from"./chunk-MYHWD27O.js";var me=[];function Ae(e,t,r,o,n){let a=me;a.length=n;let i,s=r.red,l=r.green,p=r.blue,c=r.alpha,h=o.red,u=o.green,d=o.blue,f=o.alpha;if(m.equals(r,o)){for(i=0;i<n;i++)a[i]=m.clone(r);return a}let k=(h-s)/n,A=(u-l)/n,g=(d-p)/n,w=(f-c)/n;for(i=0;i<n;i++)a[i]=new m(s+i*k,l+i*A,p+i*g,c+i*w);return a}function G(e){let t=(e=A(e,A.EMPTY_OBJECT)).positions,r=e.colors,o=A(e.width,1),n=A(e.colorsPerVertex,!1);if(!h(t)||t.length<2)throw new V("At least two positions are required.");if("number"!=typeof o)throw new V("width must be a number");if(h(r)&&(n&&r.length<t.length||!n&&r.length<t.length-1))throw new V("colors has an invalid length.");this._positions=t,this._colors=r,this._width=o,this._colorsPerVertex=n,this._vertexFormat=k.clone(A(e.vertexFormat,k.DEFAULT)),this._arcType=A(e.arcType,N.GEODESIC),this._granularity=A(e.granularity,J.RADIANS_PER_DEGREE),this._ellipsoid=u.clone(A(e.ellipsoid,u.default)),this._workerName="createPolylineGeometry";let a=1+t.length*p.packedLength;a+=h(r)?1+r.length*m.packedLength:1,this.packedLength=a+u.packedLength+k.packedLength+4}G.pack=function(e,t,r){if(!h(e))throw new V("value is required");if(!h(t))throw new V("array is required");r=A(r,0);let o,n=e._positions,a=n.length;for(t[r++]=a,o=0;o<a;++o,r+=p.packedLength)p.pack(n[o],t,r);let i=e._colors;for(a=h(i)?i.length:0,t[r++]=a,o=0;o<a;++o,r+=m.packedLength)m.pack(i[o],t,r);return u.pack(e._ellipsoid,t,r),r+=u.packedLength,k.pack(e._vertexFormat,t,r),r+=k.packedLength,t[r++]=e._width,t[r++]=e._colorsPerVertex?1:0,t[r++]=e._arcType,t[r]=e._granularity,t};var de=u.clone(u.UNIT_SPHERE),ue=new k,S={positions:void 0,colors:void 0,ellipsoid:de,vertexFormat:ue,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};G.unpack=function(e,t,r){if(!h(e))throw new V("array is required");t=A(t,0);let o,n=e[t++],a=new Array(n);for(o=0;o<n;++o,t+=p.packedLength)a[o]=p.unpack(e,t);n=e[t++];let i=n>0?new Array(n):void 0;for(o=0;o<n;++o,t+=m.packedLength)i[o]=m.unpack(e,t);let s=u.unpack(e,t,de);t+=u.packedLength;let l=k.unpack(e,t,ue);t+=k.packedLength;let c=e[t++],d=1===e[t++],f=e[t++],g=e[t];return h(r)?(r._positions=a,r._colors=i,r._ellipsoid=u.clone(s,r._ellipsoid),r._vertexFormat=k.clone(l,r._vertexFormat),r._width=c,r._colorsPerVertex=d,r._arcType=f,r._granularity=g,r):(S.positions=a,S.colors=i,S.width=c,S.colorsPerVertex=d,S.arcType=f,S.granularity=g,new G(S))};var pe=new p,ae=new p,fe=new p,he=new p;G.createGeometry=function(e){let t,r,o,n=e._width,a=e._vertexFormat,i=e._colors,s=e._colorsPerVertex,l=e._arcType,c=e._granularity,u=e._ellipsoid,d=[],f=le(e._positions,p.equalsEpsilon,!1,d);if(h(i)&&d.length>0){let e=0,t=d[0];i=i.filter((function(r,o){let n=!1;return n=s?o===t||0===o&&1===t:o+1===t,!n||(e++,t=d[e],!1)}))}let k=f.length;if(k<2||n<=0)return;if(l===N.GEODESIC||l===N.RHUMB){let e,o;l===N.GEODESIC?(e=J.chordLength(c,u.maximumRadius),o=U.numberOfPoints):(e=c,o=U.numberOfPointsRhumbLine);let n=U.extractHeights(f,u);if(h(i)){let n=1;for(t=0;t<k-1;++t)n+=o(f[t],f[t+1],e);let a=new Array(n),l=0;for(t=0;t<k-1;++t){let p=f[t],c=f[t+1],h=i[t],u=o(p,c,e);if(s&&t<n){let e=Ae(p,c,h,i[t+1],u),o=e.length;for(r=0;r<o;++r)a[l++]=e[r]}else for(r=0;r<u;++r)a[l++]=m.clone(h)}a[l]=m.clone(i[i.length-1]),i=a,me.length=0}f=l===N.GEODESIC?U.generateCartesianArc({positions:f,minDistance:e,ellipsoid:u,height:n}):U.generateCartesianRhumbArc({positions:f,granularity:e,ellipsoid:u,height:n})}k=f.length;let A,g=4*k-4,w=new Float64Array(3*g),y=new Float64Array(3*g),_=new Float64Array(3*g),v=new Float32Array(2*g),T=a.st?new Float32Array(2*g):void 0,L=h(i)?new Uint8Array(4*g):void 0,E=0,P=0,S=0,j=0;for(r=0;r<k;++r){let e,t;0===r?(A=pe,p.subtract(f[0],f[1],A),p.add(f[0],A,A)):A=f[r-1],p.clone(A,fe),p.clone(f[r],ae),r===k-1?(A=pe,p.subtract(f[k-1],f[k-2],A),p.add(f[k-1],A,A)):A=f[r+1],p.clone(A,he),h(L)&&(e=0===r||s?i[r]:i[r-1],r!==k-1&&(t=i[r]));let l=r===k-1?2:4;for(o=0===r?2:0;o<l;++o){p.pack(ae,w,E),p.pack(fe,y,E),p.pack(he,_,E),E+=3;let i=o-2<0?-1:1;if(v[P++]=o%2*2-1,v[P++]=i*n,a.st&&(T[S++]=r/(k-1),T[S++]=Math.max(v[P-2],0)),h(L)){let r=o<2?e:t;L[j++]=m.floatToByte(r.red),L[j++]=m.floatToByte(r.green),L[j++]=m.floatToByte(r.blue),L[j++]=m.floatToByte(r.alpha)}}}let V=new ce;V.position=new O({componentDatatype:x.DOUBLE,componentsPerAttribute:3,values:w}),V.prevPosition=new O({componentDatatype:x.DOUBLE,componentsPerAttribute:3,values:y}),V.nextPosition=new O({componentDatatype:x.DOUBLE,componentsPerAttribute:3,values:_}),V.expandAndWidth=new O({componentDatatype:x.FLOAT,componentsPerAttribute:2,values:v}),a.st&&(V.st=new O({componentDatatype:x.FLOAT,componentsPerAttribute:2,values:T})),h(L)&&(V.color=new O({componentDatatype:x.UNSIGNED_BYTE,componentsPerAttribute:4,values:L,normalize:!0}));let b=se.createTypedArray(g,6*k-6),D=0,F=0,G=k-1;for(r=0;r<G;++r)b[F++]=D,b[F++]=D+2,b[F++]=D+1,b[F++]=D+1,b[F++]=D+2,b[F++]=D+3,D+=4;return new ie({attributes:V,indices:b,primitiveType:re.TRIANGLES,boundingSphere:oe.fromPoints(f),geometryType:ne.POLYLINES})};var Q=G;function ge(e,t){return h(t)&&(e=Q.unpack(e,t)),e._ellipsoid=u.clone(e._ellipsoid),Q.createGeometry(e)}var We=ge;export{We as default};