1
Surpriseplus
2022-09-16 a7e5110ef3f5fe3c9205f7d1a526b9fbbb55d826
1
define(["./when-e3a49219","./Matrix2-ae0e0b05","./GeometryOffsetAttribute-9dbaeacc","./Transforms-a6362ad2","./ComponentDatatype-64cf6611","./RuntimeError-ffc802eb","./GeometryAttribute-50aef525","./GeometryAttributes-3db3f2c9","./IndexDatatype-e12e2493","./PolygonPipeline-2bbe6eb1","./RectangleGeometryLibrary-ac1dd89b","./PixelFormat-83d70a69","./WebGLConstants-1c8239cc","./combine-c7a1ec8a","./EllipsoidRhumbLine-b6518e5c"],(function(e,t,i,a,r,n,o,l,u,s,c,p,d,f,g){"use strict";var h=new a.BoundingSphere,y=new a.BoundingSphere,m=new t.Cartesian3,b=new t.Rectangle;function _(e,t){var i=e._ellipsoid,a=t.height,n=t.width,s=t.northCap,p=t.southCap,d=a,f=2,g=0,h=4;s&&(f-=1,d-=1,g+=1,h-=2),p&&(f-=1,d-=1,g+=1,h-=2),g+=f*n+2*d-h;var y,b=new Float64Array(3*g),_=0,v=0,E=m;if(s)c.RectangleGeometryLibrary.computePosition(t,i,!1,v,0,E),b[_++]=E.x,b[_++]=E.y,b[_++]=E.z;else for(y=0;y<n;y++)c.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),b[_++]=E.x,b[_++]=E.y,b[_++]=E.z;for(y=n-1,v=1;v<a;v++)c.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),b[_++]=E.x,b[_++]=E.y,b[_++]=E.z;if(v=a-1,!p)for(y=n-2;y>=0;y--)c.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),b[_++]=E.x,b[_++]=E.y,b[_++]=E.z;for(y=0,v=a-2;v>0;v--)c.RectangleGeometryLibrary.computePosition(t,i,!1,v,y,E),b[_++]=E.x,b[_++]=E.y,b[_++]=E.z;for(var A=b.length/3*2,G=u.IndexDatatype.createTypedArray(b.length/3,A),R=0,P=0;P<b.length/3-1;P++)G[R++]=P,G[R++]=P+1;G[R++]=b.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:b}),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++],c=i[a++],p=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=c,r._offsetAttribute=-1===p?void 0:p,r):(G.granularity=l,G.height=u,G.rotation=s,G.extrudedHeight=c,G.offsetAttribute=-1===p?void 0:p,new v(G))};var R=new t.Cartographic;return v.createGeometry=function(t){var n,l,p=t._rectangle,d=t._ellipsoid,f=c.RectangleGeometryLibrary.computeOptions(p,t._granularity,t._rotation,0,b,R);if(!r.CesiumMath.equalsEpsilon(p.north,p.south,r.CesiumMath.EPSILON10)&&!r.CesiumMath.equalsEpsilon(p.east,p.west,r.CesiumMath.EPSILON10)){var g,m=t._surfaceHeight,v=t._extrudedHeight;if(!r.CesiumMath.equalsEpsilon(m,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),c=t.height,p=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,m=t.southCap,b=4;y&&(b-=1),m&&(b-=1);var v=2*(g.length/3+b),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=c-1;else{var P=p-1;E[G++]=P,E[G++]=P+f,A=p+c-2}if(E[G++]=A,E[G++]=A+f,!m){var w=p+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(p,d,m,y),P=a.BoundingSphere.fromRectangle3D(p,d,v,h);l=a.BoundingSphere.union(G,P)}else{if((n=_(t,f)).attributes.position.values=s.PolygonPipeline.scaleToGeodeticHeight(n.attributes.position.values,m,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(p,d,m)}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)}}));