qd-changjing/public/static/Build/CesiumUnminified/Workers/createRectangleOutlineGeome...

1 line
34 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createRectangleOutlineGeometry.js","sources":["../../../../Source/Core/RectangleOutlineGeometry.js","../../../../Source/WorkersES6/createRectangleOutlineGeometry.js"],"sourcesContent":["import arrayFill from \"./arrayFill.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Cartographic from \"./Cartographic.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryOffsetAttribute from \"./GeometryOffsetAttribute.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport PolygonPipeline from \"./PolygonPipeline.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\nimport Rectangle from \"./Rectangle.js\";\nimport RectangleGeometryLibrary from \"./RectangleGeometryLibrary.js\";\n\nconst bottomBoundingSphere = new BoundingSphere();\nconst topBoundingSphere = new BoundingSphere();\nconst positionScratch = new Cartesian3();\nconst rectangleScratch = new Rectangle();\n\nfunction constructRectangle(geometry, computedOptions) {\n const ellipsoid = geometry._ellipsoid;\n const height = computedOptions.height;\n const width = computedOptions.width;\n const northCap = computedOptions.northCap;\n const southCap = computedOptions.southCap;\n\n let rowHeight = height;\n let widthMultiplier = 2;\n let size = 0;\n let corners = 4;\n if (northCap) {\n widthMultiplier -= 1;\n rowHeight -= 1;\n size += 1;\n corners -= 2;\n }\n if (southCap) {\n widthMultiplier -= 1;\n rowHeight -= 1;\n size += 1;\n corners -= 2;\n }\n size += widthMultiplier * width + 2 * rowHeight - corners;\n\n const positions = new Float64Array(size * 3);\n\n let posIndex = 0;\n let row = 0;\n let col;\n const position = positionScratch;\n if (northCap) {\n RectangleGeometryLibrary.computePosition(\n computedOptions,\n ellipsoid,\n false,\n row,\n 0,\n position\n );\n positions[posIndex++] = position.x;\n positions[posIndex++] = position.y;\n positions[posIndex++] = position.z;\n } else {\n for (col = 0; col < width; col++) {\n RectangleGeometryLibrary.computePosition(\n computedOptions,\n ellipsoid,\n false,\n row,\n col,\n position\n );\n positions[posIndex++] = position.x;\n positions[posIndex++] = position.y;\n positions[posIndex++] = position.z;\n }\n }\n\n col = width - 1;\n for (row = 1; row < height; row++) {\n RectangleGeometryLibrary.computePosition(\n computedOptions,\n ellipsoid,\n false,\n row,\n col,\n position\n );\n positions[posIndex++] = position.x;\n positions[posIndex++] = position.y;\n positions[posIndex++] = position.z;\n }\n\n row = height - 1;\n if (!southCap) {\n // if southCap is true, we dont need to add any more points because the south pole point was added by the iteration above\n for (col = width - 2; col >= 0; col--) {\n RectangleGeometryLibrary.computePosition(\n computedOptions,\n ellipsoid,\n false,\n row,\n col,\n position\n );\n positions[posIndex++] = position.x;\n positions[posIndex++] = position.y;\n positions[posIndex++] = position.z;\n }\n }\n\n col = 0;\n for (row = height - 2; row > 0; row--) {\n RectangleGeometryLibrary.computePosition(\n computedOptions,\n ellipsoid,\n false,\n row,\n col,\n position\n );\n positions[posIndex++] = position.x;\n positions[posIndex++] = position.y;\n positions[posIndex++] = position.z;\n }\n\n const indicesSize = (positions.length / 3) * 2;\n const indices = IndexDatatyp