qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/createRectangleOutlineGeome...

2 lines
6.0 KiB
JavaScript

define(["./defaultValue-81eec7ed","./Cartesian2-bd414876","./Rectangle-cf3e0e3e","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./PolygonPipeline-04baeb41","./RectangleGeometryLibrary-5373dad7","./GeographicProjection-c931c7fb","./Matrix4-4c545f70","./RuntimeError-26acdd3b","./WebGLConstants-508b9636","./Matrix2-dc0c61cc","./Transforms-5b829630","./when-422ea0ae","./Resource-8ae1a924","./combine-3c023bda","./EllipsoidRhumbLine-592e8885"],(function(e,t,i,n,o,a,r,l,s,u,c,p,d,f,g,h,y,b,m,_,E,A,G,R){"use strict";const P=new o.BoundingSphere,w=new o.BoundingSphere,C=new a.Cartesian3,L=new i.Rectangle;function v(e,t){const i=e._ellipsoid,n=t.height,o=t.width,a=t.northCap,l=t.southCap;let p=n,d=2,g=0,h=4;a&&(d-=1,p-=1,g+=1,h-=2),l&&(d-=1,p-=1,g+=1,h-=2),g+=d*o+2*p-h;const y=new Float64Array(3*g);let b,m=0,_=0;const E=C;if(a)f.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++)f.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;_++)f.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;if(_=n-1,!l)for(b=o-2;b>=0;b--)f.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;_--)f.RectangleGeometryLibrary.computePosition(t,i,!1,_,b,E),y[m++]=E.x,y[m++]=E.y,y[m++]=E.z;const A=y.length/3*2,G=c.IndexDatatype.createTypedArray(y.length/3,A);let R=0;for(let e=0;e<y.length/3-1;e++)G[R++]=e,G[R++]=e+1;G[R++]=y.length/3-1,G[R++]=0;const P=new s.Geometry({attributes:new u.GeometryAttributes,primitiveType:s.PrimitiveType.LINES});return P.attributes.position=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:y}),P.indices=G,P}function x(n){const o=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).rectangle,a=e.defaultValue(n.granularity,p.CesiumMath.RADIANS_PER_DEGREE),r=e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),l=e.defaultValue(n.rotation,0),s=e.defaultValue(n.height,0),u=e.defaultValue(n.extrudedHeight,s);this._rectangle=i.Rectangle.clone(o),this._granularity=a,this._ellipsoid=r,this._surfaceHeight=Math.max(s,u),this._rotation=l,this._extrudedHeight=Math.min(s,u),this._offsetAttribute=n.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}x.packedLength=i.Rectangle.packedLength+t.Ellipsoid.packedLength+5,x.pack=function(n,o,a){return a=e.defaultValue(a,0),i.Rectangle.pack(n._rectangle,o,a),a+=i.Rectangle.packedLength,t.Ellipsoid.pack(n._ellipsoid,o,a),a+=t.Ellipsoid.packedLength,o[a++]=n._granularity,o[a++]=n._surfaceHeight,o[a++]=n._rotation,o[a++]=n._extrudedHeight,o[a]=e.defaultValue(n._offsetAttribute,-1),o};const D=new i.Rectangle,S=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),H={rectangle:D,ellipsoid:S,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};x.unpack=function(n,o,a){o=e.defaultValue(o,0);const r=i.Rectangle.unpack(n,o,D);o+=i.Rectangle.packedLength;const l=t.Ellipsoid.unpack(n,o,S);o+=t.Ellipsoid.packedLength;const s=n[o++],u=n[o++],c=n[o++],p=n[o++],d=n[o];return e.defined(a)?(a._rectangle=i.Rectangle.clone(r,a._rectangle),a._ellipsoid=t.Ellipsoid.clone(l,a._ellipsoid),a._surfaceHeight=u,a._rotation=c,a._extrudedHeight=p,a._offsetAttribute=-1===d?void 0:d,a):(H.granularity=s,H.height=u,H.rotation=c,H.extrudedHeight=p,H.offsetAttribute=-1===d?void 0:d,new x(H))};const k=new t.Cartographic;return x.createGeometry=function(t){const i=t._rectangle,a=t._ellipsoid,l=f.RectangleGeometryLibrary.computeOptions(i,t._granularity,t._rotation,0,L,k);let u,g;if(p.CesiumMath.equalsEpsilon(i.north,i.south,p.CesiumMath.EPSILON10)||p.CesiumMath.equalsEpsilon(i.east,i.west,p.CesiumMath.EPSILON10))return;const h=t._surfaceHeight,y=t._extrudedHeight;let b;if(!p.CesiumMath.equalsEpsilon(h,y,0,p.CesiumMath.EPSILON2)){if(u=function(e,t){const i=e._surfaceHeight,n=e._extrudedHeight,o=e._ellipsoid,a=n,r=i,l=v(e,t),s=t.height,u=t.width,p=d.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,r,o,!1);let f=p.length;const g=new Float64Array(2*f);g.set(p);const h=d.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,a,o);g.set(h,f),l.attributes.position.values=g;const y=t.northCap,b=t.southCap;let m=4;y&&(m-=1),b&&(m-=1);const _=2*(g.length/3+m),E=c.IndexDatatype.createTypedArray(g.length/3,_);f=g.length/6;let A,G=0;for(let e=0;e<f-1;e++)E[G++]=e,E[G++]=e+1,E[G++]=e+f,E[G++]=e+f+1;if(E[G++]=f-1,E[G++]=0,E[G++]=f+f-1,E[G++]=f,E[G++]=0,E[G++]=f,y)A=s-1;else{const e=u-1;E[G++]=e,E[G++]=e+f,A=u+s-2}if(E[G++]=A,E[G++]=A+f,!b){const e=u+A-1;E[G++]=e,E[G]=e+f}return l.indices=E,l}(t,l),e.defined(t._offsetAttribute)){const e=u.attributes.position.values.length/3;let i=new Uint8Array(e);t._offsetAttribute===n.GeometryOffsetAttribute.TOP?i=n.arrayFill(i,1,0,e/2):(b=t._offsetAttribute===n.GeometryOffsetAttribute.NONE?0:1,i=n.arrayFill(i,b)),u.attributes.applyOffset=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}const p=o.BoundingSphere.fromRectangle3D(i,a,h,w),f=o.BoundingSphere.fromRectangle3D(i,a,y,P);g=o.BoundingSphere.union(p,f)}else{if(u=v(t,l),u.attributes.position.values=d.PolygonPipeline.scaleToGeodeticHeight(u.attributes.position.values,h,a,!1),e.defined(t._offsetAttribute)){const e=u.attributes.position.values.length,i=new Uint8Array(e/3);b=t._offsetAttribute===n.GeometryOffsetAttribute.NONE?0:1,n.arrayFill(i,b),u.attributes.applyOffset=new s.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}g=o.BoundingSphere.fromRectangle3D(i,a,h)}return new s.Geometry({attributes:u.attributes,indices:u.indices,primitiveType:s.PrimitiveType.LINES,boundingSphere:g,offsetAttribute:t._offsetAttribute})},function(n,o){return e.defined(o)&&(n=x.unpack(n,o)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),n._rectangle=i.Rectangle.clone(n._rectangle),x.createGeometry(n)}}));