RectangleGeometryLibrary-48d34d36.js 2.3 KB

1
  1. define(["exports","./Matrix2-ccd5b911","./when-4bbc8319","./RuntimeError-346a3079","./Transforms-d5c6ad6e","./ComponentDatatype-93750d1a"],function(t,m,S,n,a,X){"use strict";var w=Math.cos,M=Math.sin,Y=Math.sqrt,r={computePosition:function(t,n,a,r,e,o,s){var i=n.radiiSquared,g=t.nwCorner,u=t.boundingRectangle,h=g.latitude-t.granYCos*r+e*t.granXSin,c=w(h),C=M(h),l=i.z*C,d=g.longitude+r*t.granYSin+e*t.granXCos,n=c*w(d),g=c*M(d),c=i.x*n,i=i.y*g,C=Y(c*n+i*g+l*C);o.x=c/C,o.y=i/C,o.z=l/C,a&&(a=t.stNwCorner,S.defined(a)?(h=a.latitude-t.stGranYCos*r+e*t.stGranXSin,d=a.longitude+r*t.stGranYSin+e*t.stGranXCos,s.x=(d-t.stWest)*t.lonScalar,s.y=(h-t.stSouth)*t.latScalar):(s.x=(d-u.west)*t.lonScalar,s.y=(h-u.south)*t.latScalar))}},l=new m.Matrix2,d=new m.Cartesian3,p=new m.Cartographic,x=new m.Cartesian3,R=new a.GeographicProjection;function G(t,n,a,r,e,o,s){var i=Math.cos(n),g=r*i,u=a*i,h=Math.sin(n),c=r*h,C=a*h;d=R.project(t,d),d=m.Cartesian3.subtract(d,x,d);i=m.Matrix2.fromRotation(n,l);d=m.Matrix2.multiplyByVector(i,d,d),d=m.Cartesian3.add(d,x,d);r=(t=R.unproject(d,t)).latitude,a=r+--o*C,h=r-g*--s,n=r-g*s+o*C,i=Math.max(r,a,h,n),r=Math.min(r,a,h,n),a=t.longitude,h=a+o*u,n=a+s*c,o=a+s*c+o*u;return{north:i,south:r,east:Math.max(a,h,n,o),west:Math.min(a,h,n,o),granYCos:g,granYSin:c,granXCos:u,granXSin:C,nwCorner:t}}r.computeOptions=function(t,n,a,r,e,o,s){var i=t.east,g=t.west,u=t.north,h=t.south,c=!1,C=!1;u===X.CesiumMath.PI_OVER_TWO&&(c=!0),h===-X.CesiumMath.PI_OVER_TWO&&(C=!0);var l,d=u-h,S=(w=i<g?X.CesiumMath.TWO_PI-g+i:i-g)/((l=Math.ceil(w/n)+1)-1),w=d/((M=Math.ceil(d/n)+1)-1),d=m.Rectangle.northwest(t,o),n=m.Rectangle.center(t,p);0===a&&0===r||(n.longitude<d.longitude&&(n.longitude+=X.CesiumMath.TWO_PI),x=R.project(n,x));var M,o=w,n=S,e=m.Rectangle.clone(t,e),C={granYCos:o,granYSin:0,granXCos:n,granXSin:0,nwCorner:d,boundingRectangle:e,width:l,height:M,northCap:c,southCap:C};return 0!==a&&(u=(d=G(d,a,S,w,0,l,M)).north,h=d.south,i=d.east,g=d.west,C.granYCos=d.granYCos,C.granYSin=d.granYSin,C.granXCos=d.granXCos,C.granXSin=d.granXSin,e.north=u,e.south=h,e.east=i,e.west=g),0!==r&&(a-=r,M=G(s=m.Rectangle.northwest(e,s),a,S,w,0,l,M),C.stGranYCos=M.granYCos,C.stGranXCos=M.granXCos,C.stGranYSin=M.granYSin,C.stGranXSin=M.granXSin,C.stNwCorner=s,C.stWest=M.west,C.stSouth=M.south),C},t.RectangleGeometryLibrary=r});