GeometryAttribute-088ad91d.js 3.1 KB

1
  1. define(["exports","./Matrix2-e3fb4559","./Cartesian3-7e9cc2ff","./Check-741c5f3c","./defaultValue-81eec7ed","./Matrix4-d34187af","./WebGLConstants-508b9636","./Transforms-99272364"],(function(t,e,n,a,i,r,o,s){"use strict";var u=Object.freeze({NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3});const I={POINTS:o.WebGLConstants.POINTS,LINES:o.WebGLConstants.LINES,LINE_LOOP:o.WebGLConstants.LINE_LOOP,LINE_STRIP:o.WebGLConstants.LINE_STRIP,TRIANGLES:o.WebGLConstants.TRIANGLES,TRIANGLE_STRIP:o.WebGLConstants.TRIANGLE_STRIP,TRIANGLE_FAN:o.WebGLConstants.TRIANGLE_FAN,validate:function(t){return t===I.POINTS||t===I.LINES||t===I.LINE_LOOP||t===I.LINE_STRIP||t===I.TRIANGLES||t===I.TRIANGLE_STRIP||t===I.TRIANGLE_FAN}};var c=Object.freeze(I);function N(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT),this.attributes=t.attributes,this.indices=t.indices,this.primitiveType=i.defaultValue(t.primitiveType,c.TRIANGLES),this.boundingSphere=t.boundingSphere,this.geometryType=i.defaultValue(t.geometryType,u.NONE),this.boundingSphereCV=t.boundingSphereCV,this.offsetAttribute=t.offsetAttribute,this.MaxPoint=t.MaxPoint,this.MinPoint=t.MinPoint}N.computeNumberOfVertices=function(t){let e=-1;for(const n in t.attributes)if(t.attributes.hasOwnProperty(n)&&i.defined(t.attributes[n])&&i.defined(t.attributes[n].values)){const a=t.attributes[n];e=a.values.length/a.componentsPerAttribute}return e};const l=new e.Cartographic,T=new n.Cartesian3,f=new r.Matrix4,p=[new e.Cartographic,new e.Cartographic,new e.Cartographic],h=[new e.Cartesian2,new e.Cartesian2,new e.Cartesian2],m=[new e.Cartesian2,new e.Cartesian2,new e.Cartesian2],y=new n.Cartesian3,C=new s.Quaternion,b=new r.Matrix4,E=new e.Matrix2;N._textureCoordinateRotationPoints=function(t,a,i,o){let u;const I=e.Rectangle.center(o,l),c=e.Cartographic.toCartesian(I,i,T),N=s.Transforms.eastNorthUpToFixedFrame(c,i,f),L=r.Matrix4.inverse(N,f),x=h,d=p;d[0].longitude=o.west,d[0].latitude=o.south,d[1].longitude=o.west,d[1].latitude=o.north,d[2].longitude=o.east,d[2].latitude=o.south;let P=y;for(u=0;u<3;u++)e.Cartographic.toCartesian(d[u],i,P),P=r.Matrix4.multiplyByPointAsVector(L,P,P),x[u].x=P.x,x[u].y=P.y;const A=s.Quaternion.fromAxisAngle(n.Cartesian3.UNIT_Z,-a,C),S=r.Matrix3.fromQuaternion(A,b),G=t.length;let M=Number.POSITIVE_INFINITY,w=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY,R=Number.NEGATIVE_INFINITY;for(u=0;u<G;u++)P=r.Matrix4.multiplyByPointAsVector(L,t[u],P),P=r.Matrix3.multiplyByVector(S,P,P),M=Math.min(M,P.x),w=Math.min(w,P.y),O=Math.max(O,P.x),R=Math.max(R,P.y);const _=e.Matrix2.fromRotation(a,E),g=m;g[0].x=M,g[0].y=w,g[1].x=M,g[1].y=R,g[2].x=O,g[2].y=w;const V=x[0],v=x[2].x-V.x,F=x[1].y-V.y;for(u=0;u<3;u++){const t=g[u];e.Matrix2.multiplyByVector(_,t,t),t.x=(t.x-V.x)/v,t.y=(t.y-V.y)/F}const W=g[0],Y=g[1],B=g[2],k=new Array(6);return e.Cartesian2.pack(W,k),e.Cartesian2.pack(Y,k,2),e.Cartesian2.pack(B,k,4),k},t.Geometry=N,t.GeometryAttribute=function(t){t=i.defaultValue(t,i.defaultValue.EMPTY_OBJECT),this.componentDatatype=t.componentDatatype,this.componentsPerAttribute=t.componentsPerAttribute,this.normalize=i.defaultValue(t.normalize,!1),this.values=t.values},t.GeometryType=u,t.PrimitiveType=c}));