YZProjectCloud/yanzhu-ui-vue3/public/Engine/Workers/createRectangleOutlineGeome...

2 lines
5.9 KiB
JavaScript
Raw Normal View History

2025-04-07 00:55:58 +08:00
define(["./defaultValue-81eec7ed","./Matrix2-e3fb4559","./GeometryOffsetAttribute-ed56ff58","./Transforms-98ffa11d","./Cartesian3-7e9cc2ff","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./IndexDatatype-f1e3f799","./Math-5f585871","./PolygonPipeline-6f83d8b1","./RectangleGeometryLibrary-193b0cdb","./Matrix4-d34187af","./RuntimeError-26acdd3b","./_commonjsHelpers-3aae1032-26891ab7","./combine-3c023bda","./WebGLConstants-508b9636","./EllipsoidRhumbLine-9c6b32ea"],(function(e,t,i,n,o,a,r,l,s,u,c,p,d,f,g,h,y,b,m){"use strict";const _=new n.BoundingSphere,E=new n.BoundingSphere,A=new o.Cartesian3,G=new t.Rectangle;function R(e,t){const i=e._ellipsoid,n=t.height,o=t.width,r=t.northCap,c=t.southCap;let p=n,f=2,g=0,h=4;r&&(f-=1,p-=1,g+=1,h-=2),c&&(f-=1,p-=1,g+=1,h-=2),g+=f*o+2*p-h;const y=new Float64Array(3*g);let b,m=0,_=0;const E=A;if(r)d.RectangleGeometryLibrary.computePosition(t,i,!1,_,0,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;else for(b=0;b<o;b++)d.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;for(b=o-1,_=1;_<n;_++)d.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;if(_=n-1,!c)for(b=o-2;b>=0;b--)d.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;for(b=0,_=n-2;_>0;_--)d.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;const G=y.length/3*2,R=u.IndexDatatype.createTypedArray(y.length/3,G);let P=0;for(let e=0;e<y.length/3-1;e++)R[P++]=e,R[P++]=e+1;R[P++]=y.length/3-1,R[P++]=0;const L=new l.Geometry({attributes:new s.GeometryAttributes,primitiveType:l.PrimitiveType.LINES});return L.attributes.position=new l.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:y}),L.indices=R,L}function P(i){const n=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).rectangle,o=e.defaultValue(i.granularity,c.CesiumMath.RADIANS_PER_DEGREE),a=e.defaultValue(i.ellipsoid,t.Ellipsoid.WGS84),r=e.defaultValue(i.rotation,0),l=e.defaultValue(i.height,0),s=e.defaultValue(i.extrudedHeight,l);this._rectangle=t.Rectangle.clone(n),this._granularity=o,this._ellipsoid=a,this._surfaceHeight=Math.max(l,s),this._rotation=r,this._extrudedHeight=Math.min(l,s),this._offsetAttribute=i.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}P.packedLength=t.Rectangle.packedLength+t.Ellipsoid.packedLength+5,P.pack=function(i,n,o){return o=e.defaultValue(o,0),t.Rectangle.pack(i._rectangle,n,o),o+=t.Rectangle.packedLength,t.Ellipsoid.pack(i._ellipsoid,n,o),o+=t.Ellipsoid.packedLength,n[o++]=i._granularity,n[o++]=i._surfaceHeight,n[o++]=i._rotation,n[o++]=i._extrudedHeight,n[o]=e.defaultValue(i._offsetAttribute,-1),n};const L=new t.Rectangle,v=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),w={rectangle:L,ellipsoid:v,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};P.unpack=function(i,n,o){n=e.defaultValue(n,0);const a=t.Rectangle.unpack(i,n,L);n+=t.Rectangle.packedLength;const r=t.Ellipsoid.unpack(i,n,v);n+=t.Ellipsoid.packedLength;const l=i[n++],s=i[n++],u=i[n++],c=i[n++],p=i[n];return e.defined(o)?(o._rectangle=t.Rectangle.clone(a,o._rectangle),o._ellipsoid=t.Ellipsoid.clone(r,o._ellipsoid),o._surfaceHeight=s,o._rotation=u,o._extrudedHeight=c,o._offsetAttribute=-1===p?void 0:p,o):(w.granularity=l,w.height=s,w.rotation=u,w.extrudedHeight=c,w.offsetAttribute=-1===p?void 0:p,new P(w))};const C=new t.Cartographic;return P.createGeometry=function(t){const o=t._rectangle,r=t._ellipsoid,s=d.RectangleGeometryLibrary.computeOptions(o,t._granularity,t._rotation,0,G,C);let f,g;if(c.CesiumMath.equalsEpsilon(o.north,o.south,c.CesiumMath.EPSILON10)||c.CesiumMath.equalsEpsilon(o.east,o.west,c.CesiumMath.EPSILON10))return;const h=t._surfaceHeight,y=t._extrudedHeight;let b;if(!c.CesiumMath.equalsEpsilon(h,y,0,c.CesiumMath.EPSILON2)){if(f=function(e,t){const i=e._surfaceHeight,n=e._extrudedHeight,o=e._ellipsoid,a=n,r=i,l=R(e,t),s=t.height,c=t.width,d=p.PolygonPipeline.scaleToGeo