createVectorTilePoints.js.map 5.4 KB

1
  1. {"version":3,"file":"createVectorTilePoints.js","sources":["../../../../Source/WorkersES6/createVectorTilePoints.js"],"sourcesContent":["import AttributeCompression from \"../Core/AttributeCompression.js\";\nimport Cartesian3 from \"../Core/Cartesian3.js\";\nimport Cartographic from \"../Core/Cartographic.js\";\nimport Ellipsoid from \"../Core/Ellipsoid.js\";\nimport CesiumMath from \"../Core/Math.js\";\nimport Rectangle from \"../Core/Rectangle.js\";\nimport createTaskProcessorWorker from \"./createTaskProcessorWorker.js\";\n\nvar maxShort = 32767;\n\nvar scratchBVCartographic = new Cartographic();\nvar scratchEncodedPosition = new Cartesian3();\n\nvar scratchRectangle = new Rectangle();\nvar scratchEllipsoid = new Ellipsoid();\nvar scratchMinMaxHeights = {\n min: undefined,\n max: undefined,\n};\n\nfunction unpackBuffer(packedBuffer) {\n packedBuffer = new Float64Array(packedBuffer);\n\n var offset = 0;\n scratchMinMaxHeights.min = packedBuffer[offset++];\n scratchMinMaxHeights.max = packedBuffer[offset++];\n\n Rectangle.unpack(packedBuffer, offset, scratchRectangle);\n offset += Rectangle.packedLength;\n\n Ellipsoid.unpack(packedBuffer, offset, scratchEllipsoid);\n}\n\nfunction createVectorTilePoints(parameters, transferableObjects) {\n var positions = new Uint16Array(parameters.positions);\n\n unpackBuffer(parameters.packedBuffer);\n var rectangle = scratchRectangle;\n var ellipsoid = scratchEllipsoid;\n var minimumHeight = scratchMinMaxHeights.min;\n var maximumHeight = scratchMinMaxHeights.max;\n\n var positionsLength = positions.length / 3;\n var uBuffer = positions.subarray(0, positionsLength);\n var vBuffer = positions.subarray(positionsLength, 2 * positionsLength);\n var heightBuffer = positions.subarray(\n 2 * positionsLength,\n 3 * positionsLength\n );\n AttributeCompression.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);\n\n var decoded = new Float64Array(positions.length);\n for (var i = 0; i < positionsLength; ++i) {\n var u = uBuffer[i];\n var v = vBuffer[i];\n var h = heightBuffer[i];\n\n var lon = CesiumMath.lerp(rectangle.west, rectangle.east, u / maxShort);\n var lat = CesiumMath.lerp(rectangle.south, rectangle.north, v / maxShort);\n var alt = CesiumMath.lerp(minimumHeight, maximumHeight, h / maxShort);\n\n var cartographic = Cartographic.fromRadians(\n lon,\n lat,\n alt,\n scratchBVCartographic\n );\n var decodedPosition = ellipsoid.cartographicToCartesian(\n cartographic,\n scratchEncodedPosition\n );\n Cartesian3.pack(decodedPosition, decoded, i * 3);\n }\n\n transferableObjects.push(decoded.buffer);\n\n return {\n positions: decoded.buffer,\n };\n}\nexport default createTaskProcessorWorker(createVectorTilePoints);\n"],"names":["Cartographic","Cartesian3","Rectangle","Ellipsoid","AttributeCompression","CesiumMath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAQA,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB;EACA,IAAI,qBAAqB,GAAG,IAAIA,uBAAY,EAAE,CAAC;EAC/C,IAAI,sBAAsB,GAAG,IAAIC,qBAAU,EAAE,CAAC;AAC9C;EACA,IAAI,gBAAgB,GAAG,IAAIC,oBAAS,EAAE,CAAC;EACvC,IAAI,gBAAgB,GAAG,IAAIC,oBAAS,EAAE,CAAC;EACvC,IAAI,oBAAoB,GAAG;EAC3B,EAAE,GAAG,EAAE,SAAS;EAChB,EAAE,GAAG,EAAE,SAAS;EAChB,CAAC,CAAC;AACF;EACA,SAAS,YAAY,CAAC,YAAY,EAAE;EACpC,EAAE,YAAY,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;AAChD;EACA,EAAE,IAAI,MAAM,GAAG,CAAC,CAAC;EACjB,EAAE,oBAAoB,CAAC,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;EACpD,EAAE,oBAAoB,CAAC,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AACpD;EACA,EAAED,oBAAS,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;EAC3D,E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