qd-changjing/public/static/Build/CesiumUnminified/Workers/BoundingRectangle-8f2409a1....

1 line
21 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"BoundingRectangle-8f2409a1.js","sources":["../../../../Source/Core/BoundingRectangle.js"],"sourcesContent":["import Cartesian2 from \"./Cartesian2.js\";\nimport Cartographic from \"./Cartographic.js\";\nimport Check from \"./Check.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport GeographicProjection from \"./GeographicProjection.js\";\nimport Intersect from \"./Intersect.js\";\nimport Rectangle from \"./Rectangle.js\";\n\n/**\n * A bounding rectangle given by a corner, width and height.\n * @alias BoundingRectangle\n * @constructor\n *\n * @param {Number} [x=0.0] The x coordinate of the rectangle.\n * @param {Number} [y=0.0] The y coordinate of the rectangle.\n * @param {Number} [width=0.0] The width of the rectangle.\n * @param {Number} [height=0.0] The height of the rectangle.\n *\n * @see BoundingSphere\n * @see Packable\n */\nfunction BoundingRectangle(x, y, width, height) {\n /**\n * The x coordinate of the rectangle.\n * @type {Number}\n * @default 0.0\n */\n this.x = defaultValue(x, 0.0);\n\n /**\n * The y coordinate of the rectangle.\n * @type {Number}\n * @default 0.0\n */\n this.y = defaultValue(y, 0.0);\n\n /**\n * The width of the rectangle.\n * @type {Number}\n * @default 0.0\n */\n this.width = defaultValue(width, 0.0);\n\n /**\n * The height of the rectangle.\n * @type {Number}\n * @default 0.0\n */\n this.height = defaultValue(height, 0.0);\n}\n\n/**\n * The number of elements used to pack the object into an array.\n * @type {Number}\n */\nBoundingRectangle.packedLength = 4;\n\n/**\n * Stores the provided instance into the provided array.\n *\n * @param {BoundingRectangle} 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 */\nBoundingRectangle.pack = function (value, array, startingIndex) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.object(\"value\", value);\n Check.defined(\"array\", array);\n //>>includeEnd('debug');\n\n startingIndex = defaultValue(startingIndex, 0);\n\n array[startingIndex++] = value.x;\n array[startingIndex++] = value.y;\n array[startingIndex++] = value.width;\n array[startingIndex] = value.height;\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 {BoundingRectangle} [result] The object into which to store the result.\n * @returns {BoundingRectangle} The modified result parameter or a new BoundingRectangle instance if one was not provided.\n */\nBoundingRectangle.unpack = function (array, startingIndex, result) {\n //>>includeStart('debug', pragmas.debug);\n Check.defined(\"array\", array);\n //>>includeEnd('debug');\n\n startingIndex = defaultValue(startingIndex, 0);\n\n if (!defined(result)) {\n result = new BoundingRectangle();\n }\n result.x = array[startingIndex++];\n result.y = array[startingIndex++];\n result.width = array[startingIndex++];\n result.height = array[startingIndex];\n return result;\n};\n\n/**\n * Computes a bounding rectangle enclosing the list of 2D points.\n * The rectangle is oriented with the corner at the bottom left.\n *\n * @param {Cartesian2[]} positions List of points that the bounding rectangle will enclose. Each point must have <code>x</code> and <code>y</code> properties.\n * @param {BoundingRectangle} [result] The object onto which to store the result.\n * @returns {BoundingRectangle} The modified result parameter or a new BoundingRectangle instance if one was not provided.\n */\nBoundingRectangle.fromPoints = function (positions, result) {\n if (!defined(result)) {\n result = new BoundingRectangle();\n }\n\n if (!defined(positions) || positions.length === 0) {\n result.x = 0;\n result.y = 0;\n result.width = 0;\n resul