qd-changjing/public/static/Build/CesiumUnminified/Workers/PolygonGeometryLibrary-e329...

1 line
48 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"PolygonGeometryLibrary-e329b948.js","sources":["../../../../Source/Core/Queue.js","../../../../Source/Core/PolygonGeometryLibrary.js"],"sourcesContent":["/**\n * A queue that can enqueue items at the end, and dequeue items from the front.\n *\n * @alias Queue\n * @constructor\n */\nfunction Queue() {\n this._array = [];\n this._offset = 0;\n this._length = 0;\n}\n\nObject.defineProperties(Queue.prototype, {\n /**\n * The length of the queue.\n *\n * @memberof Queue.prototype\n *\n * @type {Number}\n * @readonly\n */\n length: {\n get: function () {\n return this._length;\n },\n },\n});\n\n/**\n * Enqueues the specified item.\n *\n * @param {*} item The item to enqueue.\n */\nQueue.prototype.enqueue = function (item) {\n this._array.push(item);\n this._length++;\n};\n\n/**\n * Dequeues an item. Returns undefined if the queue is empty.\n *\n * @returns {*} The the dequeued item.\n */\nQueue.prototype.dequeue = function () {\n if (this._length === 0) {\n return undefined;\n }\n\n const array = this._array;\n let offset = this._offset;\n const item = array[offset];\n array[offset] = undefined;\n\n offset++;\n if (offset > 10 && offset * 2 > array.length) {\n //compact array\n this._array = array.slice(offset);\n offset = 0;\n }\n\n this._offset = offset;\n this._length--;\n\n return item;\n};\n\n/**\n * Returns the item at the front of the queue. Returns undefined if the queue is empty.\n *\n * @returns {*} The item at the front of the queue.\n */\nQueue.prototype.peek = function () {\n if (this._length === 0) {\n return undefined;\n }\n\n return this._array[this._offset];\n};\n\n/**\n * Check whether this queue contains the specified item.\n *\n * @param {*} item The item to search for.\n */\nQueue.prototype.contains = function (item) {\n return this._array.indexOf(item) !== -1;\n};\n\n/**\n * Remove all items from the queue.\n */\nQueue.prototype.clear = function () {\n this._array.length = this._offset = this._length = 0;\n};\n\n/**\n * Sort the items in the queue in-place.\n *\n * @param {Queue.Comparator} compareFunction A function that defines the sort order.\n */\nQueue.prototype.sort = function (compareFunction) {\n if (this._offset > 0) {\n //compact array\n this._array = this._array.slice(this._offset);\n this._offset = 0;\n }\n\n this._array.sort(compareFunction);\n};\n\n/**\n * A function used to compare two items while sorting a queue.\n * @callback Queue.Comparator\n *\n * @param {*} a An item in the array.\n * @param {*} b An item in the array.\n * @returns {Number} Returns a negative value if <code>a</code> is less than <code>b</code>,\n * a positive value if <code>a</code> is greater than <code>b</code>, or\n * 0 if <code>a</code> is equal to <code>b</code>.\n *\n * @example\n * function compareNumbers(a, b) {\n * return a - b;\n * }\n */\nexport default Queue;\n","import ArcType from \"./ArcType.js\";\nimport arrayRemoveDuplicates from \"./arrayRemoveDuplicates.js\";\nimport Cartesian2 from \"./Cartesian2.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 Ellipsoid from \"./Ellipsoid.js\";\nimport EllipsoidRhumbLine from \"./EllipsoidRhumbLine.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport GeometryPipeline from \"./GeometryPipeline.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport Matrix3 from \"./Matrix3.js\";\nimport PolygonPipeline from \"./PolygonPipeline.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\nimport Quaternion from \"./Quaternion.js\";\nimport Queue from \"./Queue.js\";\nimport WindingOrder from \"./WindingOrder.js\";\n\n/**\n * @private\n */\nconst PolygonGeometryLibrary = {};\n\nPol