UNPKG

terriajs

Version:

Geospatial data visualization platform.

1,470 lines (1,259 loc) 3.25 MB
/******/ (function(modules) { // webpackBootstrap /******/ this["webpackChunk"] = function webpackChunkCallback(chunkIds, moreModules) { /******/ for(var moduleId in moreModules) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ while(chunkIds.length) /******/ installedChunks[chunkIds.pop()] = 1; /******/ }; /******/ /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded chunks /******/ // "1" means "already loaded" /******/ var installedChunks = { /******/ 1: 1 /******/ }; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // This file contains only the entry chunk. /******/ // The chunk loading function for additional chunks /******/ __webpack_require__.e = function requireEnsure(chunkId) { /******/ return new Promise(function(resolve) { /******/ // "1" is the signal for "already loaded" /******/ if(!installedChunks[chunkId]) { /******/ importScripts("" + chunkId + ".cesiumWorkers.js"); /******/ } /******/ resolve(); /******/ }); /******/ }; /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "build/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 164); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 'use strict'; /** * @exports defined * * @param {*} value The object. * @returns {Boolean} Returns true if the object is defined, returns false otherwise. * * @example * if (Cesium.defined(positions)) { * doSomething(); * } else { * doSomethingElse(); * } */ function defined(value) { return value !== undefined && value !== null; } return defined; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(9) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( freezeObject) { 'use strict'; /** * Returns the first parameter if not undefined, otherwise the second parameter. * Useful for setting a default value for a parameter. * * @exports defaultValue * * @param {*} a * @param {*} b * @returns {*} Returns the first parameter if not undefined, otherwise the second parameter. * * @example * param = Cesium.defaultValue(param, 'default'); */ function defaultValue(a, b) { if (a !== undefined && a !== null) { return a; } return b; } /** * A frozen empty object that can be used as the default value for options passed as * an object literal. * @type {Object} */ defaultValue.EMPTY_OBJECT = freezeObject({}); return defaultValue; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(5), __webpack_require__(1), __webpack_require__(0), __webpack_require__(3), __webpack_require__(9), __webpack_require__(4) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( Check, defaultValue, defined, DeveloperError, freezeObject, CesiumMath) { 'use strict'; /** * A 3D Cartesian point. * @alias Cartesian3 * @constructor * * @param {Number} [x=0.0] The X component. * @param {Number} [y=0.0] The Y component. * @param {Number} [z=0.0] The Z component. * * @see Cartesian2 * @see Cartesian4 * @see Packable */ function Cartesian3(x, y, z) { /** * The X component. * @type {Number} * @default 0.0 */ this.x = defaultValue(x, 0.0); /** * The Y component. * @type {Number} * @default 0.0 */ this.y = defaultValue(y, 0.0); /** * The Z component. * @type {Number} * @default 0.0 */ this.z = defaultValue(z, 0.0); } /** * Converts the provided Spherical into Cartesian3 coordinates. * * @param {Spherical} spherical The Spherical to be converted to Cartesian3. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. */ Cartesian3.fromSpherical = function(spherical, result) { if (!defined(result)) { result = new Cartesian3(); } var clock = spherical.clock; var cone = spherical.cone; var magnitude = defaultValue(spherical.magnitude, 1.0); var radial = magnitude * Math.sin(cone); result.x = radial * Math.cos(clock); result.y = radial * Math.sin(clock); result.z = magnitude * Math.cos(cone); return result; }; /** * Creates a Cartesian3 instance from x, y and z coordinates. * * @param {Number} x The x coordinate. * @param {Number} y The y coordinate. * @param {Number} z The z coordinate. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. */ Cartesian3.fromElements = function(x, y, z, result) { if (!defined(result)) { return new Cartesian3(x, y, z); } result.x = x; result.y = y; result.z = z; return result; }; /** * Duplicates a Cartesian3 instance. * * @param {Cartesian3} cartesian The Cartesian to duplicate. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined) */ Cartesian3.clone = function(cartesian, result) { if (!defined(cartesian)) { return undefined; } if (!defined(result)) { return new Cartesian3(cartesian.x, cartesian.y, cartesian.z); } result.x = cartesian.x; result.y = cartesian.y; result.z = cartesian.z; return result; }; /** * Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the * x, y, and z properties of the Cartesian4 and drops w. * @function * * @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian3 instance from. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. */ Cartesian3.fromCartesian4 = Cartesian3.clone; /** * The number of elements used to pack the object into an array. * @type {Number} */ Cartesian3.packedLength = 3; /** * Stores the provided instance into the provided array. * * @param {Cartesian3} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. * * @returns {Number[]} The array that was packed into */ Cartesian3.pack = function(value, array, startingIndex) { startingIndex = defaultValue(startingIndex, 0); array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex] = value.z; return array; }; /** * Retrieves an instance from a packed array. * * @param {Number[]} array The packed array. * @param {Number} [startingIndex=0] The starting index of the element to be unpacked. * @param {Cartesian3} [result] The object into which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. */ Cartesian3.unpack = function(array, startingIndex, result) { startingIndex = defaultValue(startingIndex, 0); if (!defined(result)) { result = new Cartesian3(); } result.x = array[startingIndex++]; result.y = array[startingIndex++]; result.z = array[startingIndex]; return result; }; /** * Flattens an array of Cartesian3s into an array of components. * * @param {Cartesian3[]} array The array of cartesians to pack. * @param {Number[]} result The array onto which to store the result. * @returns {Number[]} The packed array. */ Cartesian3.packArray = function(array, result) { var length = array.length; if (!defined(result)) { result = new Array(length * 3); } else { result.length = length * 3; } for (var i = 0; i < length; ++i) { Cartesian3.pack(array[i], result, i * 3); } return result; }; /** * Unpacks an array of cartesian components into an array of Cartesian3s. * * @param {Number[]} array The array of components to unpack. * @param {Cartesian3[]} result The array onto which to store the result. * @returns {Cartesian3[]} The unpacked array. */ Cartesian3.unpackArray = function(array, result) { var length = array.length; if (!defined(result)) { result = new Array(length / 3); } else { result.length = length / 3; } for (var i = 0; i < length; i += 3) { var index = i / 3; result[index] = Cartesian3.unpack(array, i, result[index]); } return result; }; /** * Creates a Cartesian3 from three consecutive elements in an array. * @function * * @param {Number[]} array The array whose three consecutive elements correspond to the x, y, and z components, respectively. * @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. * * @example * // Create a Cartesian3 with (1.0, 2.0, 3.0) * var v = [1.0, 2.0, 3.0]; * var p = Cesium.Cartesian3.fromArray(v); * * // Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array * var v2 = [0.0, 0.0, 1.0, 2.0, 3.0]; * var p2 = Cesium.Cartesian3.fromArray(v2, 2); */ Cartesian3.fromArray = Cartesian3.unpack; /** * Computes the value of the maximum component for the supplied Cartesian. * * @param {Cartesian3} cartesian The cartesian to use. * @returns {Number} The value of the maximum component. */ Cartesian3.maximumComponent = function(cartesian) { return Math.max(cartesian.x, cartesian.y, cartesian.z); }; /** * Computes the value of the minimum component for the supplied Cartesian. * * @param {Cartesian3} cartesian The cartesian to use. * @returns {Number} The value of the minimum component. */ Cartesian3.minimumComponent = function(cartesian) { return Math.min(cartesian.x, cartesian.y, cartesian.z); }; /** * Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians. * * @param {Cartesian3} first A cartesian to compare. * @param {Cartesian3} second A cartesian to compare. * @param {Cartesian3} result The object into which to store the result. * @returns {Cartesian3} A cartesian with the minimum components. */ Cartesian3.minimumByComponent = function(first, second, result) { result.x = Math.min(first.x, second.x); result.y = Math.min(first.y, second.y); result.z = Math.min(first.z, second.z); return result; }; /** * Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians. * * @param {Cartesian3} first A cartesian to compare. * @param {Cartesian3} second A cartesian to compare. * @param {Cartesian3} result The object into which to store the result. * @returns {Cartesian3} A cartesian with the maximum components. */ Cartesian3.maximumByComponent = function(first, second, result) { result.x = Math.max(first.x, second.x); result.y = Math.max(first.y, second.y); result.z = Math.max(first.z, second.z); return result; }; /** * Computes the provided Cartesian's squared magnitude. * * @param {Cartesian3} cartesian The Cartesian instance whose squared magnitude is to be computed. * @returns {Number} The squared magnitude. */ Cartesian3.magnitudeSquared = function(cartesian) { return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z; }; /** * Computes the Cartesian's magnitude (length). * * @param {Cartesian3} cartesian The Cartesian instance whose magnitude is to be computed. * @returns {Number} The magnitude. */ Cartesian3.magnitude = function(cartesian) { return Math.sqrt(Cartesian3.magnitudeSquared(cartesian)); }; var distanceScratch = new Cartesian3(); /** * Computes the distance between two points. * * @param {Cartesian3} left The first point to compute the distance from. * @param {Cartesian3} right The second point to compute the distance to. * @returns {Number} The distance between two points. * * @example * // Returns 1.0 * var d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0)); */ Cartesian3.distance = function(left, right) { Cartesian3.subtract(left, right, distanceScratch); return Cartesian3.magnitude(distanceScratch); }; /** * Computes the squared distance between two points. Comparing squared distances * using this function is more efficient than comparing distances using {@link Cartesian3#distance}. * * @param {Cartesian3} left The first point to compute the distance from. * @param {Cartesian3} right The second point to compute the distance to. * @returns {Number} The distance between two points. * * @example * // Returns 4.0, not 2.0 * var d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0)); */ Cartesian3.distanceSquared = function(left, right) { Cartesian3.subtract(left, right, distanceScratch); return Cartesian3.magnitudeSquared(distanceScratch); }; /** * Computes the normalized form of the supplied Cartesian. * * @param {Cartesian3} cartesian The Cartesian to be normalized. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.normalize = function(cartesian, result) { var magnitude = Cartesian3.magnitude(cartesian); result.x = cartesian.x / magnitude; result.y = cartesian.y / magnitude; result.z = cartesian.z / magnitude; return result; }; /** * Computes the dot (scalar) product of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @returns {Number} The dot product. */ Cartesian3.dot = function(left, right) { return left.x * right.x + left.y * right.y + left.z * right.z; }; /** * Computes the componentwise product of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.multiplyComponents = function(left, right, result) { result.x = left.x * right.x; result.y = left.y * right.y; result.z = left.z * right.z; return result; }; /** * Computes the componentwise quotient of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.divideComponents = function(left, right, result) { result.x = left.x / right.x; result.y = left.y / right.y; result.z = left.z / right.z; return result; }; /** * Computes the componentwise sum of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.add = function(left, right, result) { result.x = left.x + right.x; result.y = left.y + right.y; result.z = left.z + right.z; return result; }; /** * Computes the componentwise difference of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.subtract = function(left, right, result) { result.x = left.x - right.x; result.y = left.y - right.y; result.z = left.z - right.z; return result; }; /** * Multiplies the provided Cartesian componentwise by the provided scalar. * * @param {Cartesian3} cartesian The Cartesian to be scaled. * @param {Number} scalar The scalar to multiply with. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.multiplyByScalar = function(cartesian, scalar, result) { result.x = cartesian.x * scalar; result.y = cartesian.y * scalar; result.z = cartesian.z * scalar; return result; }; /** * Divides the provided Cartesian componentwise by the provided scalar. * * @param {Cartesian3} cartesian The Cartesian to be divided. * @param {Number} scalar The scalar to divide by. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.divideByScalar = function(cartesian, scalar, result) { result.x = cartesian.x / scalar; result.y = cartesian.y / scalar; result.z = cartesian.z / scalar; return result; }; /** * Negates the provided Cartesian. * * @param {Cartesian3} cartesian The Cartesian to be negated. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.negate = function(cartesian, result) { result.x = -cartesian.x; result.y = -cartesian.y; result.z = -cartesian.z; return result; }; /** * Computes the absolute value of the provided Cartesian. * * @param {Cartesian3} cartesian The Cartesian whose absolute value is to be computed. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.abs = function(cartesian, result) { result.x = Math.abs(cartesian.x); result.y = Math.abs(cartesian.y); result.z = Math.abs(cartesian.z); return result; }; var lerpScratch = new Cartesian3(); /** * Computes the linear interpolation or extrapolation at t using the provided cartesians. * * @param {Cartesian3} start The value corresponding to t at 0.0. * @param {Cartesian3} end The value corresponding to t at 1.0. * @param {Number} t The point along t at which to interpolate. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The modified result parameter. */ Cartesian3.lerp = function(start, end, t, result) { Cartesian3.multiplyByScalar(end, t, lerpScratch); result = Cartesian3.multiplyByScalar(start, 1.0 - t, result); return Cartesian3.add(lerpScratch, result, result); }; var angleBetweenScratch = new Cartesian3(); var angleBetweenScratch2 = new Cartesian3(); /** * Returns the angle, in radians, between the provided Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @returns {Number} The angle between the Cartesians. */ Cartesian3.angleBetween = function(left, right) { Cartesian3.normalize(left, angleBetweenScratch); Cartesian3.normalize(right, angleBetweenScratch2); var cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2); var sine = Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch, angleBetweenScratch2, angleBetweenScratch)); return Math.atan2(sine, cosine); }; var mostOrthogonalAxisScratch = new Cartesian3(); /** * Returns the axis that is most orthogonal to the provided Cartesian. * * @param {Cartesian3} cartesian The Cartesian on which to find the most orthogonal axis. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The most orthogonal axis. */ Cartesian3.mostOrthogonalAxis = function(cartesian, result) { var f = Cartesian3.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian3.abs(f, f); if (f.x <= f.y) { if (f.x <= f.z) { result = Cartesian3.clone(Cartesian3.UNIT_X, result); } else { result = Cartesian3.clone(Cartesian3.UNIT_Z, result); } } else if (f.y <= f.z) { result = Cartesian3.clone(Cartesian3.UNIT_Y, result); } else { result = Cartesian3.clone(Cartesian3.UNIT_Z, result); } return result; }; /** * Projects vector a onto vector b * @param {Cartesian3} a The vector that needs projecting * @param {Cartesian3} b The vector to project onto * @param {Cartesian3} result The result cartesian * @returns {Cartesian3} The modified result parameter */ Cartesian3.projectVector = function(a, b, result) { var scalar = Cartesian3.dot(a, b) / Cartesian3.dot(b, b); return Cartesian3.multiplyByScalar(b, scalar, result); }; /** * Compares the provided Cartesians componentwise and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Cartesian3} [left] The first Cartesian. * @param {Cartesian3} [right] The second Cartesian. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ Cartesian3.equals = function(left, right) { return (left === right) || ((defined(left)) && (defined(right)) && (left.x === right.x) && (left.y === right.y) && (left.z === right.z)); }; /** * @private */ Cartesian3.equalsArray = function(cartesian, array, offset) { return cartesian.x === array[offset] && cartesian.y === array[offset + 1] && cartesian.z === array[offset + 2]; }; /** * Compares the provided Cartesians componentwise and returns * <code>true</code> if they pass an absolute or relative tolerance test, * <code>false</code> otherwise. * * @param {Cartesian3} [left] The first Cartesian. * @param {Cartesian3} [right] The second Cartesian. * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise. */ Cartesian3.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) { return (left === right) || (defined(left) && defined(right) && CesiumMath.equalsEpsilon(left.x, right.x, relativeEpsilon, absoluteEpsilon) && CesiumMath.equalsEpsilon(left.y, right.y, relativeEpsilon, absoluteEpsilon) && CesiumMath.equalsEpsilon(left.z, right.z, relativeEpsilon, absoluteEpsilon)); }; /** * Computes the cross (outer) product of two Cartesians. * * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The cross product. */ Cartesian3.cross = function(left, right, result) { var leftX = left.x; var leftY = left.y; var leftZ = left.z; var rightX = right.x; var rightY = right.y; var rightZ = right.z; var x = leftY * rightZ - leftZ * rightY; var y = leftZ * rightX - leftX * rightZ; var z = leftX * rightY - leftY * rightX; result.x = x; result.y = y; result.z = z; return result; }; /** * Computes the midpoint between the right and left Cartesian. * @param {Cartesian3} left The first Cartesian. * @param {Cartesian3} right The second Cartesian. * @param {Cartesian3} result The object onto which to store the result. * @returns {Cartesian3} The midpoint. */ Cartesian3.midpoint = function(left, right, result) { result.x = (left.x + right.x) * 0.5; result.y = (left.y + right.y) * 0.5; result.z = (left.z + right.z) * 0.5; return result; }; /** * Returns a Cartesian3 position from longitude and latitude values given in degrees. * * @param {Number} longitude The longitude, in degrees * @param {Number} latitude The latitude, in degrees * @param {Number} [height=0.0] The height, in meters, above the ellipsoid. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The position * * @example * var position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0); */ Cartesian3.fromDegrees = function(longitude, latitude, height, ellipsoid, result) { longitude = CesiumMath.toRadians(longitude); latitude = CesiumMath.toRadians(latitude); return Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result); }; var scratchN = new Cartesian3(); var scratchK = new Cartesian3(); var wgs84RadiiSquared = new Cartesian3(6378137.0 * 6378137.0, 6378137.0 * 6378137.0, 6356752.3142451793 * 6356752.3142451793); /** * Returns a Cartesian3 position from longitude and latitude values given in radians. * * @param {Number} longitude The longitude, in radians * @param {Number} latitude The latitude, in radians * @param {Number} [height=0.0] The height, in meters, above the ellipsoid. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies. * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The position * * @example * var position = Cesium.Cartesian3.fromRadians(-2.007, 0.645); */ Cartesian3.fromRadians = function(longitude, latitude, height, ellipsoid, result) { height = defaultValue(height, 0.0); var radiiSquared = defined(ellipsoid) ? ellipsoid.radiiSquared : wgs84RadiiSquared; var cosLatitude = Math.cos(latitude); scratchN.x = cosLatitude * Math.cos(longitude); scratchN.y = cosLatitude * Math.sin(longitude); scratchN.z = Math.sin(latitude); scratchN = Cartesian3.normalize(scratchN, scratchN); Cartesian3.multiplyComponents(radiiSquared, scratchN, scratchK); var gamma = Math.sqrt(Cartesian3.dot(scratchN, scratchK)); scratchK = Cartesian3.divideByScalar(scratchK, gamma, scratchK); scratchN = Cartesian3.multiplyByScalar(scratchN, height, scratchN); if (!defined(result)) { result = new Cartesian3(); } return Cartesian3.add(scratchK, scratchN, result); }; /** * Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees. * * @param {Number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...]. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the coordinates lie. * @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result. * @returns {Cartesian3[]} The array of positions. * * @example * var positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]); */ Cartesian3.fromDegreesArray = function(coordinates, ellipsoid, result) { var length = coordinates.length; if (!defined(result)) { result = new Array(length / 2); } else { result.length = length / 2; } for (var i = 0; i < length; i += 2) { var longitude = coordinates[i]; var latitude = coordinates[i + 1]; var index = i / 2; result[index] = Cartesian3.fromDegrees(longitude, latitude, 0, ellipsoid, result[index]); } return result; }; /** * Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians. * * @param {Number[]} coordinates A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...]. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the coordinates lie. * @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result. * @returns {Cartesian3[]} The array of positions. * * @example * var positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]); */ Cartesian3.fromRadiansArray = function(coordinates, ellipsoid, result) { var length = coordinates.length; if (!defined(result)) { result = new Array(length / 2); } else { result.length = length / 2; } for (var i = 0; i < length; i += 2) { var longitude = coordinates[i]; var latitude = coordinates[i + 1]; var index = i / 2; result[index] = Cartesian3.fromRadians(longitude, latitude, 0, ellipsoid, result[index]); } return result; }; /** * Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees. * * @param {Number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...]. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies. * @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result. * @returns {Cartesian3[]} The array of positions. * * @example * var positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]); */ Cartesian3.fromDegreesArrayHeights = function(coordinates, ellipsoid, result) { var length = coordinates.length; if (!defined(result)) { result = new Array(length / 3); } else { result.length = length / 3; } for (var i = 0; i < length; i += 3) { var longitude = coordinates[i]; var latitude = coordinates[i + 1]; var height = coordinates[i + 2]; var index = i / 3; result[index] = Cartesian3.fromDegrees(longitude, latitude, height, ellipsoid, result[index]); } return result; }; /** * Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians. * * @param {Number[]} coordinates A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...]. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the position lies. * @param {Cartesian3[]} [result] An array of Cartesian3 objects to store the result. * @returns {Cartesian3[]} The array of positions. * * @example * var positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]); */ Cartesian3.fromRadiansArrayHeights = function(coordinates, ellipsoid, result) { var length = coordinates.length; if (!defined(result)) { result = new Array(length / 3); } else { result.length = length / 3; } for (var i = 0; i < length; i += 3) { var longitude = coordinates[i]; var latitude = coordinates[i + 1]; var height = coordinates[i + 2]; var index = i / 3; result[index] = Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result[index]); } return result; }; /** * An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0). * * @type {Cartesian3} * @constant */ Cartesian3.ZERO = freezeObject(new Cartesian3(0.0, 0.0, 0.0)); /** * An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0). * * @type {Cartesian3} * @constant */ Cartesian3.UNIT_X = freezeObject(new Cartesian3(1.0, 0.0, 0.0)); /** * An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0). * * @type {Cartesian3} * @constant */ Cartesian3.UNIT_Y = freezeObject(new Cartesian3(0.0, 1.0, 0.0)); /** * An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0). * * @type {Cartesian3} * @constant */ Cartesian3.UNIT_Z = freezeObject(new Cartesian3(0.0, 0.0, 1.0)); /** * Duplicates this Cartesian3 instance. * * @param {Cartesian3} [result] The object onto which to store the result. * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if one was not provided. */ Cartesian3.prototype.clone = function(result) { return Cartesian3.clone(this, result); }; /** * Compares this Cartesian against the provided Cartesian componentwise and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Cartesian3} [right] The right hand side Cartesian. * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise. */ Cartesian3.prototype.equals = function(right) { return Cartesian3.equals(this, right); }; /** * Compares this Cartesian against the provided Cartesian componentwise and returns * <code>true</code> if they pass an absolute or relative tolerance test, * <code>false</code> otherwise. * * @param {Cartesian3} [right] The right hand side Cartesian. * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise. */ Cartesian3.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) { return Cartesian3.equalsEpsilon(this, right, relativeEpsilon, absoluteEpsilon); }; /** * Creates a string representing this Cartesian in the format '(x, y, z)'. * * @returns {String} A string representing this Cartesian in the format '(x, y, z)'. */ Cartesian3.prototype.toString = function() { return '(' + this.x + ', ' + this.y + ', ' + this.z + ')'; }; return Cartesian3; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(0) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( defined) { 'use strict'; /** * Constructs an exception object that is thrown due to a developer error, e.g., invalid argument, * argument out of range, etc. This exception should only be thrown during development; * it usually indicates a bug in the calling code. This exception should never be * caught; instead the calling code should strive not to generate it. * <br /><br /> * On the other hand, a {@link RuntimeError} indicates an exception that may * be thrown at runtime, e.g., out of memory, that the calling code should be prepared * to catch. * * @alias DeveloperError * @constructor * @extends Error * * @param {String} [message] The error message for this exception. * * @see RuntimeError */ function DeveloperError(message) { /** * 'DeveloperError' indicating that this exception was thrown due to a developer error. * @type {String} * @readonly */ this.name = 'DeveloperError'; /** * The explanation for why this exception was thrown. * @type {String} * @readonly */ this.message = message; //Browsers such as IE don't have a stack property until you actually throw the error. var stack; try { throw new Error(); } catch (e) { stack = e.stack; } /** * The stack trace of this exception, if available. * @type {String} * @readonly */ this.stack = stack; } if (defined(Object.create)) { DeveloperError.prototype = Object.create(Error.prototype); DeveloperError.prototype.constructor = DeveloperError; } DeveloperError.prototype.toString = function() { var str = this.name + ': ' + this.message; if (defined(this.stack)) { str += '\n' + this.stack.toString(); } return str; }; /** * @private */ DeveloperError.throwInstantiationError = function() { throw new DeveloperError('This function defines an interface and should not be called directly.'); }; return DeveloperError; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(167), __webpack_require__(5), __webpack_require__(1), __webpack_require__(0), __webpack_require__(3) ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( MersenneTwister, Check, defaultValue, defined, DeveloperError) { 'use strict'; /** * Math functions. * * @exports CesiumMath * @alias Math */ var CesiumMath = {}; /** * 0.1 * @type {Number} * @constant */ CesiumMath.EPSILON1 = 0.1; /** * 0.01 * @type {Number} * @constant */ CesiumMath.EPSILON2 = 0.01; /** * 0.001 * @type {Number} * @constant */ CesiumMath.EPSILON3 = 0.001; /** * 0.0001 * @type {Number} * @constant */ CesiumMath.EPSILON4 = 0.0001; /** * 0.00001 * @type {Number} * @constant */ CesiumMath.EPSILON5 = 0.00001; /** * 0.000001 * @type {Number} * @constant */ CesiumMath.EPSILON6 = 0.000001; /** * 0.0000001 * @type {Number} * @constant */ CesiumMath.EPSILON7 = 0.0000001; /** * 0.00000001 * @type {Number} * @constant */ CesiumMath.EPSILON8 = 0.00000001; /** * 0.000000001 * @type {Number} * @constant */ CesiumMath.EPSILON9 = 0.000000001; /** * 0.0000000001 * @type {Number} * @constant */ CesiumMath.EPSILON10 = 0.0000000001; /** * 0.00000000001 * @type {Number} * @constant */ CesiumMath.EPSILON11 = 0.00000000001; /** * 0.000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON12 = 0.000000000001; /** * 0.0000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON13 = 0.0000000000001; /** * 0.00000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON14 = 0.00000000000001; /** * 0.000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON15 = 0.000000000000001; /** * 0.0000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON16 = 0.0000000000000001; /** * 0.00000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON17 = 0.00000000000000001; /** * 0.000000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON18 = 0.000000000000000001; /** * 0.0000000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON19 = 0.0000000000000000001; /** * 0.00000000000000000001 * @type {Number} * @constant */ CesiumMath.EPSILON20 = 0.00000000000000000001; /** * The gravitational parameter of the Earth in meters cubed * per second squared as defined by the WGS84 model: 3.986004418e14 * @type {Number} * @constant */ CesiumMath.GRAVITATIONALPARAMETER = 3.986004418e14; /** * Radius of the sun in meters: 6.955e8 * @type {Number} * @constant */ CesiumMath.SOLAR_RADIUS = 6.955e8; /** * The mean radius of the moon, according to the "Report of the IAU/IAG Working Group on * Cartographic Coordinates and Rotational Elements of the Planets and satellites: 2000", * Celestial Mechanics 82: 83-110, 2002. * @type {Number} * @constant */ CesiumMath.LUNAR_RADIUS = 1737400.0; /** * 64 * 1024 * @type {Number} * @constant */ CesiumMath.SIXTY_FOUR_KILOBYTES = 64 * 1024; /** * Returns the sign of the value; 1 if the value is positive, -1 if the value is * negative, or 0 if the value is 0. * * @function * @param {Number} value The value to return the sign of. * @returns {Number} The sign of value. */ CesiumMath.sign = defaultValue(Math.sign, function sign(value) { value = +value; // coerce to number if (value === 0 || value !== value) { // zero or NaN return value; } return value > 0 ? 1 : -1; }); /** * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. * This is similar to {@link CesiumMath#sign} except that returns 1.0 instead of * 0.0 when the input value is 0.0. * @param {Number} value The value to return the sign of. * @returns {Number} The sign of value. */ CesiumMath.signNotZero = function(value) { return value < 0.0 ? -1.0 : 1.0; }; /** * Converts a scalar value in the range [-1.0, 1.0] to a SNORM in the range [0, rangeMax] * @param {Number} value The scalar value in the range [-1.0, 1.0] * @param {Number} [rangeMax=255] The maximum value in the mapped range, 255 by default. * @returns {Number} A SNORM value, where 0 maps to -1.0 and rangeMax maps to 1.0. * * @see CesiumMath.fromSNorm */ CesiumMath.toSNorm = function(value, rangeMax) { rangeMax = defaultValue(rangeMax, 255); return Math.round((CesiumMath.clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMax); }; /** * Converts a SNORM value in the range [0, rangeMax] to a scalar in the range [-1.0, 1.0]. * @param {Number} value SNORM value in the range [0, 255] * @param {Number} [rangeMax=255] The maximum value in the SNORM range, 255 by default. * @returns {Number} Scalar in the range [-1.0, 1.0]. * * @see CesiumMath.toSNorm */ CesiumMath.fromSNorm = function(value, rangeMax) { rangeMax = defaultValue(range