2 lines
6.0 KiB
JavaScript
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=
|