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

1 line
42 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createPolygonOutlineGeometry.js","sources":["../../../../Source/Core/PolygonOutlineGeometry.js","../../../../Source/WorkersES6/createPolygonOutlineGeometry.js"],"sourcesContent":["import ArcType from \"./ArcType.js\";\nimport arrayFill from \"./arrayFill.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Check from \"./Check.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 EllipsoidTangentPlane from \"./EllipsoidTangentPlane.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryInstance from \"./GeometryInstance.js\";\nimport GeometryOffsetAttribute from \"./GeometryOffsetAttribute.js\";\nimport GeometryPipeline from \"./GeometryPipeline.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport PolygonGeometryLibrary from \"./PolygonGeometryLibrary.js\";\nimport PolygonPipeline from \"./PolygonPipeline.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\nimport WindingOrder from \"./WindingOrder.js\";\nconst createGeometryFromPositionsPositions = [];\nconst createGeometryFromPositionsSubdivided = [];\n\nfunction createGeometryFromPositions(\n ellipsoid,\n positions,\n minDistance,\n perPositionHeight,\n arcType\n) {\n const tangentPlane = EllipsoidTangentPlane.fromPoints(positions, ellipsoid);\n const positions2D = tangentPlane.projectPointsOntoPlane(\n positions,\n createGeometryFromPositionsPositions\n );\n\n const originalWindingOrder = PolygonPipeline.computeWindingOrder2D(\n positions2D\n );\n if (originalWindingOrder === WindingOrder.CLOCKWISE) {\n positions2D.reverse();\n positions = positions.slice().reverse();\n }\n\n let subdividedPositions;\n let i;\n\n let length = positions.length;\n let index = 0;\n\n if (!perPositionHeight) {\n let numVertices = 0;\n if (arcType === ArcType.GEODESIC) {\n for (i = 0; i < length; i++) {\n numVertices += PolygonGeometryLibrary.subdivideLineCount(\n positions[i],\n positions[(i + 1) % length],\n minDistance\n );\n }\n } else if (arcType === ArcType.RHUMB) {\n for (i = 0; i < length; i++) {\n numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(\n ellipsoid,\n positions[i],\n positions[(i + 1) % length],\n minDistance\n );\n }\n }\n subdividedPositions = new Float64Array(numVertices * 3);\n for (i = 0; i < length; i++) {\n let tempPositions;\n if (arcType === ArcType.GEODESIC) {\n tempPositions = PolygonGeometryLibrary.subdivideLine(\n positions[i],\n positions[(i + 1) % length],\n minDistance,\n createGeometryFromPositionsSubdivided\n );\n } else if (arcType === ArcType.RHUMB) {\n tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(\n ellipsoid,\n positions[i],\n positions[(i + 1) % length],\n minDistance,\n createGeometryFromPositionsSubdivided\n );\n }\n const tempPositionsLength = tempPositions.length;\n for (let j = 0; j < tempPositionsLength; ++j) {\n subdividedPositions[index++] = tempPositions[j];\n }\n }\n } else {\n subdividedPositions = new Float64Array(length * 2 * 3);\n for (i = 0; i < length; i++) {\n const p0 = positions[i];\n const p1 = positions[(i + 1) % length];\n subdividedPositions[index++] = p0.x;\n subdividedPositions[index++] = p0.y;\n subdividedPositions[index++] = p0.z;\n subdividedPositions[index++] = p1.x;\n subdividedPositions[index++] = p1.y;\n subdividedPositions[index++] = p1.z;\n }\n }\n\n length = subdividedPositions.length / 3;\n const indicesSize =