Agriculture-front-end/public/Cesium/Workers/createPolygonGeometry.js

2 lines
15 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./ArcType-29cf2197","./arrayFill-4513d7ad","./BoundingRectangle-3ed8ca6d","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./EllipsoidGeodesic-0f19ac62","./EllipsoidTangentPlane-edb321d3","./GeometryAttribute-3a88ba31","./GeometryInstance-68aae013","./GeometryOffsetAttribute-fbeb6f1a","./GeometryPipeline-9d1ef0b6","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-a54dc62f","./PolygonGeometryLibrary-92af6f1e","./PolygonPipeline-660e1625","./VertexFormat-6446fca0","./Event-16a2dfbf","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Cartesian4-3ca25aab","./IntersectionTests-7386ffbf","./Plane-7ae8294c","./FeatureDetection-c3b71206","./AttributeCompression-90851096","./EncodedCartesian3-f1396b05","./arrayRemoveDuplicates-d2f048c5","./EllipsoidRhumbLine-ed1a6bf4","./GeometryAttributes-252e9929","./earcut-2.2.1-20c8012f"],(function(e,t,r,a,o,i,n,s,l,u,c,d,p,g,y,m,h,f,b,_,v,P,x,C,w,A,T,E,I,G,V,F,H,N){"use strict";var O=new n.Cartographic,R=new n.Cartographic;function D(e,t,r,a){var o=a.cartesianToCartographic(e,O).height,i=a.cartesianToCartographic(t,R);i.height=o,a.cartographicToCartesian(i,t);var n=a.cartesianToCartographic(r,R);n.height=o-100,a.cartographicToCartesian(n,r)}var L=new o.BoundingRectangle,M=new n.Cartesian3,B=new n.Cartesian3,S=new n.Cartesian3,k=new n.Cartesian3,z=new n.Cartesian3,Y=new n.Cartesian3,U=new n.Cartesian3,W=new n.Cartesian3,j=new n.Cartesian3,Q=new t.Cartesian2,q=new t.Cartesian2,K=new n.Cartesian3,Z=new d.Quaternion,J=new f.Matrix3,X=new f.Matrix3;function $(r){var o=r.vertexFormat,i=r.geometry,s=r.shadowVolume,u=i.attributes.position.values,c=u.length,p=r.wall,y=r.top||p,m=r.bottom||p;if(o.st||o.normal||o.tangent||o.bitangent||s){var b=r.boundingRectangle,_=r.tangentPlane,v=r.ellipsoid,P=r.stRotation,x=r.perPositionHeight,C=Q;C.x=b.x,C.y=b.y;var w,A=o.st?new Float32Array(c/3*2):void 0;o.normal&&(w=x&&y&&!p?i.attributes.normal.values:new Float32Array(c));var T=o.tangent?new Float32Array(c):void 0,E=o.bitangent?new Float32Array(c):void 0,I=s?new Float32Array(c):void 0,G=0,V=0,F=B,H=S,N=k,O=!0,R=J,L=X;if(0!==P){var $=d.Quaternion.fromAxisAngle(_._plane.normal,P,Z);R=f.Matrix3.fromQuaternion($,R),$=d.Quaternion.fromAxisAngle(_._plane.normal,-P,Z),L=f.Matrix3.fromQuaternion($,L)}else R=f.Matrix3.clone(f.Matrix3.IDENTITY,R),L=f.Matrix3.clone(f.Matrix3.IDENTITY,L);var ee=0,te=0;y&&m&&(ee=c/2,te=c/3,c/=2);for(var re=0;re<c;re+=3){var ae=n.Cartesian3.fromArray(u,re,K);if(o.st){var oe=f.Matrix3.multiplyByVector(R,ae,M);oe=v.scaleToGeodeticSurface(oe,oe);var ie=_.projectPointOntoPlane(oe,q);t.Cartesian2.subtract(ie,C,ie);var ne=h.CesiumMath.clamp(ie.x/b.width,0,1),se=h.CesiumMath.clamp(ie.y/b.height,0,1);m&&(A[G+te]=ne,A[G+1+te]=se),y&&(A[G]=ne,A[G+1]=se),G+=2}if(o.normal||o.tangent||o.bitangent||s){var le=V+1,ue=V+2;if(p){if(re+3<c){var ce=n.Cartesian3.fromArray(u,re+3,z);if(O){var de=n.Cartesian3.fromArray(u,re+c,Y);x&&D(ae,ce,de,v),n.Cartesian3.subtract(ce,ae,ce),n.Cartesian3.subtract(de,ae,de),F=n.Cartesian3.normalize(n.Cartesian3.cross(de,ce,F),F),O=!1}n.Cartesian3.equalsEpsilon(ce,ae,h.CesiumMath.EPSILON10)&&(O=!0)}(o.tangent||o.bitangent)&&(N=v.geodeticSurfaceNormal(ae,N),o.tangent&&(H=n.Cartesian3.normalize(n.Cartesian3.cross(N,F,H),H)))}else F=v.geodeticSurfaceNormal(ae,F),(o.tangent||o.bitangent)&&(x&&(U=n.Cartesian3.fromArray(w,V,U),W=n.Cartesian3.cross(n.Cartesian3.UNIT_Z,U,W),W=n.Cartesian3.normalize(f.Matrix3.multiplyByVector(L,W,W),W),o.bitangent&&(j=n.Cartesian3.normalize(n.Cartesian3.cross(U,W,j),j))),H=n.Cartesian3.cross(n.Cartesian3.UNIT_Z,F,H),H=n.Cartesian3.normalize(f.Matrix3.multiplyByVector(L,H,H),H),o.bitangent&&(N=n.Cartesian3.normalize(n.Cartesian3.cross(F,H,N),N)));o.normal&&(r.wall?(w[V+ee]=F.x,w[le+ee]=F.y,w[ue+ee]=F.z):m&&(w[V+ee]=-F.x,w[le+ee]=-F.y,w[ue+ee]=-F.z),(y&&!x||p)&&(w[V]=F.x,w[le]=F.y,w[ue]=F.z)),s&&(p&&(F=v.geodeticSurfaceNormal(ae,F)),I[V+ee]=-F.x,I[le+ee]=-F.y,I[ue+ee]=-F.z),o.tangent&&(r.wall?(T[V+ee]=H.x,T[le+ee]=H.y,T[ue+ee]=H.z):m&&(