63 lines
163 KiB
Vue
63 lines
163 KiB
Vue
|
/**
|
||
|
* 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.
|
||
|
*/
|
||
|
|
||
|
!function(){define("Core/defined",[],function(){"use strict";function e(e){return void 0!==e&&null!==e}return e}),define("Core/DeveloperError",["./defined"],function(e){"use strict";function t(e){this.name="DeveloperError",this.message=e;var t;try{throw new Error}catch(r){t=r.stack}this.stack=t}return e(Object.create)&&(t.prototype=Object.create(Error.prototype),t.prototype.constructor=t),t.prototype.toString=function(){var t=this.name+": "+this.message;return e(this.stack)&&(t+="\n"+this.stack.toString()),t},t.throwInstantiationError=function(){throw new t("This function defines an interface and should not be called directly.")},t}),define("Core/Check",["./defined","./DeveloperError"],function(e,t){"use strict";function r(e){return e+" is required, actual value was undefined"}function n(e,t,r){return"Expected "+r+" to be typeof "+t+", actual typeof was "+e}var i={};return i.typeOf={},i.defined=function(n,i){if(!e(i))throw new t(r(n))},i.typeOf.func=function(e,r){if("function"!=typeof r)throw new t(n(typeof r,"function",e))},i.typeOf.string=function(e,r){if("string"!=typeof r)throw new t(n(typeof r,"string",e))},i.typeOf.number=function(e,r){if("number"!=typeof r)throw new t(n(typeof r,"number",e))},i.typeOf.number.lessThan=function(e,r,n){if(i.typeOf.number(e,r),r>=n)throw new t("Expected "+e+" to be less than "+n+", actual value was "+r)},i.typeOf.number.lessThanOrEquals=function(e,r,n){if(i.typeOf.number(e,r),r>n)throw new t("Expected "+e+" to be less than or equal to "+n+", actual value was "+r)},i.typeOf.number.greaterThan=function(e,r,n){if(i.typeOf.number(e,r),n>=r)throw new t("Expected "+e+" to be greater than "+n+", actual value was "+r)},i.typeOf.number.greaterThanOrEquals=function(e,r,n){if(i.typeOf.number(e,r),n>r)throw new t("Expected "+e+" to be greater than or equal to"+n+", actual value was "+r)},i.typeOf.object=function(e,r){if("object"!=typeof r)throw new t(n(typeof r,"object",e))},i.typeOf.bool=function(e,r){if("boolean"!=typeof r)throw new t(n(typeof r,"boolean",e))},i.typeOf.number.equals=function(e,r,n,a){if(i.typeOf.number(e,n),i.typeOf.number(r,a),n!==a)throw new t(e+" must be equal to "+r+", the actual values are "+n+" and "+a)},i}),define("Core/freezeObject",["./defined"],function(e){"use strict";var t=Object.freeze;return e(t)||(t=function(e){return e}),t}),define("Core/defaultValue",["./freezeObject"],function(e){"use strict";function t(e,t){return void 0!==e&&null!==e?e:t}return t.EMPTY_OBJECT=e({}),t}),define("ThirdParty/mersenne-twister",[],function(){var e=function(e){void 0==e&&(e=(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(e)};return e.prototype.init_genrand=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},e.prototype.genrand_int32=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_genrand(5489),r=0;r<this.N-this.M;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+this.M]^e>>>1^t[1&e];for(;r<this.N-1;r++)e=this.mt[r]&this.UPPER_MASK|this.mt[r+1]&this.LOWER_MASK,this.mt[r]=this.mt[r+(this.M-this.N)]^e>>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0},e.prototype.random=function(){return this.genrand_int32()*(1/4294967296)},e}),define("Core/Math",["../ThirdParty/mersenne-twister","./defaultValue","./defined","./DeveloperError"],function(e,t,r,n){"use strict";var i={};i.Radious=6378137,i.EPSILON1=.1,i.EPSILON2=.01,i.EPSILON3=.001,i.EPSILON4=1e-4,i.EPSILON5=1e-5,i.EPSILON6=1e-6,i.EPSILON7=1e-7,i.EPSILON8=1e-8,i.EPSILON9=1e-9,i.EPSILON10=1e-10,i.EPSILON11=1e-11,i.EPSILON12=1e-12,i.EPSILON13=1e-13,i.EPSILON14
|
||
|
t.typeOf.object("result",n);var i=r.x,a=r.y,o=r.z,u=e[0]*i+e[3]*a+e[6]*o,s=e[1]*i+e[4]*a+e[7]*o,c=e[2]*i+e[5]*a+e[8]*o;return n.x=u,n.y=s,n.z=c,n},s.multiplyByScalar=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.number("scalar",r),t.typeOf.object("result",n),n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*r,n},s.multiplyByScale=function(e,r,n){return t.typeOf.object("matrix",e),t.typeOf.object("scale",r),t.typeOf.object("result",n),n[0]=e[0]*r.x,n[1]=e[1]*r.x,n[2]=e[2]*r.x,n[3]=e[3]*r.y,n[4]=e[4]*r.y,n[5]=e[5]*r.y,n[6]=e[6]*r.z,n[7]=e[7]*r.z,n[8]=e[8]*r.z,n},s.negate=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r},s.transpose=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],i=e[3],a=e[6],o=e[1],u=e[4],s=e[7],c=e[2],f=e[5],l=e[8];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=u,r[5]=s,r[6]=c,r[7]=f,r[8]=l,r};var h=[1,0,0],y=[2,2,1],E=new s,m=new s;return s.computeEigenDecomposition=function(e,r){t.typeOf.object("matrix",e);var i=u.EPSILON20,a=10,o=0,p=0;n(r)||(r={});for(var d=r.unitary=s.clone(s.IDENTITY,r.unitary),h=r.diagonal=s.clone(e,r.diagonal),y=i*c(h);a>p&&f(h)>y;)l(h,E),s.transpose(E,m),s.multiply(h,E,h),s.multiply(m,h,h),s.multiply(d,E,d),++o>2&&(++p,o=0);return r},s.abs=function(e,r){return t.typeOf.object("matrix",e),t.typeOf.object("result",r),r[0]=Math.abs(e[0]),r[1]=Math.abs(e[1]),r[2]=Math.abs(e[2]),r[3]=Math.abs(e[3]),r[4]=Math.abs(e[4]),r[5]=Math.abs(e[5]),r[6]=Math.abs(e[6]),r[7]=Math.abs(e[7]),r[8]=Math.abs(e[8]),r},s.determinant=function(e){t.typeOf.object("matrix",e);var r=e[0],n=e[3],i=e[6],a=e[1],o=e[4],u=e[7],s=e[2],c=e[5],f=e[8];return r*(o*f-c*u)+a*(c*i-n*f)+s*(n*u-o*i)},s.inverse=function(e,r){t.typeOf.object("matrix",e),t.typeOf.object("result",r);var n=e[0],i=e[1],o=e[2],c=e[3],f=e[4],l=e[5],p=e[6],d=e[7],h=e[8],y=s.determinant(e);if(Math.abs(y)<=u.EPSILON15)throw new a("matrix is not invertible");r[0]=f*h-d*l,r[1]=d*o-i*h,r[2]=i*l-f*o,r[3]=p*l-c*h,r[4]=n*h-p*o,r[5]=c*o-n*l,r[6]=c*d-p*f,r[7]=p*i-n*d,r[8]=n*f-c*i;var E=1/y;return s.multiplyByScalar(r,E,r)},s.equals=function(e,t){return e===t||n(e)&&n(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},s.equalsEpsilon=function(e,r,i){return t.typeOf.number("epsilon",i),e===r||n(e)&&n(r)&&Math.abs(e[0]-r[0])<=i&&Math.abs(e[1]-r[1])<=i&&Math.abs(e[2]-r[2])<=i&&Math.abs(e[3]-r[3])<=i&&Math.abs(e[4]-r[4])<=i&&Math.abs(e[5]-r[5])<=i&&Math.abs(e[6]-r[6])<=i&&Math.abs(e[7]-r[7])<=i&&Math.abs(e[8]-r[8])<=i},s.IDENTITY=o(new s(1,0,0,0,1,0,0,0,1)),s.ZERO=o(new s(0,0,0,0,0,0,0,0,0)),s.COLUMN0ROW0=0,s.COLUMN0ROW1=1,s.COLUMN0ROW2=2,s.COLUMN1ROW0=3,s.COLUMN1ROW1=4,s.COLUMN1ROW2=5,s.COLUMN2ROW0=6,s.COLUMN2ROW1=7,s.COLUMN2ROW2=8,i(s.prototype,{length:{get:function(){return s.packedLength}}}),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.equalsArray=function(e,t,r){return e[0]===t[r]&&e[1]===t[r+1]&&e[2]===t[r+2]&&e[3]===t[r+3]&&e[4]===t[r+4]&&e[5]===t[r+5]&&e[6]===t[r+6]&&e[7]===t[r+7]&&e[8]===t[r+8]},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return"("+this[0]+", "+this[3]+", "+this[6]+")\n("+this[1]+", "+this[4]+", "+this[7]+")\n("+this[2]+", "+this[5]+", "+this[8]+")"},s}),define("Core/Cartesian4",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a){"use strict";function o(e,r,n,i){this.x=t(e,0),this.y=t(r,0),this.z=t(n,0),this.w=t(i,0)}o.fromElements=function(e,t,n,i,a){return r(a)?(a.x=e,a.y=t,a.z=n,a.w=i,a):new o(e,t,n,i)},o.fromColor=function(t,n){return e.typeOf.object("color",t),r(n)?(n.x=t.red,n.y=t.green,n.z=t.blue,n.w=t.alpha,n):new o(t.red,t.green,t.blue,t.alpha)},o.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new o(e.x,e.y,e.z,e.w):void 0},o.packe
|
||
|
},s.intersection=function(e,r,i){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var a=e.east,o=e.west,c=r.east,f=r.west;o>a&&c>0?a+=u.TWO_PI:f>c&&a>0&&(c+=u.TWO_PI),o>a&&0>f?f+=u.TWO_PI:f>c&&0>o&&(o+=u.TWO_PI);var l=u.negativePiToPi(Math.max(o,f)),p=u.negativePiToPi(Math.min(a,c));if(!((e.west<e.east||r.west<r.east)&&l>=p)){var d=Math.max(e.south,r.south),h=Math.min(e.north,r.north);if(!(d>=h))return n(i)?(i.west=l,i.south=d,i.east=p,i.north=h,i):new s(l,d,p,h)}},s.simpleIntersection=function(e,r,i){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r);var a=Math.max(e.west,r.west),o=Math.max(e.south,r.south),u=Math.min(e.east,r.east),c=Math.min(e.north,r.north);return o>=c||a>=u?void 0:n(i)?(i.west=a,i.south=o,i.east=u,i.north=c,i):new s(a,o,u,c)},s.union=function(e,r,i){t.typeOf.object("rectangle",e),t.typeOf.object("otherRectangle",r),n(i)||(i=new s);var a=e.east,o=e.west,c=r.east,f=r.west;o>a&&c>0?a+=u.TWO_PI:f>c&&a>0&&(c+=u.TWO_PI),o>a&&0>f?f+=u.TWO_PI:f>c&&0>o&&(o+=u.TWO_PI);var l=u.convertLongitudeRange(Math.min(o,f)),p=u.convertLongitudeRange(Math.max(a,c));return i.west=l,i.south=Math.min(e.south,r.south),i.east=p,i.north=Math.max(e.north,r.north),i},s.expand=function(e,r,i){return t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r),n(i)||(i=new s),i.west=Math.min(e.west,r.longitude),i.south=Math.min(e.south,r.latitude),i.east=Math.max(e.east,r.longitude),i.north=Math.max(e.north,r.latitude),i},s.contains=function(e,r){t.typeOf.object("rectangle",e),t.typeOf.object("cartographic",r);var n=r.longitude,i=r.latitude,a=e.west,o=e.east;return a>o&&(o+=u.TWO_PI,0>n&&(n+=u.TWO_PI)),(n>a||u.equalsEpsilon(n,a,u.EPSILON14))&&(o>n||u.equalsEpsilon(n,o,u.EPSILON14))&&i>=e.south&&i<=e.north};var c=new e;return s.subsample=function(e,i,o,f){t.typeOf.object("rectangle",e),i=r(i,a.WGS84),o=r(o,0),n(f)||(f=[]);var l=0,p=e.north,d=e.south,h=e.east,y=e.west,E=c;E.height=o,E.longitude=y,E.latitude=p,f[l]=i.cartographicToCartesian(E,f[l]),l++,E.longitude=h,f[l]=i.cartographicToCartesian(E,f[l]),l++,E.latitude=d,f[l]=i.cartographicToCartesian(E,f[l]),l++,E.longitude=y,f[l]=i.cartographicToCartesian(E,f[l]),l++,0>p?E.latitude=p:d>0?E.latitude=d:E.latitude=0;for(var m=1;8>m;++m)E.longitude=-Math.PI+m*u.PI_OVER_TWO,s.contains(e,E)&&(f[l]=i.cartographicToCartesian(E,f[l]),l++);return 0===E.latitude&&(E.longitude=y,f[l]=i.cartographicToCartesian(E,f[l]),l++,E.longitude=h,f[l]=i.cartographicToCartesian(E,f[l]),l++),f.length=l,f},s.MAX_VALUE=o(new s(-Math.PI,-u.PI_OVER_TWO,Math.PI,u.PI_OVER_TWO)),s}),define("Core/BoundingSphere",["./Cartesian3","./Cartographic","./Check","./defaultValue","./defined","./Ellipsoid","./GeographicProjection","./Intersect","./Interval","./Matrix3","./Matrix4","./Rectangle"],function(e,t,r,n,i,a,o,u,s,c,f,l){"use strict";function p(t,r){this.center=e.clone(n(t,e.ZERO)),this.radius=n(r,0)}var d=new e,h=new e,y=new e,E=new e,m=new e,O=new e,T=new e,_=new e,R=new e,b=new e,v=new e,A=new e;p.fromPoints=function(t,r){if(i(r)||(r=new p),!i(t)||0===t.length)return r.center=e.clone(e.ZERO,r.center),r.radius=0,r;var n,a=e.clone(t[0],T),o=e.clone(a,d),u=e.clone(a,h),s=e.clone(a,y),c=e.clone(a,E),f=e.clone(a,m),l=e.clone(a,O),w=t.length;for(n=1;w>n;n++){e.clone(t[n],a);var g=a.x,N=a.y,S=a.z;g<o.x&&e.clone(a,o),g>c.x&&e.clone(a,c),N<u.y&&e.clone(a,u),N>f.y&&e.clone(a,f),S<s.z&&e.clone(a,s),S>l.z&&e.clone(a,l)}var I=e.magnitudeSquared(e.subtract(c,o,_)),M=e.magnitudeSquared(e.subtract(f,u,_)),x=e.magnitudeSquared(e.subtract(l,s,_)),C=o,P=c,L=I;M>L&&(L=M,C=u,P=f),x>L&&(L=x,C=s,P=l);var U=R;U.x=.5*(C.x+P.x),U.y=.5*(C.y+P.y),U.z=.5*(C.z+P.z);var D=e.magnitudeSquared(e.subtract(P,U,_)),F=Math.sqrt(D),B=b;B.x=o.x,B.y=u.y,B.z=s.z;var z=v;z.x=c.x,z.y=f.y,z.z=l.z;var q=e.multiplyByScalar(e.add(B,z,_),.5,A),j=0;for(n=0;w>n;n++){e.clone(t[n],a);var G=e.magnitude(e.subtract(a,q,_));G>j&&(j=G);var V=e.magnitudeSquared(e.subtract(a,U,_));if(V>D){var X=Math.sqrt(V);F=.5*(F+X),D=F*F;var W=X-F;U.x=(F*U.x+W*a.x)/X,U.y=(F*U.y+W*a.y)/X,U.z=(F*U.z+W*a.z)/X}}return j>F?(e.clone(U,r.center),r.radius=F
|
||
|
case o.UNSIGNED_INT:return new Uint32Array(n);case o.FLOAT:return new Float32Array(n);case o.DOUBLE:return new Float64Array(n);default:throw new r("componentDatatype is not a valid value.")}},o.createArrayBufferView=function(n,i,a,u){if(!t(n))throw new r("componentDatatype is required.");if(!t(i))throw new r("buffer is required.");switch(a=e(a,0),u=e(u,(i.byteLength-a)/o.getSizeInBytes(n)),n){case o.BYTE:return new Int8Array(i,a,u);case o.UNSIGNED_BYTE:return new Uint8Array(i,a,u);case o.SHORT:return new Int16Array(i,a,u);case o.UNSIGNED_SHORT:return new Uint16Array(i,a,u);case o.INT:return new Int32Array(i,a,u);case o.UNSIGNED_INT:return new Uint32Array(i,a,u);case o.FLOAT:return new Float32Array(i,a,u);case o.DOUBLE:return new Float64Array(i,a,u);default:throw new r("componentDatatype is not a valid value.")}},o.fromName=function(e){switch(e){case"BYTE":return o.BYTE;case"UNSIGNED_BYTE":return o.UNSIGNED_BYTE;case"SHORT":return o.SHORT;case"UNSIGNED_SHORT":return o.UNSIGNED_SHORT;case"INT":return o.INT;case"UNSIGNED_INT":return o.UNSIGNED_INT;case"FLOAT":return o.FLOAT;case"DOUBLE":return o.DOUBLE;default:throw new r("name is not a valid value.")}},i(o)}),define("Core/GeometryType",["./freezeObject"],function(e){"use strict";var t={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3};return e(t)}),define("Core/PrimitiveType",["./freezeObject","./WebGLConstants"],function(e,t){"use strict";var r={POINTS:t.POINTS,LINES:t.LINES,LINE_LOOP:t.LINE_LOOP,LINE_STRIP:t.LINE_STRIP,TRIANGLES:t.TRIANGLES,TRIANGLE_STRIP:t.TRIANGLE_STRIP,TRIANGLE_FAN:t.TRIANGLE_FAN,validate:function(e){return e===r.POINTS||e===r.LINES||e===r.LINE_LOOP||e===r.LINE_STRIP||e===r.TRIANGLES||e===r.TRIANGLE_STRIP||e===r.TRIANGLE_FAN}};return e(r)}),define("Core/Geometry",["./Check","./defaultValue","./defined","./DeveloperError","./GeometryType","./PrimitiveType"],function(e,t,r,n,i,a){"use strict";function o(r){r=t(r,t.EMPTY_OBJECT),e.typeOf.object("options.attributes",r.attributes),this.attributes=r.attributes,this.indices=r.indices,this.primitiveType=t(r.primitiveType,a.TRIANGLES),this.boundingSphere=r.boundingSphere,this.geometryType=t(r.geometryType,i.NONE),this.boundingSphereCV=r.boundingSphereCV}return o.computeNumberOfVertices=function(t){e.typeOf.object("geometry",t);var i=-1;for(var a in t.attributes)if(t.attributes.hasOwnProperty(a)&&r(t.attributes[a])&&r(t.attributes[a].values)){var o=t.attributes[a],u=o.values.length/o.componentsPerAttribute;if(i!==u&&-1!==i)throw new n("All attribute lists must have the same number of attributes.");i=u}return i},o}),define("Core/GeometryAttribute",["./defaultValue","./defined","./DeveloperError"],function(e,t,r){"use strict";function n(n){if(n=e(n,e.EMPTY_OBJECT),!t(n.componentDatatype))throw new r("options.componentDatatype is required.");if(!t(n.componentsPerAttribute))throw new r("options.componentsPerAttribute is required.");if(n.componentsPerAttribute<1||n.componentsPerAttribute>4)throw new r("options.componentsPerAttribute must be between 1 and 4.");if(!t(n.values))throw new r("options.values is required.");this.componentDatatype=n.componentDatatype,this.componentsPerAttribute=n.componentsPerAttribute,this.normalize=e(n.normalize,!1),this.values=n.values}return n}),define("Core/GeometryAttributes",["./defaultValue"],function(e){"use strict";function t(t){t=e(t,e.EMPTY_OBJECT),this.position=t.position,this.normal=t.normal,this.st=t.st,this.bitangent=t.bitangent,this.tangent=t.tangent,this.color=t.color}return t}),define("Core/Cartesian2",["./Check","./defaultValue","./defined","./DeveloperError","./freezeObject","./Math"],function(e,t,r,n,i,a){"use strict";function o(e,r){this.x=t(e,0),this.y=t(r,0)}o.fromElements=function(e,t,n){return r(n)?(n.x=e,n.y=t,n):new o(e,t)},o.clone=function(e,t){return r(e)?r(t)?(t.x=e.x,t.y=e.y,t):new o(e.x,e.y):void 0},o.fromCartesian3=o.clone,o.fromCartesian4=o.clone,o.packedLength=2,o.pack=function(r,n,i){return e.typeOf.object("value",r),e.defined("array",n),i=t(i,0),n[i++]=r.x,n[i]=r.y,n},o.unpack=function(n,i,a){return e.defined("array",n),i=t(i,0),r(a)||(a=new o),a.x=n[i++],a.y=n
|
||
|
return n}return new Uint16Array}function I(e){var t={};for(var r in e)if(e.hasOwnProperty(r)&&c(e[r])&&c(e[r].values)){var n=e[r];t[r]=new h({componentDatatype:n.componentDatatype,componentsPerAttribute:n.componentsPerAttribute,normalize:n.normalize,values:[]})}return t}function M(e,t,r){for(var n in t)if(t.hasOwnProperty(n)&&c(t[n])&&c(t[n].values))for(var i=t[n],a=0;a<i.componentsPerAttribute;++a)e[n].values.push(i.values[r*i.componentsPerAttribute+a])}function x(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,ae),R.multiplyByPoint(e,ae,ae),i.pack(ae,r,a)}function C(e,t){if(c(t))for(var r=t.values,n=r.length,a=0;n>a;a+=3)i.unpack(r,a,ae),_.multiplyByVector(e,ae,ae),ae=i.normalize(ae,ae),i.pack(ae,r,a)}function P(e,t){var r,n=e.length,i={},a=e[0][t].attributes;for(r in a)if(a.hasOwnProperty(r)&&c(a[r])&&c(a[r].values)){for(var o=a[r],s=o.values.length,f=!0,l=1;n>l;++l){var p=e[l][t].attributes[r];if(!c(p)||o.componentDatatype!==p.componentDatatype||o.componentsPerAttribute!==p.componentsPerAttribute||o.normalize!==p.normalize){f=!1;break}s+=p.values.length}f&&(i[r]=new h({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:u.createTypedArray(o.componentDatatype,s)}))}return i}function L(e,t){var n,a,o,u,s=e.length,l=e[0].modelMatrix,p=c(e[0][t].indices),h=e[0][t].primitiveType;for(a=1;s>a;++a){if(!R.equals(e[a].modelMatrix,l))throw new f("All instances must have the same modelMatrix.");if(c(e[a][t].indices)!==p)throw new f("All instance geometries must have an indices or not have one.");if(e[a][t].primitiveType!==h)throw new f("All instance geometries must have the same primitiveType.")}var y,m,O,T=P(e,t);for(n in T)if(T.hasOwnProperty(n))for(y=T[n].values,u=0,a=0;s>a;++a)for(m=e[a][t].attributes[n].values,O=m.length,o=0;O>o;++o)y[u++]=m[o];var _;if(p){var b=0;for(a=0;s>a;++a)b+=e[a][t].indices.length;var A=d.computeNumberOfVertices(new d({attributes:T,primitiveType:v.POINTS})),w=E.createTypedArray(A,b),g=0,N=0;for(a=0;s>a;++a){var S=e[a][t].indices,I=S.length;for(u=0;I>u;++u)w[g++]=N+S[u];N+=d.computeNumberOfVertices(e[a][t])}_=w}var M,x=new i,C=0;for(a=0;s>a;++a){if(M=e[a][t].boundingSphere,!c(M)){x=void 0;break}i.add(M.center,x,x)}if(c(x))for(i.divideByScalar(x,s,x),a=0;s>a;++a){M=e[a][t].boundingSphere;var L=i.magnitude(i.subtract(M.center,x,se))+M.radius;L>C&&(C=L)}return new d({attributes:T,indices:_,primitiveType:h,boundingSphere:c(x)?new r(x,C):void 0})}function U(e){if(c(e.indices))return e;var t=d.computeNumberOfVertices(e);if(3>t)throw new f("The number of vertices must be at least three.");if(t%3!==0)throw new f("The number of vertices must be a multiple of three.");for(var r=E.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function D(e){var t=d.computeNumberOfVertices(e);if(3>t)throw new f("The number of vertices must be at least three.");var r=E.createTypedArray(t,3*(t-2));r[0]=1,r[1]=0,r[2]=2;for(var n=3,i=3;t>i;++i)r[n++]=i-1,r[n++]=0,r[n++]=i;return e.indices=r,e.primitiveType=v.TRIANGLES,e}function F(e){var t=d.computeNumberOfVertices(e);if(3>t)throw new f("The number of vertices must be at least 3.");var r=E.createTypedArray(t,3*(t-2));r[0]=0,r[1]=1,r[2]=2,t>3&&(r[3]=0,r[4]=2,r[5]=3);for(var n=6,i=3;t-1>i;i+=2)r[n++]=i,r[n++]=i-1,r[n++]=i+1,t>i+2&&(r[n++]=i,r[n++]=i+1,r[n++]=i+2);return e.indices=r,e.primitiveType=v.TRIANGLES,e}function B(e){if(c(e.indices))return e;var t=d.computeNumberOfVertices(e);if(2>t)throw new f("The number of vertices must be at least two.");if(t%2!==0)throw new f("The number of vertices must be a multiple of 2.");for(var r=E.createTypedArray(t,t),n=0;t>n;++n)r[n]=n;return e.indices=r,e}function z(e){var t=d.computeNumberOfVertices(e);if(2>t)throw new f("The number of vertices must be at least two.");var r=E.createTypedArray(t,2*(t-1));r[0]=0,r[1]=1;for(var n=2,i=2;t>i;++i)r[n++]=i-1,r[n++]=i;return e.indices=r,e.primitiveType=v.LINES,e}function q(e){var t=d.computeNumberOfVertices(e);if(2>t)throw new f("The number of vertices must be at least two.");var r=E.createTypedArray(t,2
|
||
|
var i=new Float64Array(b(t)),a=[],o={},u=t.length,s=0;i[s++]=u;for(var c=0;u>c;c++){var f=t[c],l=r(f);if(i[s++]=l?1:0,l){i[s++]=f.primitiveType,i[s++]=f.geometryType;var p=r(f.boundingSphere)?1:0;i[s++]=p,p&&e.pack(f.boundingSphere,i,s),s+=e.packedLength;var d=r(f.boundingSphereCV)?1:0;i[s++]=d,d&&e.pack(f.boundingSphereCV,i,s),s+=e.packedLength;var h=f.attributes,y=[];for(var E in h)h.hasOwnProperty(E)&&r(h[E])&&(y.push(E),r(o[E])||(o[E]=a.length,a.push(E)));i[s++]=y.length;for(var m=0;m<y.length;m++){var O=y[m],T=h[O];i[s++]=o[O],i[s++]=T.componentDatatype,i[s++]=T.componentsPerAttribute,i[s++]=T.normalize?1:0,i[s++]=T.values.length,i.set(T.values,s),s+=T.values.length}var _=r(f.indices)?f.indices.length:0;i[s++]=_,_>0&&(i.set(f.indices,s),s+=_)}}return n.push(i.buffer),{stringTable:a,packedData:i}},N.unpackCreateGeometryResults=function(r){for(var n,i=r.stringTable,a=r.packedData,o=new Array(a[0]),f=0,p=1;p<a.length;){var d=1===a[p++];if(d){var h,y,E=a[p++],m=a[p++],O=1===a[p++];O&&(h=e.unpack(a,p)),p+=e.packedLength;var T=1===a[p++];T&&(y=e.unpack(a,p)),p+=e.packedLength;var _,R,b,v=new c,A=a[p++];for(n=0;A>n;n++){var w=i[a[p++]],g=a[p++];b=a[p++];var N=0!==a[p++];_=a[p++],R=t.createTypedArray(g,_);for(var S=0;_>S;S++)R[S]=a[p++];v[w]=new s({componentDatatype:g,componentsPerAttribute:b,normalize:N,values:R})}var I;if(_=a[p++],_>0){var M=R.length/b;for(I=l.createTypedArray(M,_),n=0;_>n;n++)I[n]=a[p++]}o[f++]=new u({primitiveType:E,geometryType:m,boundingSphere:h,boundingSphereCV:y,indices:I,attributes:v})}else o[f++]=void 0}return o},N.packCombineGeometryParameters=function(e,t){for(var r=e.createGeometryResults,n=r.length,i=0;n>i;i++)t.push(r[i].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:v(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof o,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}},N.unpackCombineGeometryParameters=function(e){for(var t=A(e.packedInstances),r=e.createGeometryResults,n=r.length,a=0,u=0;n>u;u++)for(var s=N.unpackCreateGeometryResults(r[u]),c=s.length,f=0;c>f;f++){var l=s[f],h=t[a];h.geometry=l,++a}var y=i.clone(e.ellipsoid),E=e.isGeographic?new o(y):new d(y);return{instances:t,ellipsoid:y,projection:E,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:p.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}},N.packCombineGeometryResults=function(e,t){r(e.geometries)&&R(e.geometries,t);var n=w(e.boundingSpheres),i=w(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,boundingSpheres:n,boundingSpheresCV:i}},N.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,boundingSpheres:g(e.boundingSpheres),boundingSpheresCV:g(e.boundingSpheresCV)}},N}),define("Core/formatError",["./defined"],function(e){"use strict";function t(t){var r,n=t.name,i=t.message;r=e(n)&&e(i)?n+": "+i:t.toString();var a=t.stack;return e(a)&&(r+="\n"+a),r}return t}),define("Workers/createTaskProcessorWorker",["../Core/defaultValue","../Core/defined","../Core/formatError"],function(e,t,r){"use strict";function n(n){var i,a=[],o={id:void 0,result:void 0,error:void 0};return function(u){var s=u.data;a.length=0,o.id=s.id,o.error=void 0,o.result=void 0;try{o.result=n(s.parameters,a)}catch(c){c instanceof Error?o.error={name:c.name,message:c.message,stack:c.stack}:o.error=c}t(i)||(i=e(self.webkitPostMessage,self.postMessage)),s.canTransferArrayBuffer||(a.length=0);try{i(o,a)}catch(c){o.result=void 0,o.error="postMessage failed with error: "+r(c)+"\n with responseMessage: "+JSON.stringify(o),i(o)}}}return n}),define("Workers/createGeometry",["../Cor
|