You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
38 KiB
74 lines
38 KiB
2 years ago
|
/**
|
||
|
* Cesium - https://github.com/AnalyticalGraphicsInc/cesium
|
||
|
*
|
||
|
* Copyright 2011-2017 Cesium Contributors
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
* Columbus View (Pat. Pend.)
|
||
|
*
|
||
|
* Portions licensed separately.
|
||
|
* See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
|
||
|
*/
|
||
|
/**
|
||
|
@license
|
||
|
mersenne-twister.js - https://gist.github.com/banksean/300494
|
||
|
|
||
|
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||
|
All rights reserved.
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions
|
||
|
are met:
|
||
|
|
||
|
1. Redistributions of source code must retain the above copyright
|
||
|
notice, this list of conditions and the following disclaimer.
|
||
|
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in the
|
||
|
documentation and/or other materials provided with the distribution.
|
||
|
|
||
|
3. The names of its contributors may not be used to endorse or promote
|
||
|
products derived from this software without specific prior written
|
||
|
permission.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
@license
|
||
|
when.js - https://github.com/cujojs/when
|
||
|
|
||
|
MIT License (c) copyright B Cavalier & J Hann
|
||
|
|
||
|
* A lightweight CommonJS Promises/A and when() implementation
|
||
|
* when is part of the cujo.js family of libraries (http://cujojs.com/)
|
||
|
*
|
||
|
* Licensed under the MIT License at:
|
||
|
* http://www.opensource.org/licenses/mit-license.php
|
||
|
*
|
||
|
* @version 1.7.1
|
||
|
*/
|
||
|
|
||
|
!function(){define("Core/defined",[],function(){"use strict";function t(t){return void 0!==t&&null!==t}return t}),define("Core/DeveloperError",["./defined"],function(t){"use strict";function e(t){this.name="DeveloperError",this.message=t;var e;try{throw new Error}catch(t){e=t.stack}this.stack=e}return t(Object.create)&&(e.prototype=Object.create(Error.prototype),e.prototype.constructor=e),e.prototype.toString=function(){var e=this.name+": "+this.message;return t(this.stack)&&(e+="\n"+this.stack.toString()),e},e.throwInstantiationError=function(){throw new e("This function defines an interface and should not be called directly.")},e}),define("Core/Check",["./defined","./DeveloperError"],function(t,e){"use strict";function n(t){return t+" is required, actual value was undefined"}function r(t,e,n){return"Expected "+n+" to be typeof "+e+", actual typeof was "+t}var i={};return i.typeOf={},i.defined=function(r,i){if(!t(i))throw new e(n(r))},i.typeOf.func=function(t,n){if("function"!=typeof n)throw new e(r(typeof n,"function",t))},i.typeOf.string=function(t,n){if("string"!=typeof n)throw new e(r(typeof n,"string",t))},i.typeOf.number=function(t,n){if("number"!=typeof n)throw new e(r(typeof n,"number",t))},i.typeOf.number.lessThan=function(t,n,r){if(i.typeOf.number(t,n),n>=r)throw new e("Expected "+t+" to be less than "+r+", actual value was "+n)},i.typeOf.number.lessThanOrEquals=function(t,n,r){if(i.typeOf.number(t,n),n>r)throw new e("Expected "+t+" to be less than or equal to "+r+", actual value was "+n)},i.typeOf.number.greaterThan=function(t,n,r){if(i.typeOf.number(t,n),n<=r)throw new e("Expected "+t+" to be greater than "+r+", actual value was "+n)},i.typeOf.number.greaterThanOrEquals=function(t,n,r){if(i.typeOf.number(t,n),n<r)throw new e("Expected "+t+" to be greater than or equal to"+r+", actual value was "+n)},i.typeOf.object=function(t,n){if("object"!=typeof n)throw new e(r(typeof n,"object",t))},i.typeOf.bool=function(t,n){if("boolean"!=typeof n)throw new e(r(typeof n,"boolean",t))},i.typeOf.number.equals=function(t,n,r,o){if(i.typeOf.number(t,r),i.typeOf.number(n,o),r!==o)throw new e(t+" must be equal to "+n+", the actual values are "+r+" and "+o)},i}),define("Core/freezeObject",["./defined"],function(t){"use strict";var e=Object.freeze;return t(e)||(e=function(t){return t}),e}),define("Core/defaultValue",["./freezeObject"],function(t){"use strict";function e(t,e){return void 0!==t&&null!==t?t:e}return e.EMPTY_OBJECT=t({}),e}),define("ThirdParty/mersenne-twister",[],function(){var t=function(t){void 0==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,this.init_genrand(t)};return t.prototype.init_genrand=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.genrand_int32=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_genrand(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[1&t];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},t.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},t}),define("Core/Math",["../ThirdParty/mersenne-twister","./Check","./defaultValue","./defined","./DeveloperError"],function(t,e,n,r,i){"use strict";var o={};o.EPSILON1=.1,o.EPSILON2=.01,o.EPSILON3=.001,o.EPSILON4=1e-4,o.EPSILON5=1e-5,o.EPSILON6=1e-6,o.EPSILON7=1e-7,o.EPSILON8=1e-8,o.EPSILON9=1e-9,o.EPSILON10=1e-10,o.EPSILON11=1e-11,o.EPSILON12=1e-12,o.EPSILON13=1e-13,o.EPSILON14=1e-14
|
||
|
;return d.then(r,i,o)})}function c(t,e,n,r){function i(t){return e?e(t[0]):t[0]}return s(t,1,i,n,r)}function h(t,e,n,r){return y(1,arguments),l(t,v).then(e,n,r)}function f(){return l(arguments,v)}function l(e,n){return t(e,function(e){var r,i,o,u,s,c;if(o=i=e.length>>>0,r=[],c=a(),o)for(u=function(e,i){t(e,n).then(function(t){r[i]=t,--o||c.resolve(r)},c.reject)},s=0;s<i;s++)s in e?u(e[s],s):--o;else c.resolve(r);return c.promise})}function d(e,n){var r=x.call(arguments,1);return t(e,function(e){var i;return i=e.length,r[0]=function(e,r,o){return t(e,function(e){return t(r,function(t){return n(e,t,o,i)})})},w.apply(e,r)})}function m(e,n,r){var i=arguments.length>2;return t(e,function(t){return t=i?r:t,n.resolve(t),t},function(t){return n.reject(t),o(t)},n.progress)}function p(t,e){for(var n,r=0;n=t[r++];)n(e)}function y(t,e){for(var n,r=e.length;r>t;)if(null!=(n=e[--r])&&"function"!=typeof n)throw new Error("arg "+r+" must be a function")}function g(){}function v(t){return t}var w,x,M;return t.defer=a,t.resolve=e,t.reject=n,t.join=f,t.all=h,t.map=l,t.reduce=d,t.any=c,t.some=s,t.chain=m,t.isPromise=u,r.prototype={always:function(t,e){return this.then(t,t,e)},otherwise:function(t){return this.then(M,t)},yield:function(t){return this.then(function(){return t})},spread:function(t){return this.then(function(e){return h(e,function(e){return t.apply(M,e)})})}},x=[].slice,w=[].reduce||function(t){var e,n,r,i,o;if(o=0,e=Object(this),i=e.length>>>0,n=arguments,n.length<=1)for(;;){if(o in e){r=e[o++];break}if(++o>=i)throw new TypeError}else r=n[1];for(;o<i;++o)o in e&&(r=t(r,e[o],o,e));return r},t})}("function"==typeof define&&define.amd?define:function(t){"object"==typeof exports?module.exports=t():this.when=t()}),define("Core/formatError",["./defined"],function(t){"use strict";function e(e){var n,r=e.name,i=e.message;n=t(r)&&t(i)?r+": "+i:e.toString();var o=e.stack;return t(o)&&(n+="\n"+o),n}return e}),define("Workers/createTaskProcessorWorker",["../ThirdParty/when","../Core/defaultValue","../Core/defined","../Core/formatError"],function(t,e,n,r){"use strict";function i(e,n,r){try{return e(n,r)}catch(e){return t.reject(e)}}function o(o){var a;return function(u){var s=u.data,c=[],h={id:s.id,result:void 0,error:void 0};return t(i(o,s.parameters,c)).then(function(t){h.result=t}).otherwise(function(t){t instanceof Error?h.error={name:t.name,message:t.message,stack:t.stack}:h.error=t}).always(function(){n(a)||(a=e(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(c.length=0);try{a(h,c)}catch(t){h.result=void 0,h.error="postMessage failed with error: "+r(t)+"\n with responseMessage: "+JSON.stringify(h),a(h)}})}}return o}),define("Workers/createVectorTilePoints",["../Core/AttributeCompression","../Core/Cartesian3","../Core/Cartographic","../Core/Ellipsoid","../Core/Math","../Core/Rectangle","./createTaskProcessorWorker"],function(t,e,n,r,i,o,a){"use strict";function u(t){t=new Float64Array(t);var e=0;m.min=t[e++],m.max=t[e++],o.unpack(t,e,l),e+=o.packedLength,r.unpack(t,e,d)}function s(r,o){var a=new Uint16Array(r.positions);u(r.packedBuffer);var s=l,p=d,y=m.min,g=m.max,v=a.length/3,w=a.subarray(0,v),x=a.subarray(v,2*v),M=a.subarray(2*v,3*v);t.zigZagDeltaDecode(w,x,M);for(var _=new Float64Array(a.length),E=0;E<v;++E){var O=w[E],S=x[E],P=M[E],R=i.lerp(s.west,s.east,O/c),T=i.lerp(s.south,s.north,S/c),I=i.lerp(y,g,P/c),b=n.fromRadians(R,T,I,h),A=p.cartographicToCartesian(b,f);e.pack(A,_,3*E)}return o.push(_.buffer),{positions:_.buffer}}var c=32767,h=new n,f=new e,l=new o,d=new r,m={min:void 0,max:void 0};return a(s)})}();
|