1 line
7.5 KiB
Plaintext
1 line
7.5 KiB
Plaintext
|
{"version":3,"file":"createSphereOutlineGeometry.js","sources":["../../../../Source/Core/SphereOutlineGeometry.js","../../../../Source/WorkersES6/createSphereOutlineGeometry.js"],"sourcesContent":["import Cartesian3 from \"./Cartesian3.js\";\nimport Check from \"./Check.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport EllipsoidOutlineGeometry from \"./EllipsoidOutlineGeometry.js\";\n\n/**\n * A description of the outline of a sphere.\n *\n * @alias SphereOutlineGeometry\n * @constructor\n *\n * @param {Object} [options] Object with the following properties:\n * @param {Number} [options.radius=1.0] The radius of the sphere.\n * @param {Number} [options.stackPartitions=10] The count of stacks for the sphere (1 greater than the number of parallel lines).\n * @param {Number} [options.slicePartitions=8] The count of slices for the sphere (Equal to the number of radial lines).\n * @param {Number} [options.subdivisions=200] The number of points per line, determining the granularity of the curvature .\n *\n * @exception {DeveloperError} options.stackPartitions must be greater than or equal to one.\n * @exception {DeveloperError} options.slicePartitions must be greater than or equal to zero.\n * @exception {DeveloperError} options.subdivisions must be greater than or equal to zero.\n *\n * @example\n * const sphere = new Cesium.SphereOutlineGeometry({\n * radius : 100.0,\n * stackPartitions : 6,\n * slicePartitions: 5\n * });\n * const geometry = Cesium.SphereOutlineGeometry.createGeometry(sphere);\n */\nfunction SphereOutlineGeometry(options) {\n const radius = defaultValue(options.radius, 1.0);\n const radii = new Cartesian3(radius, radius, radius);\n const ellipsoidOptions = {\n radii: radii,\n stackPartitions: options.stackPartitions,\n slicePartitions: options.slicePartitions,\n subdivisions: options.subdivisions,\n };\n\n this._ellipsoidGeometry = new EllipsoidOutlineGeometry(ellipsoidOptions);\n this._workerName = \"createSphereOutlineGeometry\";\n}\n\n/**\n * The number of elements used to pack the object into an array.\n * @type {Number}\n */\nSphereOutlineGeometry.packedLength = EllipsoidOutlineGeometry.packedLength;\n\n/**\n * Stores the provided instance into the provided array.\n *\n * @param {SphereOutlineGeometry} value The value to pack.\n * @param {Number[]} array The array to pack into.\n * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.\n *\n * @returns {Number[]} The array that was packed into\n */\nSphereOutlineGeometry.pack = function (value, array, startingIndex) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"value\", value);\n //>>includeEnd('debug');\n\n return EllipsoidOutlineGeometry.pack(\n value._ellipsoidGeometry,\n array,\n startingIndex\n );\n};\n\nconst scratchEllipsoidGeometry = new EllipsoidOutlineGeometry();\nconst scratchOptions = {\n radius: undefined,\n radii: new Cartesian3(),\n stackPartitions: undefined,\n slicePartitions: undefined,\n subdivisions: undefined,\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 {SphereOutlineGeometry} [result] The object into which to store the result.\n * @returns {SphereOutlineGeometry} The modified result parameter or a new SphereOutlineGeometry instance if one was not provided.\n */\nSphereOutlineGeometry.unpack = function (array, startingIndex, result) {\n const ellipsoidGeometry = EllipsoidOutlineGeometry.unpack(\n array,\n startingIndex,\n scratchEllipsoidGeometry\n );\n scratchOptions.stackPartitions = ellipsoidGeometry._stackPartitions;\n scratchOptions.slicePartitions = ellipsoidGeometry._slicePartitions;\n scratchOptions.subdivisions = ellipsoidGeometry._subdivisions;\n\n if (!defined(result)) {\n scratchOptions.radius = ellipsoidGeometry._radii.x;\n return new SphereOutlineGeometry(scratchOptions);\n }
|