2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
define(["./when-cbf8cd21","./Check-35e1a91d","./Math-e66fad2a","./Cartesian2-44433f55","./Transforms-d9350502","./RuntimeError-f4c64df1","./WebGLConstants-95ceb4e9","./ComponentDatatype-7ee14e67","./GeometryAttribute-424f2c6a","./GeometryAttributes-90846c5f","./IndexDatatype-66caba23","./GeometryOffsetAttribute-84f7eff3","./EllipsoidRhumbLine-862a2df4","./PolygonPipeline-94be9b1d","./RectangleGeometryLibrary-ee91fd16"],function(h,e,y,p,m,t,i,E,A,G,R,b,a,P,w){"use strict";var _=new m.BoundingSphere,v=new m.BoundingSphere,L=new p.Cartesian3,C=new p.Rectangle;function D(e,t){var i=e._ellipsoid,a=t.height,r=t.width,n=t.northCap,o=t.southCap,l=a,u=2,s=0,p=4;n&&(--u,--l,s+=1,p-=2),o&&(--u,--l,s+=1,p-=2),s+=u*r+2*l-p;var c,d=new Float64Array(3*s),f=0,g=0,h=L;if(n)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,0,h),d[f++]=h.x,d[f++]=h.y,d[f++]=h.z;else for(c=0;c<r;c++)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),d[f++]=h.x,d[f++]=h.y,d[f++]=h.z;for(c=r-1,g=1;g<a;g++)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),d[f++]=h.x,d[f++]=h.y,d[f++]=h.z;if(g=a-1,!o)for(c=r-2;0<=c;c--)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),d[f++]=h.x,d[f++]=h.y,d[f++]=h.z;for(c=0,g=a-2;0<g;g--)w.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,h),d[f++]=h.x,d[f++]=h.y,d[f++]=h.z;for(var y=d.length/3*2,m=R.IndexDatatype.createTypedArray(d.length/3,y),b=0,_=0;_<d.length/3-1;_++)m[b++]=_,m[b++]=_+1;m[b++]=d.length/3-1,m[b++]=0;var v=new A.Geometry({attributes:new G.GeometryAttributes,primitiveType:A.PrimitiveType.LINES});return v.attributes.position=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:d}),v.indices=m,v}function c(e){var t=(e=h.defaultValue(e,h.defaultValue.EMPTY_OBJECT)).rectangle,i=h.defaultValue(e.granularity,y.CesiumMath.RADIANS_PER_DEGREE),a=h.defaultValue(e.ellipsoid,p.Ellipsoid.WGS84),r=h.defaultValue(e.rotation,0),n=h.defaultValue(e.height,0),o=h.defaultValue(e.extrudedHeight,n);this._rectangle=p.Rectangle.clone(t),this._granularity=i,this._ellipsoid=a,this._surfaceHeight=Math.max(n,o),this._rotation=r,this._extrudedHeight=Math.min(n,o),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}c.packedLength=p.Rectangle.packedLength+p.Ellipsoid.packedLength+5,c.pack=function(e,t,i){return i=h.defaultValue(i,0),p.Rectangle.pack(e._rectangle,t,i),i+=p.Rectangle.packedLength,p.Ellipsoid.pack(e._ellipsoid,t,i),i+=p.Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=h.defaultValue(e._offsetAttribute,-1),t};var d=new p.Rectangle,f=p.Ellipsoid.clone(p.Ellipsoid.UNIT_SPHERE),g={rectangle:d,ellipsoid:f,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};c.unpack=function(e,t,i){t=h.defaultValue(t,0);var a=p.Rectangle.unpack(e,t,d);t+=p.Rectangle.packedLength;var r=p.Ellipsoid.unpack(e,t,f);t+=p.Ellipsoid.packedLength;var n=e[t++],o=e[t++],l=e[t++],u=e[t++],s=e[t];return h.defined(i)?(i._rectangle=p.Rectangle.clone(a,i._rectangle),i._ellipsoid=p.Ellipsoid.clone(r,i._ellipsoid),i._surfaceHeight=o,i._rotation=l,i._extrudedHeight=u,i._offsetAttribute=-1===s?void 0:s,i):(g.granularity=n,g.height=o,g.rotation=l,g.extrudedHeight=u,g.offsetAttribute=-1===s?void 0:s,new c(g))};var x=new p.Cartographic;return c.createGeometry=function(e){var t=e._rectangle,i=e._ellipsoid,a=w.RectangleGeometryLibrary.computeOptions(t,e._granularity,e._rotation,0,C,x);if(!y.CesiumMath.equalsEpsilon(t.north,t.south,y.CesiumMath.EPSILON10)&&!y.CesiumMath.equalsEpsilon(t.east,t.west,y.CesiumMath.EPSILON10)){var r,n,o,l,u,s,p,c,d,f=e._surfaceHeight,g=e._extrudedHeight;return s=!y.CesiumMath.equalsEpsilon(f,g,0,y.CesiumMath.EPSILON2)?(o=function(e,t){var i=e._surfaceHeight,a=e._extrudedHeight,r=e._ellipsoid,n=a,o=i,l=D(e,t),u=t.height,s=t.width,p=P.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,o,r,!1),c=p.length,d=new Float64Array(2*c);d.set(p);var f=P.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,n,r);d.set(f,c),l.attributes.position.values=d;var g=t.northCap,h=t.southCap,y=4;g&&--y,h&&--y;for(var m,b,_,v=2*(d.length/3+y),E=R.IndexDatatype.createTypedArray(d.length/3,v),c=d.length/6,A=0,G=0;G<c-1;G++)E[A++]=G,E[A++]=G+1,E[A++]=G+c,E[A++]=G+c+1;return E[A++]=c-1,E[A++]=0,E[A++]=c+c-1,E[A++]=c,E[A++]=0,E[A++]=c,m=g?u-1:(b=s-1,E[A++]=b,E[A++]=b+c,s+u-2),E[A++]=m,E[A++]=m+c,h||(_=s+m-1,E[A++]=_,E[A]=_+c),l.indices=E,l}(e,a),h.defined(e._offsetAttribute)&&(r=o.attributes.position.values.length/3,n=new Uint8Array(r),n=e._offsetAttribute===b.GeometryOffsetAttribute.TOP?b.arrayFill(n,1,0,r/2):(d=e._offsetAttribute===b.GeometryOffsetAttribute.NONE?0:1,b.arrayFill(n,d)),o.attributes.applyOffset=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})),l=m.BoundingSphere.fromRectangle3D(t,i,f,v),u=m.BoundingSphere.fromRectangle3D(t,i,g,_),m.BoundingSphere.union(l,u)):((o=D(e,a)).attributes.position.values=P.PolygonPipeline.scaleToGeodeticHeight(o.attributes.position.values,f,i,!1),h.defined(e._offsetAttribute)&&(p=o.attributes.position.values.length,c=new Uint8Array(p/3),d=e._offsetAttribute===b.GeometryOffsetAttribute.NONE?0:1,b.arrayFill(c,d),o.attributes.applyOffset=new A.GeometryAttribute({componentDatatype:E.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})),m.BoundingSphere.fromRectangle3D(t,i,f)),new A.Geometry({attributes:o.attributes,indices:o.indices,primitiveType:A.PrimitiveType.LINES,boundingSphere:s,offsetAttribute:e._offsetAttribute})}},function(e,t){return h.defined(t)&&(e=c.unpack(e,t)),e._ellipsoid=p.Ellipsoid.clone(e._ellipsoid),e._rectangle=p.Rectangle.clone(e._rectangle),c.createGeometry(e)}});
|