Newer
Older
smartwell_front_dz / XLJCYJ / mars3d-cesium / Workers / chunk-3FJ6KZYW.js
wangxitong on 8 Jul 2024 9 KB 达州变更
/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.109.1
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
import{a as N}from"./chunk-7CAA5V4E.js";import{a as ot}from"./chunk-DB2DGJAQ.js";import{a as K,b as B}from"./chunk-ZODPEIAS.js";import{a as k}from"./chunk-5CQT33QV.js";import{a as F}from"./chunk-YPLRJVJ5.js";import{a as nt}from"./chunk-BBX2BII7.js";import{a as et}from"./chunk-BZJ4WRF6.js";import{b as Y,c as Q,d as H}from"./chunk-ESC6A27A.js";import{f as j}from"./chunk-FCJU2DRX.js";import{d as A}from"./chunk-Y3I2OBKV.js";import{a as q}from"./chunk-KUWODMWG.js";import{a as b,b as W,c as tt,d as z}from"./chunk-WADCMYQO.js";import{a as S}from"./chunk-2LQD2HPA.js";import{a as X}from"./chunk-3B6S2GOO.js";import{e as w}from"./chunk-BWKFPVR5.js";function _(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(_.prototype,{length:{get:function(){return this._length}}}),_.prototype.enqueue=function(t){this._array.push(t),this._length++},_.prototype.dequeue=function(){if(0===this._length)return;let t=this._array,e=this._offset,n=t[e];return t[e]=void 0,e++,e>10&&2*e>t.length&&(this._array=t.slice(e),e=0),this._offset=e,this._length--,n},_.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},_.prototype.contains=function(t){return-1!==this._array.indexOf(t)},_.prototype.clear=function(){this._array.length=this._offset=this._length=0},_.prototype.sort=function(t){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(t)};var J=_,x={computeHierarchyPackedLength:function(t,e){let n=0,o=[t];for(;o.length>0;){let t=o.pop();if(!w(t))continue;n+=2;let i=t.positions,r=t.holes;if(w(i)&&i.length>0&&(n+=i.length*e.packedLength),w(r)){let t=r.length;for(let e=0;e<t;++e)o.push(r[e])}}return n},packPolygonHierarchy:function(t,e,n,o){let i=[t];for(;i.length>0;){let t=i.pop();if(!w(t))continue;let r=t.positions,s=t.holes;if(e[n++]=w(r)?r.length:0,e[n++]=w(s)?s.length:0,w(r)){let t=r.length;for(let i=0;i<t;++i,n+=o.packedLength)o.pack(r[i],e,n)}if(w(s)){let t=s.length;for(let e=0;e<t;++e)i.push(s[e])}}return n},unpackPolygonHierarchy:function(t,e,n){let o=t[e++],i=t[e++],r=new Array(o),s=i>0?new Array(i):void 0;for(let a=0;a<o;++a,e+=n.packedLength)r[a]=n.unpack(t,e);for(let a=0;a<i;++a)s[a]=x.unpackPolygonHierarchy(t,e,n),e=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:e}}},M=new A;function rt(t,e,n,o){return A.subtract(e,t,M),A.multiplyByScalar(M,n/o,M),A.add(t,M,M),[M.x,M.y]}var G=new b;function ut(t,e,n,o){return b.subtract(e,t,G),b.multiplyByScalar(G,n/o,G),b.add(t,G,G),[G.x,G.y,G.z]}x.subdivideLineCount=function(t,e,n){let o=b.distance(t,e)/n,i=Math.max(0,Math.ceil(S.log2(o)));return Math.pow(2,i)};var Z=new W,$=new W,ht=new W,lt=new b,it=new F;x.subdivideRhumbLineCount=function(t,e,n,o){let i=t.cartesianToCartographic(e,Z),r=t.cartesianToCartographic(n,$),s=new F(i,r,t).surfaceDistance/o,a=Math.max(0,Math.ceil(S.log2(s)));return Math.pow(2,a)},x.subdivideTexcoordLine=function(t,e,n,o,i,r){let s=x.subdivideLineCount(n,o,i),a=A.distance(t,e),l=a/s,u=r;u.length=2*s;let c=0;for(let h=0;h<s;h++){let n=rt(t,e,h*l,a);u[c++]=n[0],u[c++]=n[1]}return u},x.subdivideLine=function(t,e,n,o){let i=x.subdivideLineCount(t,e,n),r=b.distance(t,e),s=r/i;w(o)||(o=[]);let a=o;a.length=3*i;let l=0;for(let u=0;u<i;u++){let n=ut(t,e,u*s,r);a[l++]=n[0],a[l++]=n[1],a[l++]=n[2]}return a},x.subdivideTexcoordRhumbLine=function(t,e,n,o,i,r,s){let a=n.cartesianToCartographic(o,Z),l=n.cartesianToCartographic(i,$);it.setEndPoints(a,l);let u=it.surfaceDistance/r,c=Math.max(0,Math.ceil(S.log2(u))),h=Math.pow(2,c),f=A.distance(t,e),p=f/h,d=s;d.length=2*h;let m=0;for(let g=0;g<h;g++){let n=rt(t,e,g*p,f);d[m++]=n[0],d[m++]=n[1]}return d},x.subdivideRhumbLine=function(t,e,n,o,i){let r=t.cartesianToCartographic(e,Z),s=t.cartesianToCartographic(n,$),a=new F(r,s,t),l=a.surfaceDistance/o,u=Math.max(0,Math.ceil(S.log2(l))),c=Math.pow(2,u),h=a.surfaceDistance/c;w(i)||(i=[]);let f=i;f.length=3*c;let p=0;for(let d=0;d<c;d++){let e=a.interpolateUsingSurfaceDistance(d*h,ht),n=t.cartographicToCartesian(e,lt);f[p++]=n.x,f[p++]=n.y,f[p++]=n.z}return f};var ft=new b,dt=new b,mt=new b,pt=new b;x.scaleToGeodeticHeightExtruded=function(t,e,n,o,i){o=X(o,tt.WGS84);let r=ft,s=dt,a=mt,l=pt;if(w(t)&&w(t.attributes)&&w(t.attributes.position)){let u=t.attributes.position.values,c=u.length/2;for(let t=0;t<c;t+=3)b.fromArray(u,t,a),o.geodeticSurfaceNormal(a,r),l=o.scaleToGeodeticSurface(a,l),s=b.multiplyByScalar(r,n,s),s=b.add(l,s,s),u[t+c]=s.x,u[t+1+c]=s.y,u[t+2+c]=s.z,i&&(l=b.clone(a,l)),s=b.multiplyByScalar(r,e,s),s=b.add(l,s,s),u[t]=s.x,u[t+1]=s.y,u[t+2]=s.z}return t},x.polygonOutlinesFromHierarchy=function(t,e,n){let o,i,r,s=[],a=new J;for(a.enqueue(t);0!==a.length;){let t=a.dequeue(),l=t.positions;if(e)for(r=l.length,o=0;o<r;o++)n.scaleToGeodeticSurface(l[o],l[o]);if(l=k(l,b.equalsEpsilon,!0),l.length<3)continue;let u=t.holes?t.holes.length:0;for(o=0;o<u;o++){let l=t.holes[o],u=l.positions;if(e)for(r=u.length,i=0;i<r;++i)n.scaleToGeodeticSurface(u[i],u[i]);if(u=k(u,b.equalsEpsilon,!0),u.length<3)continue;s.push(u);let c=0;for(w(l.holes)&&(c=l.holes.length),i=0;i<c;i++)a.enqueue(l.holes[i])}s.push(l)}return s},x.polygonsFromHierarchy=function(t,e,n,o,i){let r=[],s=[],a=new J;for(a.enqueue(t);0!==a.length;){let t,l,u=a.dequeue(),c=u.positions,h=u.holes;if(o)for(l=c.length,t=0;t<l;t++)i.scaleToGeodeticSurface(c[t],c[t]);if(e||(c=k(c,b.equalsEpsilon,!0)),c.length<3)continue;let f=n(c);if(!w(f))continue;let p=[],d=B.computeWindingOrder2D(f);d===K.CLOCKWISE&&(f.reverse(),c=c.slice().reverse());let m,g=c.slice(),y=w(h)?h.length:0,x=[];for(t=0;t<y;t++){let r=h[t],s=r.positions;if(o)for(l=s.length,m=0;m<l;++m)i.scaleToGeodeticSurface(s[m],s[m]);if(e||(s=k(s,b.equalsEpsilon,!0)),s.length<3)continue;let u=n(s);if(!w(u))continue;d=B.computeWindingOrder2D(u),d===K.CLOCKWISE&&(u.reverse(),s=s.slice().reverse()),x.push(s),p.push(g.length),g=g.concat(s),f=f.concat(u);let c=0;for(w(r.holes)&&(c=r.holes.length),m=0;m<c;m++)a.enqueue(r.holes[m])}r.push({outerRing:c,holes:x}),s.push({positions:g,positions2D:f,holes:p})}return{hierarchy:r,polygons:s}};var gt=new A,yt=new b,bt=new j,xt=new z;x.computeBoundingRectangle=function(t,e,n,o,i){let r=j.fromAxisAngle(t,o,bt),s=z.fromQuaternion(r,xt),a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,h=n.length;for(let f=0;f<h;++f){let t=b.clone(n[f],yt);z.multiplyByVector(s,t,t);let o=e(t,gt);w(o)&&(a=Math.min(a,o.x),l=Math.max(l,o.x),u=Math.min(u,o.y),c=Math.max(c,o.y))}return i.x=a,i.y=u,i.width=l-a,i.height=c-u,i},x.createGeometryFromPositions=function(t,e,n,o,i,r,s){let a=B.triangulate(e.positions2D,e.holes);a.length<3&&(a=[0,1,2]);let l=e.positions,u=w(n),c=u?n.positions:void 0;if(i){let t=l.length,e=new Array(3*t),n=0;for(let r=0;r<t;r++){let t=l[r];e[n++]=t.x,e[n++]=t.y,e[n++]=t.z}let o={attributes:{position:new H({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:e})},indices:a,primitiveType:Y.TRIANGLES};u&&(o.attributes.st=new H({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:A.packArray(c)}));let i=new Q(o);return r.normal?ot.computeNormal(i):i}return s===N.GEODESIC?B.computeSubdivision(t,l,a,c,o):s===N.RHUMB?B.computeRhumbLineSubdivision(t,l,a,c,o):void 0};var st=[],ct=[],wt=new b,Lt=new b;x.computeWallGeometry=function(t,e,n,o,i,r){let s,a,l,u,c,h,f,p,d,m=t.length,g=0,y=0,A=w(e),v=A?e.positions:void 0;if(i)for(a=3*m*2,s=new Array(2*a),A&&(d=2*m*2,p=new Array(2*d)),l=0;l<m;l++)u=t[l],c=t[(l+1)%m],s[g]=s[g+a]=u.x,++g,s[g]=s[g+a]=u.y,++g,s[g]=s[g+a]=u.z,++g,s[g]=s[g+a]=c.x,++g,s[g]=s[g+a]=c.y,++g,s[g]=s[g+a]=c.z,++g,A&&(h=v[l],f=v[(l+1)%m],p[y]=p[y+d]=h.x,++y,p[y]=p[y+d]=h.y,++y,p[y]=p[y+d]=f.x,++y,p[y]=p[y+d]=f.y,++y);else{let e=S.chordLength(o,n.maximumRadius),i=0;if(r===N.GEODESIC)for(l=0;l<m;l++)i+=x.subdivideLineCount(t[l],t[(l+1)%m],e);else if(r===N.RHUMB)for(l=0;l<m;l++)i+=x.subdivideRhumbLineCount(n,t[l],t[(l+1)%m],e);for(a=3*(i+m),s=new Array(2*a),A&&(d=2*(i+m),p=new Array(2*d)),l=0;l<m;l++){let o,i;u=t[l],c=t[(l+1)%m],A&&(h=v[l],f=v[(l+1)%m]),r===N.GEODESIC?(o=x.subdivideLine(u,c,e,ct),A&&(i=x.subdivideTexcoordLine(h,f,u,c,e,st))):r===N.RHUMB&&(o=x.subdivideRhumbLine(n,u,c,e,ct),A&&(i=x.subdivideTexcoordRhumbLine(h,f,n,u,c,e,st)));let b=o.length;for(let t=0;t<b;++t,++g)s[g]=o[t],s[g+a]=o[t];if(s[g]=c.x,s[g+a]=c.x,++g,s[g]=c.y,s[g+a]=c.y,++g,s[g]=c.z,s[g+a]=c.z,++g,A){let t=i.length;for(let e=0;e<t;++e,++y)p[y]=i[e],p[y+d]=i[e];p[y]=f.x,p[y+d]=f.x,++y,p[y]=f.y,p[y+d]=f.y,++y}}}m=s.length;let _=nt.createTypedArray(m/3,m-6*t.length),I=0;for(m/=6,l=0;l<m;l++){let t=l,e=t+1,n=t+m,o=n+1;u=b.fromArray(s,3*t,wt),c=b.fromArray(s,3*e,Lt),!b.equalsEpsilon(u,c,S.EPSILON10,S.EPSILON10)&&(_[I++]=t,_[I++]=n,_[I++]=e,_[I++]=e,_[I++]=n,_[I++]=o)}let L={attributes:new et({position:new H({componentDatatype:q.DOUBLE,componentsPerAttribute:3,values:s})}),indices:_,primitiveType:Y.TRIANGLES};return A&&(L.attributes.st=new H({componentDatatype:q.FLOAT,componentsPerAttribute:2,values:p})),new Q(L)};var Ut=x;export{Ut as a};