surprise
2024-04-17 f560ccccd3878497339daeee3241a81c263898f7
1
define(["./when-229515d6","./Matrix2-2fec35ad","./GeometryOffsetAttribute-ff1e192c","./Transforms-75891ac8","./ComponentDatatype-17b06483","./RuntimeError-ffe03243","./GeometryAttribute-c0946387","./GeometryAttributes-b253752a","./IndexDatatype-b10faa0b","./PolygonPipeline-1d19b57a","./RectangleGeometryLibrary-9b7a0917","./PixelFormat-daf99ebc","./WebGLConstants-4e26b85a","./combine-8ce3f24b","./EllipsoidRhumbLine-0b875bcf"],(function(e,t,i,a,r,n,o,l,u,s,p,c,d,f,g){"use strict";var h=new a.BoundingSphere,y=new a.BoundingSphere,b=new t.Cartesian3,m=new t.Rectangle;function _(e,t){var i=e._ellipsoid,a=t.height,n=t.width,s=t.northCap,c=t.southCap,d=a,f=2,g=0,h=4;s&&(f-=1,d-=1,g+=1,h-=2),c&&(f-=1,d-=1,g+=1,h-=2),g+=f*n+2*d-h;var y,m=new Float64Array(3*g),_=0,v=0,E=b;if(s)p.RectangleGeometryLibrary.computePosition(t,i,!1,v,0,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;else for(y=0;y<n;y++)p.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(y=n-1,v=1;v<a;v++)p.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;if(v=a-1,!c)for(y=n-2;y>=0;y--)p.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(y=0,v=a-2;v>0;v--)p.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(var A=m.length/3*2,G=u.IndexDatatype.createTypedArray(m.length/3,A),R=0,P=0;P<m.length/3-1;P++)G[R++]=P,G[R++]=P+1;G[R++]=m.length/3-1,G[R++]=0;var w=new o.Geometry({attributes:new l.GeometryAttributes,primitiveType:o.PrimitiveType.LINES});return w.attributes.position=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m}),w.indices=G,w}function v(i){var a=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).rectangle,n=e.defaultValue(i.granularity,r.CesiumMath.RADIANS_PER_DEGREE),o=e.defaultValue(i.ellipsoid,t.Ellipsoid.WGS84),l=e.defaultValue(i.rotation,0),u=e.defaultValue(i.height,0),s=e.defaultValue(i.extrudedHeight,u);this._rectangle=t.Rectangle.clone(a),this._granularity=n,this._ellipsoid=o,this._surfaceHeight=Math.max(u,s),this._rotation=l,this._extrudedHeight=Math.min(u,s),this._offsetAttribute=i.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}v.packedLength=t.Rectangle.packedLength+t.Ellipsoid.packedLength+5,v.pack=function(i,a,r){return r=e.defaultValue(r,0),t.Rectangle.pack(i._rectangle,a,r),r+=t.Rectangle.packedLength,t.Ellipsoid.pack(i._ellipsoid,a,r),r+=t.Ellipsoid.packedLength,a[r++]=i._granularity,a[r++]=i._surfaceHeight,a[r++]=i._rotation,a[r++]=i._extrudedHeight,a[r]=e.defaultValue(i._offsetAttribute,-1),a};var E=new t.Rectangle,A=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),G={rectangle:E,ellipsoid:A,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};v.unpack=function(i,a,r){a=e.defaultValue(a,0);var n=t.Rectangle.unpack(i,a,E);a+=t.Rectangle.packedLength;var o=t.Ellipsoid.unpack(i,a,A);a+=t.Ellipsoid.packedLength;var l=i[a++],u=i[a++],s=i[a++],p=i[a++],c=i[a];return e.defined(r)?(r._rectangle=t.Rectangle.clone(n,r._rectangle),r._ellipsoid=t.Ellipsoid.clone(o,r._ellipsoid),r._surfaceHeight=u,r._rotation=s,r._extrudedHeight=p,r._offsetAttribute=-1===c?void 0:c,r):(G.granularity=l,G.height=u,G.rotation=s,G.extrudedHeight=p,G.offsetAttribute=-1===c?void 0:c,new v(G))};var R=new t.Cartographic;return v.createGeometry=function(t){var n,l,c=t._rectangle,d=t._ellipsoid,f=p.RectangleGeometryLibrary.computeOptions(c,t._granularity,t._rotation,0,m,R);if(!r.CesiumMath.equalsEpsilon(c.north,c.south,r.CesiumMath.EPSILON10)&&!r.CesiumMath.equalsEpsilon(c.east,c.west,r.CesiumMath.EPSILON10)){var g,b=t._surfaceHeight,v=t._extrudedHeight;if(!r.CesiumMath.equalsEpsilon(b,v,0,r.CesiumMath.EPSILON2)){if(n=function(e,t){var i=e._surfaceHeight,a=e._extrudedHeight,r=e._ellipsoid,n=a,o=i,l=_(e,t),p=t.height,c=t.width,d=s.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,o,r,!1),f=d.length,g=new Float64Array(2*f);g.set(d);var h=s.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,n,r);g.set(h,f),l.attributes.position.values=g;var y=t.northCap,b=t.southCap,m=4;y&&(m-=1),b&&(m-=1);var v=2*(g.length/3+m),E=u.IndexDatatype.createTypedArray(g.length/3,v);f=g.length/6;for(var A,G=0,R=0;R<f-1;R++)E[G++]=R,E[G++]=R+1,E[G++]=R+f,E[G++]=R+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=p-1;else{var P=c-1;E[G++]=P,E[G++]=P+f,A=c+p-2}if(E[G++]=A,E[G++]=A+f,!b){var w=c+A-1;E[G++]=w,E[G]=w+f}return l.indices=E,l}(t,f),e.defined(t._offsetAttribute)){var E=n.attributes.position.values.length/3,A=new Uint8Array(E);t._offsetAttribute===i.GeometryOffsetAttribute.TOP?A=i.arrayFill(A,1,0,E/2):(g=t._offsetAttribute===i.GeometryOffsetAttribute.NONE?0:1,A=i.arrayFill(A,g)),n.attributes.applyOffset=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:A})}var G=a.BoundingSphere.fromRectangle3D(c,d,b,y),P=a.BoundingSphere.fromRectangle3D(c,d,v,h);l=a.BoundingSphere.union(G,P)}else{if((n=_(t,f)).attributes.position.values=s.PolygonPipeline.scaleToGeodeticHeight(n.attributes.position.values,b,d,!1),e.defined(t._offsetAttribute)){var w=n.attributes.position.values.length,L=new Uint8Array(w/3);g=t._offsetAttribute===i.GeometryOffsetAttribute.NONE?0:1,i.arrayFill(L,g),n.attributes.applyOffset=new o.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:L})}l=a.BoundingSphere.fromRectangle3D(c,d,b)}return new o.Geometry({attributes:n.attributes,indices:n.indices,primitiveType:o.PrimitiveType.LINES,boundingSphere:l,offsetAttribute:t._offsetAttribute})}},function(i,a){return e.defined(a)&&(i=v.unpack(i,a)),i._ellipsoid=t.Ellipsoid.clone(i._ellipsoid),i._rectangle=t.Rectangle.clone(i._rectangle),v.createGeometry(i)}}));