Files
sdk4.0/static/Cesium/Workers/createCorridorOutlineGeometry.js

26 lines
8.1 KiB
JavaScript
Raw Normal View History

2025-07-03 13:54:01 +08:00
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.98
*
* 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.
*/
define(["./arrayRemoveDuplicates-fd3a3f4e","./Transforms-c9e418cb","./Matrix2-cf4c6e69","./ComponentDatatype-9b23164a","./PolylineVolumeGeometryLibrary-6a648b4f","./CorridorGeometryLibrary-2f861952","./defaultValue-50f7432c","./GeometryAttribute-b84ffce6","./GeometryAttributes-8bab1b25","./GeometryOffsetAttribute-490bc2c9","./IndexDatatype-ceed713e","./PolygonPipeline-13f0bfa4","./combine-8462e002","./RuntimeError-48e1f06d","./WebGLConstants-58abc51a","./EllipsoidTangentPlane-2597ceda","./AxisAlignedBoundingBox-ae9b3d82","./IntersectionTests-d662a125","./Plane-b9f0711b","./PolylinePipeline-98b8bcbb","./EllipsoidGeodesic-759beff8","./EllipsoidRhumbLine-0cc30625"],(function(e,t,i,r,o,n,s,a,l,d,u,p,f,c,h,y,b,g,m,A,_,E){"use strict";const C=new i.Cartesian3,G=new i.Cartesian3,T=new i.Cartesian3;function P(e,t){const d=[],p=e.positions,f=e.corners,c=e.endPositions,h=new l.GeometryAttributes;let y,b,g,m=0,A=0,_=0;for(b=0;b<p.length;b+=2)g=p[b].length-3,m+=g,_+=g/3*4,A+=p[b+1].length-3;for(m+=3,A+=3,b=0;b<f.length;b++){y=f[b];const e=f[b].leftPositions;s.defined(e)?(g=e.length,m+=g,_+=g/3*2):(g=f[b].rightPositions.length,A+=g,_+=g/3*2)}const E=s.defined(c);let P;E&&(P=c[0].length-3,m+=P,A+=P,P/=3,_+=4*P);const v=m+A,w=new Float64Array(v);let L,D,x,k,V,N,O=0,H=v-1;const I=P/2,S=u.IndexDatatype.createTypedArray(v/3,_+4);let B=0;if(S[B++]=O/3,S[B++]=(H-2)/3,E){d.push(O/3),N=C,V=G;const e=c[0];for(b=0;b<I;b++)N=i.Cartesian3.fromArray(e,3*(I-1-b),N),V=i.Cartesian3.fromArray(e,3*(I+b),V),n.CorridorGeometryLibrary.addAttribute(w,V,O),n.CorridorGeometryLibrary.addAttribute(w,N,void 0,H),D=O/3,k=D+1,L=(H-2)/3,x=L-1,S[B++]=L,S[B++]=x,S[B++]=D,S[B++]=k,O+=3,H-=3}let M=0,R=p[M++],U=p[M++];for(w.set(R,O),w.set(U,H-U.length+1),g=U.length-3,d.push(O/3,(H-2)/3),b=0;b<g;b+=3)D=O/3,k=D+1,L=(H-2)/3,x=L-1,S[B++]=L,S[B++]=x,S[B++]=D,S[B++]=k,O+=3,H-=3;for(b=0;b<f.length;b++){let e;y=f[b];const r=y.leftPositions,a=y.rightPositions;let l,u=T;if(s.defined(r)){for(H-=3,l=x,d.push(k),e=0;e<r.length/3;e++)u=i.Cartesian3.fromArray(r,3*e,u),S[B++]=l-e-1,S[B++]=l-e,n.CorridorGeometryLibrary.addAttribute(w,u,void 0,H),H-=3;d.push(l-Math.floor(r.length/6)),t===o.CornerType.BEVELED&&d.push((H-2)/3+1),O+=3}else{for(O+=3,l=k,d.push(x),e=0;e<a.length/3;e++)u=i.Cartesian3.fromArray(a,3*e,u),S[B++]=l+e,S[B++]=l+e+1,n.CorridorGeometryLibrary.addAttribute(w,u,O),O+=3;d.push(l+Math.floor(a.length/6)),t===o.CornerType.BEVELED&&d.push(O/3-1),H-=3}for(R=p[M++],U=p[M++],R.splice(0,3),U.splice(U.length-3,3),w.set(R,O),w.set(U,H-U.length+1),g=U.length-3,e=0;e<U.length;e+=3)k=O/3,D=k-1,x=(H-2)/3,L=x+1,S[B++]=L,S[B++]=x,S[B++]=D,S[B++]=k,O+=3,H-=3;O-=3,H+=3,d.push(O/3,(H-2)/3)}if(E){O+=3,H-=3,N=C,V=G;const e=c[1];for(b=0;b<I;b++)N=i.Cartesian3.fromArray(e,3*(P-b-1),N),V=i.Cartesian3.fromArray(e,3*b,V),n.CorridorGeometryLibrary.addAttribute(w,N,void 0,H),n.CorridorGeometryLibrary.addAttribute(w,V,O),k=O/3,D=k-1,x=(H-2)/3,L=x+1,S[B++]=L,S[B++]=x,S[B++]=D,S[B++]=k,O+=3,H-=3;d.push(O/3)}else d.push(O/3,(H-2)/3);return S[B++]=O/3,S[B++]=(H-2)/3,h.position=new a.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:w}),{attributes:h,indices:S,wallIndices:d}}function v(e){const t=(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).positions,n=e.width,a=s.defaultValue(e.height,0),l=s.defaultValue(e.extrudedHeight,a);this._positions=t,this._ellipsoid=i.Ellipsoid.clone(s.defaultValue(e.ellipsoid,i.Ellipsoid.WGS84)),this._width=n,this._height=Math.max(a,l),this._extrudedHeight=Math.min(a,l),this._cornerType=s.defaultValue(e.cornerType,o.CornerType.ROUNDED),this._granularity=s.defaultValue(e.granularity,r.CesiumMath.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*i.Cartesian3.packedLength+i.Ellipsoid.packedLength+6}v.pack=function(e,t,r){r=s.defaultValue(r,0);const o=e._positions,n=o.length;t[r++]=n;for(let e=0;e<n;++e,r+=i.Cartesian3.packedLength)i.Cartesian3.pack(o[e],t,r);return i.Ellipsoid.pack(e._ellipsoid,t,r),r+=i.Ellipsoid.packedLength,t[r++]=e._width