1 |
- define(["./when-4bbc8319","./Matrix2-ccd5b911","./GeometryOffsetAttribute-1772960d","./Transforms-d5c6ad6e","./ComponentDatatype-93750d1a","./RuntimeError-346a3079","./GeometryAttribute-c30799b8","./GeometryAttributes-7827a6c2","./IndexDatatype-b7d979a6","./PolygonPipeline-83fb62b0","./RectangleGeometryLibrary-48d34d36","./combine-83860057","./WebGLConstants-1c8239cc","./EllipsoidRhumbLine-aa9e6266"],function(c,s,p,d,b,e,_,v,E,g,A,t,i,a){"use strict";var f=new d.BoundingSphere,h=new d.BoundingSphere,G=new s.Cartesian3,y=new s.Rectangle;function m(e,t){var i=e._ellipsoid,a=t.height,r=t.width,n=t.northCap,o=t.southCap,l=a,u=2,s=0,e=4;n&&(--u,--l,s+=1,e-=2),o&&(--u,--l,s+=1,e-=2),s+=u*r+2*l-e;var c,p=new Float64Array(3*s),d=0,g=0,f=G;if(n)A.RectangleGeometryLibrary.computePosition(t,i,!1,g,0,f),p[d++]=f.x,p[d++]=f.y,p[d++]=f.z;else for(c=0;c<r;c++)A.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,f),p[d++]=f.x,p[d++]=f.y,p[d++]=f.z;for(c=r-1,g=1;g<a;g++)A.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,f),p[d++]=f.x,p[d++]=f.y,p[d++]=f.z;if(g=a-1,!o)for(c=r-2;0<=c;c--)A.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,f),p[d++]=f.x,p[d++]=f.y,p[d++]=f.z;for(c=0,g=a-2;0<g;g--)A.RectangleGeometryLibrary.computePosition(t,i,!1,g,c,f),p[d++]=f.x,p[d++]=f.y,p[d++]=f.z;for(var o=p.length/3*2,h=E.IndexDatatype.createTypedArray(p.length/3,o),y=0,m=0;m<p.length/3-1;m++)h[y++]=m,h[y++]=m+1;h[y++]=p.length/3-1,h[y++]=0;o=new _.Geometry({attributes:new v.GeometryAttributes,primitiveType:_.PrimitiveType.LINES});return o.attributes.position=new _.GeometryAttribute({componentDatatype:b.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:p}),o.indices=h,o}function R(e){var t=(e=c.defaultValue(e,c.defaultValue.EMPTY_OBJECT)).rectangle,i=c.defaultValue(e.granularity,b.CesiumMath.RADIANS_PER_DEGREE),a=c.defaultValue(e.ellipsoid,s.Ellipsoid.WGS84),r=c.defaultValue(e.rotation,0),n=c.defaultValue(e.height,0),o=c.defaultValue(e.extrudedHeight,n);this._rectangle=s.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"}R.packedLength=s.Rectangle.packedLength+s.Ellipsoid.packedLength+5,R.pack=function(e,t,i){return i=c.defaultValue(i,0),s.Rectangle.pack(e._rectangle,t,i),i+=s.Rectangle.packedLength,s.Ellipsoid.pack(e._ellipsoid,t,i),i+=s.Ellipsoid.packedLength,t[i++]=e._granularity,t[i++]=e._surfaceHeight,t[i++]=e._rotation,t[i++]=e._extrudedHeight,t[i]=c.defaultValue(e._offsetAttribute,-1),t};var P=new s.Rectangle,w=s.Ellipsoid.clone(s.Ellipsoid.UNIT_SPHERE),L={rectangle:P,ellipsoid:w,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};R.unpack=function(e,t,i){t=c.defaultValue(t,0);var a=s.Rectangle.unpack(e,t,P);t+=s.Rectangle.packedLength;var r=s.Ellipsoid.unpack(e,t,w);t+=s.Ellipsoid.packedLength;var n=e[t++],o=e[t++],l=e[t++],u=e[t++],t=e[t];return c.defined(i)?(i._rectangle=s.Rectangle.clone(a,i._rectangle),i._ellipsoid=s.Ellipsoid.clone(r,i._ellipsoid),i._surfaceHeight=o,i._rotation=l,i._extrudedHeight=u,i._offsetAttribute=-1===t?void 0:t,i):(L.granularity=n,L.height=o,L.rotation=l,L.extrudedHeight=u,L.offsetAttribute=-1===t?void 0:t,new R(L))};var C=new s.Cartographic;return R.createGeometry=function(e){var t=e._rectangle,i=e._ellipsoid,a=A.RectangleGeometryLibrary.computeOptions(t,e._granularity,e._rotation,0,y,C);if(!b.CesiumMath.equalsEpsilon(t.north,t.south,b.CesiumMath.EPSILON10)&&!b.CesiumMath.equalsEpsilon(t.east,t.west,b.CesiumMath.EPSILON10)){var r,n,o,l,u=e._surfaceHeight,s=e._extrudedHeight;return u=!b.CesiumMath.equalsEpsilon(u,s,0,b.CesiumMath.EPSILON2)?(n=function(e,t){var i=e._surfaceHeight,a=e._extrudedHeight,r=e._ellipsoid,n=a,o=i,l=m(e,t),a=t.height,i=t.width,u=(e=g.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,o,r,!1)).length;(o=new Float64Array(2*u)).set(e),n=g.PolygonPipeline.scaleToGeodeticHeight(l.attributes.position.values,n,r),o.set(n,u),l.attributes.position.values=o,r=t.northCap,n=t.southCap,t=4,r&&--t,n&&--t;for(var t=2*(o.length/3+t),s=E.IndexDatatype.createTypedArray(o.length/3,t),u=o.length/6,c=0,p=0;p<u-1;p++)s[c++]=p,s[c++]=p+1,s[c++]=p+u,s[c++]=p+u+1;return s[c++]=u-1,s[c++]=0,s[c++]=u+u-1,s[c++]=u,s[c++]=0,s[c++]=u,a=r?a-1:(s[c++]=r=i-1,s[c++]=r+u,i+a-2),s[c++]=a,s[c++]=a+u,n||(s[c++]=a=i+a-1,s[c]=a+u),l.indices=s,l}(e,a),c.defined(e._offsetAttribute)&&(r=n.attributes.position.values.length/3,o=new Uint8Array(r),o=e._offsetAttribute===p.GeometryOffsetAttribute.TOP?p.arrayFill(o,1,0,r/2):(l=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1,p.arrayFill(o,l)),n.attributes.applyOffset=new _.GeometryAttribute({componentDatatype:b.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:o})),o=d.BoundingSphere.fromRectangle3D(t,i,u,h),s=d.BoundingSphere.fromRectangle3D(t,i,s,f),d.BoundingSphere.union(o,s)):((n=m(e,a)).attributes.position.values=g.PolygonPipeline.scaleToGeodeticHeight(n.attributes.position.values,u,i,!1),c.defined(e._offsetAttribute)&&(a=n.attributes.position.values.length,a=new Uint8Array(a/3),l=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1,p.arrayFill(a,l),n.attributes.applyOffset=new _.GeometryAttribute({componentDatatype:b.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:a})),d.BoundingSphere.fromRectangle3D(t,i,u)),new _.Geometry({attributes:n.attributes,indices:n.indices,primitiveType:_.PrimitiveType.LINES,boundingSphere:u,offsetAttribute:e._offsetAttribute})}},function(e,t){return(e=c.defined(t)?R.unpack(e,t):e)._ellipsoid=s.Ellipsoid.clone(e._ellipsoid),e._rectangle=s.Rectangle.clone(e._rectangle),R.createGeometry(e)}});
|