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

1 line
6.9 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createPlaneOutlineGeometry.js","sources":["../../../../Source/Core/PlaneOutlineGeometry.js","../../../../Source/WorkersES6/createPlaneOutlineGeometry.js"],"sourcesContent":["import BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defined from \"./defined.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\n\n/**\n * Describes geometry representing the outline of a plane centered at the origin, with a unit width and length.\n *\n * @alias PlaneOutlineGeometry\n * @constructor\n *\n */\nfunction PlaneOutlineGeometry() {\n this._workerName = \"createPlaneOutlineGeometry\";\n}\n\n/**\n * The number of elements used to pack the object into an array.\n * @type {Number}\n */\nPlaneOutlineGeometry.packedLength = 0;\n\n/**\n * Stores the provided instance into the provided array.\n *\n * @param {PlaneOutlineGeometry} value The value to pack.\n * @param {Number[]} array The array to pack into.\n *\n * @returns {Number[]} The array that was packed into\n */\nPlaneOutlineGeometry.pack = function (value, array) {\n //>>includeStart('debug', pragmas.debug);\n Check.defined(\"value\", value);\n Check.defined(\"array\", array);\n //>>includeEnd('debug');\n\n return array;\n};\n\n/**\n * Retrieves an instance from a packed array.\n *\n * @param {Number[]} array The packed array.\n * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.\n * @param {PlaneOutlineGeometry} [result] The object into which to store the result.\n * @returns {PlaneOutlineGeometry} The modified result parameter or a new PlaneOutlineGeometry instance if one was not provided.\n */\nPlaneOutlineGeometry.unpack = function (array, startingIndex, result) {\n //>>includeStart('debug', pragmas.debug);\n Check.defined(\"array\", array);\n //>>includeEnd('debug');\n\n if (!defined(result)) {\n return new PlaneOutlineGeometry();\n }\n\n return result;\n};\n\nconst min = new Cartesian3(-0.5, -0.5, 0.0);\nconst max = new Cartesian3(0.5, 0.5, 0.0);\n\n/**\n * Computes the geometric representation of an outline of a plane, including its vertices, indices, and a bounding sphere.\n *\n * @returns {Geometry|undefined} The computed vertices and indices.\n */\nPlaneOutlineGeometry.createGeometry = function () {\n const attributes = new GeometryAttributes();\n const indices = new Uint16Array(4 * 2);\n const positions = new Float64Array(4 * 3);\n\n positions[0] = min.x;\n positions[1] = min.y;\n positions[2] = min.z;\n positions[3] = max.x;\n positions[4] = min.y;\n positions[5] = min.z;\n positions[6] = max.x;\n positions[7] = max.y;\n positions[8] = min.z;\n positions[9] = min.x;\n positions[10] = max.y;\n positions[11] = min.z;\n\n attributes.position = new GeometryAttribute({\n componentDatatype: ComponentDatatype.DOUBLE,\n componentsPerAttribute: 3,\n values: positions,\n });\n\n indices[0] = 0;\n indices[1] = 1;\n indices[2] = 1;\n indices[3] = 2;\n indices[4] = 2;\n indices[5] = 3;\n indices[6] = 3;\n indices[7] = 0;\n\n return new Geometry({\n attributes: attributes,\n indices: indices,\n primitiveType: PrimitiveType.LINES,\n boundingSphere: new BoundingSphere(Cartesian3.ZERO, Math.sqrt(2.0)),\n });\n};\nexport default PlaneOutlineGeometry;\n","import defined from \"../Core/defined.js\";\nimport PlaneOutlineGeometry from \"../Core/PlaneOutlineGeometry.js\";\n\nfunction createPlaneOutlineGeometry(planeGeometry, offset) {\n if (defined(offset)) {\n planeGeometry = PlaneOutlineGeometry.unpack(planeGeometry, offset);\n }\n return PlaneOutlineGeometry.createGeometry(planeGeometry);\n}\nexport default createPlaneOutlineGeometry;\n"],"names":["Check","defined","Cartesian3","GeometryAttributes","GeometryAttribute","ComponentDatatype","Geometry","PrimitiveType","Bo