qd-changjing/public/static/Build/CesiumUnminified/Workers/RectangleGeometryLibrary-80...

1 line
16 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"RectangleGeometryLibrary-80323cc0.js","sources":["../../../../Source/Core/RectangleGeometryLibrary.js"],"sourcesContent":["import Cartesian3 from \"./Cartesian3.js\";\nimport Cartographic from \"./Cartographic.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport GeographicProjection from \"./GeographicProjection.js\";\nimport CesiumMath from \"./Math.js\";\nimport Matrix2 from \"./Matrix2.js\";\nimport Rectangle from \"./Rectangle.js\";\n\nconst cos = Math.cos;\nconst sin = Math.sin;\nconst sqrt = Math.sqrt;\n\n/**\n * @private\n */\nconst RectangleGeometryLibrary = {};\n\n/**\n * @private\n */\nRectangleGeometryLibrary.computePosition = function (\n computedOptions,\n ellipsoid,\n computeST,\n row,\n col,\n position,\n st\n) {\n const radiiSquared = ellipsoid.radiiSquared;\n const nwCorner = computedOptions.nwCorner;\n const rectangle = computedOptions.boundingRectangle;\n\n let stLatitude =\n nwCorner.latitude -\n computedOptions.granYCos * row +\n col * computedOptions.granXSin;\n const cosLatitude = cos(stLatitude);\n const nZ = sin(stLatitude);\n const kZ = radiiSquared.z * nZ;\n\n let stLongitude =\n nwCorner.longitude +\n row * computedOptions.granYSin +\n col * computedOptions.granXCos;\n const nX = cosLatitude * cos(stLongitude);\n const nY = cosLatitude * sin(stLongitude);\n\n const kX = radiiSquared.x * nX;\n const kY = radiiSquared.y * nY;\n\n const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);\n\n position.x = kX / gamma;\n position.y = kY / gamma;\n position.z = kZ / gamma;\n\n if (computeST) {\n const stNwCorner = computedOptions.stNwCorner;\n if (defined(stNwCorner)) {\n stLatitude =\n stNwCorner.latitude -\n computedOptions.stGranYCos * row +\n col * computedOptions.stGranXSin;\n stLongitude =\n stNwCorner.longitude +\n row * computedOptions.stGranYSin +\n col * computedOptions.stGranXCos;\n\n st.x = (stLongitude - computedOptions.stWest) * computedOptions.lonScalar;\n st.y = (stLatitude - computedOptions.stSouth) * computedOptions.latScalar;\n } else {\n st.x = (stLongitude - rectangle.west) * computedOptions.lonScalar;\n st.y = (stLatitude - rectangle.south) * computedOptions.latScalar;\n }\n }\n};\n\nconst rotationMatrixScratch = new Matrix2();\nlet nwCartesian = new Cartesian3();\nconst centerScratch = new Cartographic();\nlet centerCartesian = new Cartesian3();\nconst proj = new GeographicProjection();\n\nfunction getRotationOptions(\n nwCorner,\n rotation,\n granularityX,\n granularityY,\n center,\n width,\n height\n) {\n const cosRotation = Math.cos(rotation);\n const granYCos = granularityY * cosRotation;\n const granXCos = granularityX * cosRotation;\n\n const sinRotation = Math.sin(rotation);\n const granYSin = granularityY * sinRotation;\n const granXSin = granularityX * sinRotation;\n\n nwCartesian = proj.project(nwCorner, nwCartesian);\n\n nwCartesian = Cartesian3.subtract(nwCartesian, centerCartesian, nwCartesian);\n const rotationMatrix = Matrix2.fromRotation(rotation, rotationMatrixScratch);\n nwCartesian = Matrix2.multiplyByVector(\n rotationMatrix,\n nwCartesian,\n nwCartesian\n );\n nwCartesian = Cartesian3.add(nwCartesian, centerCartesian, nwCartesian);\n nwCorner = proj.unproject(nwCartesian, nwCorner);\n\n width -= 1;\n height -= 1;\n\n const latitude = nwCorner.latitude;\n const latitude0 = latitude + width * granXSin;\n const latitude1 = latitude - granYCos * height;\n const latitude2 = latitude - granYCos * height + width * granXSin;\n\n const north = Math.max(latitude, latitude0, latitude1, latitude2);\n const south = Math.min(latitude, latitude0, latitude1, latitude2);\n\n const longitude = nwCorner.longitude;\n const longitude0 = longitude + width * granXCos;\n const longitude1 = longitude + height * granYSin;\n const longitude2 = longitude + height * granYSin + width * granXCos;\n\n const east = Math.max(longitude, longitude0, longitude1,