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

2 lines
43 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./createTaskProcessorWorker","./Check-7b2a090c","./FeatureDetection-c3b71206","./when-b60132fc","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./Color-5008547b","./ComponentDatatype-c140a87d","./S3MCompressType-4145c64c","./Cartesian2-47311507","./IndexDatatype-8a5eead4","./PrimitiveType-39acab88","./RuntimeError-4a5c8994","./pako_inflate-f73548c4","./unzip-7fd7fbf8","./buildModuleUrl-3addfe33","./arrayFill-4513d7ad","./CompressedTextureBuffer-290a1ff4","./PixelFormat-d55645da","./Math-119be1a3","./WebGLConstants-4ae0db90","./BoundingRectangle-01b3e970"],(function(t,e,r,a,n,i,o,E,s,y,f,u,d,l,T,p,_,c,A,m,g,v,B){"use strict";function P(t,e,a){if("function"==typeof t.slice)return t.slice(e,a);for(var n=Array.prototype.slice.call(t,e,a),i=r.FeatureDetection.typedArrayTypes,o=i.length,E=0;E<o;++E)if(t instanceof i[E]){n=new i[E](n);break}return n}function U(){}var L;function M(t,e,r){var n,i=t.num_points(),o=r.num_components(),E=new L.AttributeQuantizationTransform;if(E.InitFromAttribute(r)){for(var y=new Array(o),f=0;f<o;++f)y[f]=E.min_value(f);n={quantizationBits:E.quantization_bits(),minValues:y,range:E.range(),octEncoded:!1}}L.destroy(E),(E=new L.AttributeOctahedronTransform).InitFromAttribute(r)&&(n={quantizationBits:E.quantization_bits(),octEncoded:!0}),L.destroy(E);var u,d=i*o;u=a.defined(n)?function(t,e,r,a,n){var i,o;a.quantizationBits<=8?(o=new L.DracoUInt8Array,i=new Uint8Array(n),e.GetAttributeUInt8ForAllPoints(t,r,o)):(o=new L.DracoUInt16Array,i=new Uint16Array(n),e.GetAttributeUInt16ForAllPoints(t,r,o));for(var E=0;E<n;++E)i[E]=o.GetValue(E);return L.destroy(o),i}(t,e,r,n,d):function(t,e,r,a){var n,i;switch(r.data_type()){case 1:case 11:i=new L.DracoInt8Array,n=new Int8Array(a),e.GetAttributeInt8ForAllPoints(t,r,i);break;case 2:i=new L.DracoUInt8Array,n=new Uint8Array(a),e.GetAttributeUInt8ForAllPoints(t,r,i);break;case 3:i=new L.DracoInt16Array,n=new Int16Array(a),e.GetAttributeInt16ForAllPoints(t,r,i);break;case 4:i=new L.DracoUInt16Array,n=new Uint16Array(a),e.GetAttributeUInt16ForAllPoints(t,r,i);break;case 5:case 7:i=new L.DracoInt32Array,n=new Int32Array(a),e.GetAttributeInt32ForAllPoints(t,r,i);break;case 6:case 8:i=new L.DracoUInt32Array,n=new Uint32Array(a),e.GetAttributeUInt32ForAllPoints(t,r,i);break;case 9:case 10:i=new L.DracoFloat32Array,n=new Float32Array(a),e.GetAttributeFloatForAllPoints(t,r,i)}for(var o=0;o<a;++o)n[o]=i.GetValue(o);return L.destroy(i),n}(t,e,r,d);var l=s.ComponentDatatype.fromTypedArray(u);return{array:u,data:{componentsPerAttribute:o,componentDatatype:l,byteOffset:r.byte_offset(),byteStride:s.ComponentDatatype.getSizeInBytes(l)*o,normalized:r.normalized(),quantization:n}}}function b(t,e,r,E,u,d,l){var T=void 0,p=void 0,_=r.vertexAttributes,c=r.attrLocation;if(r.nCompressOptions=0,a.defined(E.posUniqueID)&&E.posUniqueID>=0){r.nCompressOptions|=y.VertexCompressOption.SVC_Vertex;var A=e.GetAttribute(t,E.posUniqueID),m=M(t,e,A),g=m.data.componentsPerAttribute;r.verticesCount=m.array.length/g,r.vertCompressConstant=m.data.quantization.range/(1<<m.data.quantization.quantizationBits);var v=m.data.quantization.minValues;if(r.minVerticesValue=new o.Cartesian4(v[0],v[1],v[2],1),g>3&&(r.minVerticesValue.w=v[3]),c.aPosition=_.length,_.push({index:c.aPosition,typedArray:m.array,componentsPerAttribute:g,componentDatatype:m.data.componentDatatype,offsetInBytes:m.data.byteOffset,strideInBytes:m.data.byteStride,normalize:m.data.normalized}),d){var B=r.verticesCount,P=new i.Cartesian3,U=new i.Cartesian3,L=new i.Cartographic;T=new i.Cartographic,p=new i.Cartographic;for(var b=new Float32Array(2*B),S=new Float64Array(2*B),h=0;h<B;h++)n.Matrix4.multiplyByPoint(u,i.Cartesian3.fromElements(m.array[3*h]*r.vertCompressConstant+v[0],m.array[3*h+1]*r.vertCompressConstant+v[1],m.array[3*h+2]*r.vertCompressConstant+v[2],P),U),L=i.Cartographic.fromCartesian(U),S[2*h]=L.longitude,S[2*h+1]=L.latitude,0===h?(T.longitude=L.longitude,T.latitude=L.latitude,p.longitude=L.longitude,p.latitude=L.latitude):(T.longitude=Math.max(L.longitude,T.longitude),T.latitude=Math.max(L.