forked from integrated_whb/integrated_whb_vue
2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
define(["./defaultValue-0a909f67","./Matrix3-b6f074fa","./Matrix2-163b5a1d","./Transforms-713aa3a8","./ComponentDatatype-77274976","./GeometryAttribute-0b8b7b82","./GeometryAttributes-f06a2792","./GeometryOffsetAttribute-04332ce7","./IndexDatatype-2149f06c","./Math-e97915da","./PolygonPipeline-1b86ab0c","./RectangleGeometryLibrary-97b463a4","./RuntimeError-06c93819","./combine-ca22a614","./WebGLConstants-a8cc3e8c","./EllipsoidRhumbLine-7f84cca0"],(function(e,t,i,n,o,a,r,l,s,u,c,p,d,f,g,h){"use strict";const y=new n.BoundingSphere,m=new n.BoundingSphere,b=new t.Cartesian3,_=new i.Rectangle;function E(e,t){const i=e._ellipsoid,n=t.height,l=t.width,u=t.northCap,c=t.southCap;let d=n,f=2,g=0,h=4;u&&(f-=1,d-=1,g+=1,h-=2),c&&(f-=1,d-=1,g+=1,h-=2),g+=f*l+2*d-h;const y=new Float64Array(3*g);let m,_=0,E=0;const A=b;if(u)p.RectangleGeometryLibrary.computePosition(t,i,!1,E,0,A),y[_++]=A.x,y[_++]=A.y,y[_++]=A.z;else for(m=0;m<l;m++)p.RectangleGeometryLibrary.computePosition(t,i,!1,E,m,A),y[_++]=A.x,y[_++]=A.y,y[_++]=A.z;for(m=l-1,E=1;E<n;E++)p.RectangleGeometryLibrary.computePosition(t,i,!1,E,m,A),y[_++]=A.x,y[_++]=A.y,y[_++]=A.z;if(E=n-1,!c)for(m=l-2;m>=0;m--)p.RectangleGeometryLibrary.computePosition(t,i,!1,E,m,A),y[_++]=A.x,y[_++]=A.y,y[_++]=A.z;for(m=0,E=n-2;E>0;E--)p.RectangleGeometryLibrary.computePosition(t,i,!1,E,m,A),y[_++]=A.x,y[_++]=A.y,y[_++]=A.z;const G=y.length/3*2,R=s.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 a.Geometry({attributes:new r.GeometryAttributes,primitiveType:a.PrimitiveType.LINES});return L.attributes.position=new a.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:y}),L.indices=R,L}function A(n){const o=(n=e.defaultValue(n,e.defaultValue.EMPTY_OBJECT)).rectangle,a=e.defaultValue(n.granularity,u.CesiumMath.RADIANS_PER_DEGREE),r=e.defaultValue(n.ellipsoid,t.Ellipsoid.WGS84),l=e.defaultValue(n.rotation,0),s=e.defaultValue(n.height,0),c=e.defaultValue(n.extrudedHeight,s);this._rectangle=i.Rectangle.clone(o),this._granularity=a,this._ellipsoid=r,this._surfaceHeight=Math.max(s,c),this._rotation=l,this._extrudedHeight=Math.min(s,c),this._offsetAttribute=n.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}A.packedLength=i.Rectangle.packedLength+t.Ellipsoid.packedLength+5,A.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 G=new i.Rectangle,R=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),P={rectangle:G,ellipsoid:R,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};A.unpack=function(n,o,a){o=e.defaultValue(o,0);const r=i.Rectangle.unpack(n,o,G);o+=i.Rectangle.packedLength;const l=t.Ellipsoid.unpack(n,o,R);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):(P.granularity=s,P.height=u,P.rotation=c,P.extrudedHeight=p,P.offsetAttribute=-1===d?void 0:d,new A(P))};const L=new t.Cartographic;return A.createGeometry=function(t){const i=t._rectangle,r=t._ellipsoid,d=p.RectangleGeometryLibrary.computeOptions(i,t._granularity,t._rotation,0,_,L);let f,g;if(u.CesiumMath.equalsEpsilon(i.north,i.south,u.CesiumMath.EPSILON10)||u.CesiumMath.equalsEpsilon(i.east,i.west,u.CesiumMath.EPSILON10))return;const h=t._surfaceHeight,b=t._extrudedHeight;let A;if(!u.CesiumMath.equalsEpsilon(h,b,0,u.CesiumMath.EPSILON2)){if(f=function(e,t){const i=e._surfaceHeight,n=e._extrudedHeight,o=e._ellipsoid,a=n,r=i,l=E(e,t),u=t.height,p=t.width,d=c.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,r,o,!1);let f=d.length;const g=new Float64Array(2*f);g.set(d);const h=c.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,a,o);g.set(h,f),l.attributes.position.values=g;const y=t.northCap,m=t.southCap;let b=4;y&&(b-=1),m&&(b-=1);const _=2*(g.length/3+b),A=s.IndexDatatype.createTypedArray(g.length/3,_);f=g.length/6;let G,R=0;for(let e=0;e<f-1;e++)A[R++]=e,A[R++]=e+1,A[R++]=e+f,A[R++]=e+f+1;if(A[R++]=f-1,A[R++]=0,A[R++]=f+f-1,A[R++]=f,A[R++]=0,A[R++]=f,y)G=u-1;else{const e=p-1;A[R++]=e,A[R++]=e+f,G=p+u-2}if(A[R++]=G,A[R++]=G+f,!m){const e=p+G-1;A[R++]=e,A[R]=e+f}return l.indices=A,l}(t,d),e.defined(t._offsetAttribute)){const e=f.attributes.position.values.length/3;let i=new Uint8Array(e);t._offsetAttribute===l.GeometryOffsetAttribute.TOP?i=i.fill(1,0,e/2):(A=t._offsetAttribute===l.GeometryOffsetAttribute.NONE?0:1,i=i.fill(A)),f.attributes.applyOffset=new a.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}const u=n.BoundingSphere.fromRectangle3D(i,r,h,m),p=n.BoundingSphere.fromRectangle3D(i,r,b,y);g=n.BoundingSphere.union(u,p)}else{if(f=E(t,d),f.attributes.position.values=c.PolygonPipeline.scaleToGeodeticHeight(f.attributes.position.values,h,r,!1),e.defined(t._offsetAttribute)){const e=f.attributes.position.values.length;A=t._offsetAttribute===l.GeometryOffsetAttribute.NONE?0:1;const i=new Uint8Array(e/3).fill(A);f.attributes.applyOffset=new a.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}g=n.BoundingSphere.fromRectangle3D(i,r,h)}return new a.Geometry({attributes:f.attributes,indices:f.indices,primitiveType:a.PrimitiveType.LINES,boundingSphere:g,offsetAttribute:t._offsetAttribute})},function(n,o){return e.defined(o)&&(n=A.unpack(n,o)),n._ellipsoid=t.Ellipsoid.clone(n._ellipsoid),n._rectangle=i.Rectangle.clone(n._rectangle),A.createGeometry(n)}}));
|