GeometryAttribute-3314089a.js 6.6 KB

1
  1. define(["exports","./Cartesian2-b4b7b0b3","./Check-5e798bbf","./when-208fe5b0","./Transforms-d5dbea8d","./WebGLConstants-76bb35d1"],function(e,x,t,a,L,n){"use strict";var r=Object.freeze({NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3});function w(e,t,n,r){this[0]=a.defaultValue(e,0),this[1]=a.defaultValue(n,0),this[2]=a.defaultValue(t,0),this[3]=a.defaultValue(r,0)}w.packedLength=4,w.pack=function(e,t,n){return n=a.defaultValue(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t},w.unpack=function(e,t,n){return t=a.defaultValue(t,0),(n=!a.defined(n)?new w:n)[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n},w.clone=function(e,t){if(a.defined(e))return a.defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new w(e[0],e[2],e[1],e[3])},w.fromArray=function(e,t,n){return t=a.defaultValue(t,0),(n=!a.defined(n)?new w:n)[0]=e[t],n[1]=e[t+1],n[2]=e[t+2],n[3]=e[t+3],n},w.fromColumnMajorArray=function(e,t){return w.clone(e,t)},w.fromRowMajorArray=function(e,t){return a.defined(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new w(e[0],e[1],e[2],e[3])},w.fromScale=function(e,t){return a.defined(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new w(e.x,0,0,e.y)},w.fromUniformScale=function(e,t){return a.defined(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new w(e,0,0,e)},w.fromRotation=function(e,t){var n=Math.cos(e),e=Math.sin(e);return a.defined(t)?(t[0]=n,t[1]=e,t[2]=-e,t[3]=n,t):new w(n,-e,e,n)},w.toArray=function(e,t){return a.defined(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]},w.getElementIndex=function(e,t){return 2*e+t},w.getColumn=function(e,t,n){var r=2*t,t=e[r],r=e[1+r];return n.x=t,n.y=r,n},w.setColumn=function(e,t,n,r){t*=2;return(r=w.clone(e,r))[t]=n.x,r[1+t]=n.y,r},w.getRow=function(e,t,n){var r=e[t],t=e[t+2];return n.x=r,n.y=t,n},w.setRow=function(e,t,n,r){return(r=w.clone(e,r))[t]=n.x,r[t+2]=n.y,r};var i=new x.Cartesian2;w.getScale=function(e,t){return t.x=x.Cartesian2.magnitude(x.Cartesian2.fromElements(e[0],e[1],i)),t.y=x.Cartesian2.magnitude(x.Cartesian2.fromElements(e[2],e[3],i)),t};var u=new x.Cartesian2;w.getMaximumScale=function(e){return w.getScale(e,u),x.Cartesian2.maximumComponent(u)},w.multiply=function(e,t,n){var r=e[0]*t[0]+e[2]*t[1],a=e[0]*t[2]+e[2]*t[3],i=e[1]*t[0]+e[3]*t[1],t=e[1]*t[2]+e[3]*t[3];return n[0]=r,n[1]=i,n[2]=a,n[3]=t,n},w.add=function(e,t,n){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n},w.subtract=function(e,t,n){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n},w.multiplyByVector=function(e,t,n){var r=e[0]*t.x+e[2]*t.y,t=e[1]*t.x+e[3]*t.y;return n.x=r,n.y=t,n},w.multiplyByScalar=function(e,t,n){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n},w.multiplyByScale=function(e,t,n){return n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n},w.negate=function(e,t){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},w.transpose=function(e,t){var n=e[0],r=e[2],a=e[1],e=e[3];return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t},w.abs=function(e,t){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t},w.equals=function(e,t){return e===t||a.defined(e)&&a.defined(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},w.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]},w.equalsEpsilon=function(e,t,n){return n=a.defaultValue(n,0),e===t||a.defined(e)&&a.defined(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n},w.IDENTITY=Object.freeze(new w(1,0,0,1)),w.ZERO=Object.freeze(new w(0,0,0,0)),w.COLUMN0ROW0=0,w.COLUMN0ROW1=1,w.COLUMN1ROW0=2,w.COLUMN1ROW1=3,Object.defineProperties(w.prototype,{length:{get:function(){return w.packedLength}}}),w.prototype.clone=function(e){return w.clone(this,e)},w.prototype.equals=function(e){return w.equals(this,e)},w.prototype.equalsEpsilon=function(e,t){return w.equalsEpsilon(this,e,t)},w.prototype.toString=function(){return"("+this[0]+", "+this[2]+")\n("+this[1]+", "+this[3]+")"};var o={POINTS:n.WebGLConstants.POINTS,LINES:n.WebGLConstants.LINES,LINE_LOOP:n.WebGLConstants.LINE_LOOP,LINE_STRIP:n.WebGLConstants.LINE_STRIP,TRIANGLES:n.WebGLConstants.TRIANGLES,TRIANGLE_STRIP:n.WebGLConstants.TRIANGLE_STRIP,TRIANGLE_FAN:n.WebGLConstants.TRIANGLE_FAN,validate:function(e){return e===o.POINTS||e===o.LINES||e===o.LINE_LOOP||e===o.LINE_STRIP||e===o.TRIANGLES||e===o.TRIANGLE_STRIP||e===o.TRIANGLE_FAN}},s=Object.freeze(o);function f(e){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=a.defaultValue(e.primitiveType,s.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=a.defaultValue(e.geometryType,r.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}f.computeNumberOfVertices=function(e){var t,n,r=-1;for(t in e.attributes)e.attributes.hasOwnProperty(t)&&a.defined(e.attributes[t])&&a.defined(e.attributes[t].values)&&(r=(n=e.attributes[t]).values.length/n.componentsPerAttribute);return r};var g=new x.Cartographic,S=new x.Cartesian3,A=new L.Matrix4,O=[new x.Cartographic,new x.Cartographic,new x.Cartographic],M=[new x.Cartesian2,new x.Cartesian2,new x.Cartesian2],R=[new x.Cartesian2,new x.Cartesian2,new x.Cartesian2],v=new x.Cartesian3,V=new L.Quaternion,P=new L.Matrix4,G=new w;f._textureCoordinateRotationPoints=function(e,t,n,r){var a=x.Rectangle.center(r,g),i=x.Cartographic.toCartesian(a,n,S),a=L.Transforms.eastNorthUpToFixedFrame(i,n,A),u=L.Matrix4.inverse(a,A),o=M,s=O;s[0].longitude=r.west,s[0].latitude=r.south,s[1].longitude=r.west,s[1].latitude=r.north,s[2].longitude=r.east,s[2].latitude=r.south;for(var f=v,l=0;l<3;l++)x.Cartographic.toCartesian(s[l],n,f),f=L.Matrix4.multiplyByPointAsVector(u,f,f),o[l].x=f.x,o[l].y=f.y;var i=L.Quaternion.fromAxisAngle(x.Cartesian3.UNIT_Z,-t,V),c=L.Matrix3.fromQuaternion(i,P),d=e.length,y=Number.POSITIVE_INFINITY,m=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(l=0;l<d;l++)f=L.Matrix4.multiplyByPointAsVector(u,e[l],f),f=L.Matrix3.multiplyByVector(c,f,f),y=Math.min(y,f.x),m=Math.min(m,f.y),p=Math.max(p,f.x),h=Math.max(h,f.y);var b=w.fromRotation(t,G),N=R;N[0].x=y,N[0].y=m,N[1].x=y,N[1].y=h,N[2].x=p,N[2].y=m;var I=o[0],C=o[2].x-I.x,T=o[1].y-I.y;for(l=0;l<3;l++){var E=N[l];w.multiplyByVector(b,E,E),E.x=(E.x-I.x)/C,E.y=(E.y-I.y)/T}a=N[0],r=N[1],i=N[2],t=new Array(6);return x.Cartesian2.pack(a,t),x.Cartesian2.pack(r,t,2),x.Cartesian2.pack(i,t,4),t},e.Geometry=f,e.GeometryAttribute=function(e){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT),this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=a.defaultValue(e.normalize,!1),this.values=e.values},e.GeometryType=r,e.Matrix2=w,e.PrimitiveType=s});