worldwind-react-globe
Version:
An interactive globe for React featuring maps, imagery and terrain plus 2D map projections using the WorldWindJS community supported Web WorldWind virtual globe SDK.
207 lines (183 loc) • 1.2 MB
JavaScript
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = require('react');
var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var mobx = require('mobx');
function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
if (!css || typeof document === 'undefined') { return; }
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var css = "/* add css styles here (optional) */\n\n.styles_test__32Qsm {\n display: inline-block;\n margin: 2em auto;\n border: 2px solid #000;\n font-size: 2em;\n}\n";
styleInject(css);
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var worldwind_min = createCommonjsModule(function (module, exports) {
/**
* @license almond 0.3.0 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
/*
* Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the
* National Aeronautics and Space Administration. All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is 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.
*/
/*
* Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the
* National Aeronautics and Space Administration. All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is 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.
*
* NOTICE: This file was modified from the original NASAWorldWind/WebWorldWind distribution.
* NOTICE: This file contains changes made by Bruce Schubert (bruce@emxsys.com)
*/
/*
* @license
* Copyright 2000, Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2014, Google Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice including the dates of first publication and
* either this permission notice or a reference to http://oss.sgi.com/projects/FreeB/
* shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Original Code. The Original Code is: OpenGL Sample Implementation,
* Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
*/
/*
* Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the
* National Aeronautics and Space Administration. All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is 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.
*
* NOTICE: This file was modified from the original NASAWorldWind/WebWorldWind distribution.
* NOTICE: This file contains changes made by Kyle Kauffman (Github: @kyonifer)
* NOTICE: This file contains changes made by Bruce Schubert (bruce@emxsys.com)
*
*/
/*
* Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the
* National Aeronautics and Space Administration. All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is 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.
*
* NOTICE: This file was modified from the original NASAWorldWind/WebWorldWind distribution.
* NOTICE: This file contains changes made by Bruce Schubert <bruce@emxsys.com>.
*/
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
* @version 3.0.2
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
/*
* Copyright 2003-2006, 2009, 2017, United States Government, as represented by the Administrator of the
* National Aeronautics and Space Administration. All rights reserved.
*
* The NASAWorldWind/WebWorldWind platform is 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.
*/
/*
* Copyright (c) 2016, 2018 Bruce Schubert.
* The MIT License
* http://www.opensource.org/licenses/mit-license
*/
!function(t,e){module.exports=e();}(commonjsGlobal,function(){var t,e,i;!function(r){function n(t,e){return _.call(t,e)}function o(t,e){var i,r,n,o,s,a,l,h,u,c,d,p=e&&e.split("/"),f=E.map,g=f&&f["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1), t=t.split("/"), s=t.length-1, E.nodeIdCompat&&w.test(t[s])&&(t[s]=t[s].replace(w,"")), t=p.concat(t), u=0;u<t.length;u+=1)if(d=t[u], "."===d)t.splice(u,1), u-=1;else if(".."===d){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2), u-=2);}t=t.join("/");}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||g)&&f){for(i=t.split("/"), u=i.length;u>0;u-=1){if(r=i.slice(0,u).join("/"), p)for(c=p.length;c>0;c-=1)if(n=f[p.slice(0,c).join("/")], n&&(n=n[r])){o=n, a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r], h=u);}!o&&l&&(o=l, a=h), o&&(i.splice(0,a,o), t=i.join("/"));}return t}function s(t,e){return function(){var i=b.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null), p.apply(r,i.concat([t,e]))}}function a(t){return function(e){return o(e,t)}}function l(t){return function(e){m[t]=e;}}function h(t){if(n(y,t)){var e=y[t];delete y[t], v[t]=!0, d.apply(r,e);}if(!n(m,t)&&!n(v,t))throw new Error("No "+t);return m[t]}function u(t){var e,i=t?t.indexOf("!"):-1;return i>-1&&(e=t.substring(0,i), t=t.substring(i+1,t.length)), [e,t]}function c(t){return function(){return E&&E.config&&E.config[t]||{}}}var d,p,f,g,m={},y={},E={},v={},_=Object.prototype.hasOwnProperty,b=[].slice,w=/\.js$/;f=function(t,e){var i,r=u(t),n=r[0];return t=r[1], n&&(n=o(n,e), i=h(n)), n?t=i&&i.normalize?i.normalize(t,a(e)):o(t,e):(t=o(t,e), r=u(t), n=r[0], t=r[1], n&&(i=h(n))), {f:n?n+"!"+t:t,n:t,pr:n,p:i}}, g={require:function(t){return s(t)},exports:function(t){var e=m[t];return"undefined"!=typeof e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:c(t)}}}, d=function(t,e,i,o){var a,u,c,d,p,E,_=[],b=typeof i;if(o=o||t, "undefined"===b||"function"===b){for(e=!e.length&&i.length?["require","exports","module"]:e, p=0;p<e.length;p+=1)if(d=f(e[p],o), u=d.f, "require"===u)_[p]=g.require(t);else if("exports"===u)_[p]=g.exports(t), E=!0;else if("module"===u)a=_[p]=g.module(t);else if(n(m,u)||n(y,u)||n(v,u))_[p]=h(u);else{if(!d.p)throw new Error(t+" missing "+u);d.p.load(d.n,s(o,!0),l(u),{}), _[p]=m[u];}c=i?i.apply(m[t],_):void 0, t&&(a&&a.exports!==r&&a.exports!==m[t]?m[t]=a.exports:c===r&&E||(m[t]=c));}else t&&(m[t]=i);}, t=e=p=function(t,e,i,n,o){if("string"==typeof t)return g[t]?g[t](e):h(f(t,e).f);if(!t.splice){if(E=t, E.deps&&p(E.deps,E.callback), !e)return;e.splice?(t=e, e=i, i=null):t=r;}return e=e||function(){}, "function"==typeof i&&(i=n, n=o), n?d(r,t,e,i):setTimeout(function(){d(r,t,e,i);},4), p}, p.config=function(t){return p(t)}, t._defined=m, i=function(t,e,i){e.splice||(i=e, e=[]), n(m,t)||n(y,t)||(y[t]=[t,e,i]);}, i.amd={jQuery:!0};}(), i("../tools/almond",function(){}), i("formats/aaigrid/AAIGridConstants",[],function(){var t={N_COLS:"ncols",N_ROWS:"nrows",X_LL_CORNER:"xllcorner",Y_LL_CORNER:"yllcorner",CELL_SIZE:"cellsize",NO_DATA_VALUE:"NODATA_value"};return t}), i("formats/aaigrid/AAIGridMetadata",[],function(){var t=function(){this._ncols=null, this._nrows=null, this._xllcorner=null, this._yllcorner=null, this._cellsize=null, this._NODATA_value=void 0;};return Object.defineProperties(t.prototype,{ncols:{get:function(){return this._ncols},set:function(t){this._ncols=t;}},nrows:{get:function(){return this._nrows},set:function(t){this._nrows=t;}},xllcorner:{get:function(){return this._xllcorner},set:function(t){this._xllcorner=t;}},yllcorner:{get:function(){return this._yllcorner},set:function(t){this._yllcorner=t;}},cellsize:{get:function(){return this._cellsize},set:function(t){this._cellsize=t;}},NODATA_value:{get:function(){return this._NODATA_value},set:function(t){this._NODATA_value=t;}}}), t}), i("error/AbstractError",[],function(){var t=function(t,e){this.name=t, this.message=e;};return t.prototype.toString=function(){var t=this.name+": "+this.message;return this.stack&&(t+="\n"+this.stack.toString()), t}, t}), i("error/ArgumentError",["../error/AbstractError"],function(t){var e=function(e){t.call(this,"ArgumentError",e);var i;try{throw new Error}catch(t){i=t.stack;}this.stack=i;};return e.prototype=Object.create(t.prototype), e}), i("util/Logger",[],function(){var t={LEVEL_NONE:0,LEVEL_SEVERE:1,LEVEL_WARNING:2,LEVEL_INFO:3,setLoggingLevel:function(t){e=t;},getLoggingLevel:function(){return e},log:function(i,r){r&&i>0&&i<=e&&(i===t.LEVEL_SEVERE?console.error(r):i===t.LEVEL_WARNING?console.warn(r):i===t.LEVEL_INFO?console.info(r):console.log(r));},makeMessage:function(t,e,i){var r=this.messageTable[i]?this.messageTable[i]:i;return t+"."+e+": "+r},logMessage:function(t,e,i,r){var n=this.makeMessage(e,i,r);return this.log(t,n), n},messageTable:{abstractInvocation:"The function called is abstract and must be overridden in a subclass.",indexOutOfRange:"The specified index is out of range.",invalidColumn:"The specified column is out of range.",invalidHeight:"The specified height is zero or negative.",invalidWidth:"The specified width is zero or negative.",invalidRow:"The specified row is out of range.",invalidSize:"The specified size is zero or negative.",missingAltitudeMode:"The specified altitude mode is null or undefined.",missingArrayBuffer:"The specified array buffer is null or undefined",missingAttributeName:"The specified DBase attribute file name is null or undefined.",missingArray:"The specified array is null, undefined or of insufficient length.",missingBoundaries:"The specified boundaries array is null or undefined.",missingBuffer:"The specified buffer descriptor is null or undefined.",missingColor:"The specified color is null or undefined.",missingConfig:"The specified config is null or undefined.",missingDc:"The specified draw context is null or undefined.",missingDomElement:"The specified DOM element is null or undefined.",missingEntry:"The specified entry is null or undefined.",missingFont:"The specified font is null or undefined.",missingFrustum:"The specified frustum is null or undefined.",missingFunction:"The specified function is null or undefined.",missingGlContext:"The specified WebGL rendering context is null or undefined.",missingGlobe:"The specified globe is null or undefined.",missingId:"The specified id is null or undefined.",missingImage:"The specified image is null or undefined.",missingImageFormat:"The specified image format is null or undefined.",missingIndices:"The specified indices array is null or undefined.",missingKey:"The specified key is null or undefined.",missingLevel:"The specified level is null or undefined.",missingLine:"The specified line is null or undefined.",missingList:"The specified list is null or undefined.",missingListener:"The specified listener is null or undefined",missingLocation:"The specified location is null or undefined.",missingMatrix:"The specified matrix is null or undefined.",missingOffset:"The specified offset is null or undefined.",missingPath:"The specified path is null or undefined.",missingPlacename:"The specified place name is null or undefined.",missingPlane:"The specified plane is null or undefined.",missingPoint:"The specified point is null or undefined.",missingPoints:"The specified points array is null or undefined.",missingPosition:"The specified position is null or undefined.",missingPositions:"The specified positions array is null or undefined.",missingProgram:"The specified program is null or undefined.",missingProjection:"The specified projection is null or undefined.",missingRectangle:"The specified rectangle is null or undefined.",missingRenderable:"The specified renderable is null or undefined.",missingResolution:"The specified resolution is null, undefined, or zero.",missingResource:"The specified resource is null or undefined.",missingResult:"The specified result variable is null or undefined.",missingResults:"The specified results array is null or undefined.",missingSector:"The specified sector is null or undefined.",missingShapeType:"The specified shape type is null or undefined.",missingSize:"The specified size is null or undefined.",missingText:"The specified text is null or undefined.",missingTexture:"The specified texture is null or undefined.",missingTile:"The specified tile is null or undefined.",missingType:"The specified type is null or undefined.",missingUrl:"The specified URL is null or undefined",missingVector:"The specified vector is null or undefined.",missingVertex:"The specified vertex is null or undefined.",missingViewport:"The specified viewport is null or undefined.",missingWebCoverageService:"The specified WebCoverageService is null or undefined.",missingWorldWindow:"The specified WorldWindow is null or undefined.",notYetImplemented:"This function is not yet implemented",unsupportedVersion:"The specified version is not supported.",webglNotSupported:"The browser does not support WebGL, or WebGL is disabled."}},e=1;return t}), i("formats/aaigrid/AAIGridReader",["./AAIGridConstants","./AAIGridMetadata","../../error/ArgumentError","../../util/Logger"],function(t,e,i,r){var n=function(t){if(!t)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","missingDataSource"));if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","constructor","invalidDataSource"));this._values=null, this._metadata=new e;var n=this.decodeData(t);this.parse(n);};return Object.defineProperties(n.prototype,{metadata:{get:function(){return this._metadata}}}), n.prototype.getImageData=function(){return this._values}, n.prototype.decodeData=function(t){if("string"!=typeof t&&!(t instanceof ArrayBuffer))throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","decodeData","invalidDataSource"));if("string"==typeof t)return t;if("function"==typeof window.TextDecoder){var e=new TextDecoder("utf-8");return e.decode(t)}for(var n="",o=new Uint8Array(t),s=65535,a=0,l=o.length;a<l;a+=s)a+s>l&&(s=l-a), n+=String.fromCharCode.apply(null,o.subarray(a,a+s));return n}, n.prototype.parse=function(e){if("string"!=typeof e)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","parse","invalidDataString"));for(var n=e.replace(/\r?\n|\r/g,"\n").split("\n"),o=[],s=!0,a=0,l=n.length;a<l;a++){var h=n[a];if(h){var u=h.trim().split(" ").map(function(t){return t.trim()}).filter(function(t){return""!==t});if(u[0]===t.N_COLS)this.metadata.ncols=+u[1];else if(u[0]===t.N_ROWS)this.metadata.nrows=+u[1];else if(u[0]===t.X_LL_CORNER)this.metadata.xllcorner=+u[1];else if(u[0]===t.Y_LL_CORNER)this.metadata.yllcorner=+u[1];else if(u[0]===t.CELL_SIZE)this.metadata.cellsize=+u[1];else if(u[0]===t.NO_DATA_VALUE)this.metadata.NODATA_value=+u[1];else if(isFinite(+u[0])){var c=u.map(function(t){var e=+t;return Math.floor(e)!==e&&(s=!1), e});o=o.concat(c);}}}this._values=s?new Int16Array(o):new Float32Array(o);}, n.retrieveFromUrl=function(t,e){if(!t)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","retrieveFromUrl","missingUrl"));if(!e)throw new i(r.logMessage(r.LEVEL_SEVERE,"AAIGridReader","retrieveFromUrl","The specified callback is null or undefined."));var o=new XMLHttpRequest;o.onload=function(){this.status>=200&&this.status<300?e(new n(this.response),o):(r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed ("+o.statusText+"): "+t), e(null,o));}, o.onerror=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval failed: "+t), e(null,o);}, o.ontimeout=function(){r.log(r.LEVEL_WARNING,"AAIGrid retrieval timed out: "+t), e(null,o);}, o.open("GET",t,!0), o.responseType="arraybuffer", o.send(null);}, n}), i("geom/Angle",[],function(){var t={DEGREES_TO_RADIANS:Math.PI/180,RADIANS_TO_DEGREES:180/Math.PI,TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,normalizedDegrees:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedDegreesLatitude:function(t){var e=t%180;return e>90?180-e:e<-90?-180-e:e},normalizedDegreesLongitude:function(t){var e=t%360;return e>180?e-360:e<-180?360+e:e},normalizedRadians:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},normalizedRadiansLatitude:function(t){var e=t%Math.PI;return e>this.HALF_PI?Math.PI-e:e<-this.HALF_PI?-Math.PI-e:e},normalizedRadiansLongitude:function(t){var e=t%this.TWO_PI;return e>Math.PI?e-this.TWO_PI:e<-Math.PI?this.TWO_PI+e:e},isValidLatitude:function(t){return t>=-90&&t<=90},isValidLongitude:function(t){return t>=-180&&t<=180},toString:function(t){return t.toString()+"°"},toDecimalDegreesString:function(t){return t.toString()+"°"},toDMSString:function(t){var e,i,r,n,o;return e=t<0?-1:1, i=e*t, r=Math.floor(i), i=60*(i-r), n=Math.floor(i), i=60*(i-n), o=Math.round(i), 60==o&&(n++, o=0), 60==n&&(r++, n=0), (e==-1?"-":"")+r+"° "+n+"’ "+o+"”"},toDMString:function(t){var e,i,r,n,o,s;return e=t<0?-1:1, i=e*t, r=Math.floor(i), i=60*(i-r), n=Math.floor(i), i=60*(i-n), o=Math.round(i), 60==o&&(n++, o=0), 60==n&&(r++, n=0), s=0==o?n:n+o/60, (e==-1?"-":"")+r+"° "+s+"’"}};return t}), i("util/Color",["../util/Logger"],function(t){var e=function(t,e,i,r){this.red=t, this.green=e, this.blue=i, this.alpha=r;};return e.WHITE=new e(1,1,1,1), e.BLACK=new e(0,0,0,1), e.RED=new e(1,0,0,1), e.GREEN=new e(0,1,0,1), e.BLUE=new e(0,0,1,1), e.CYAN=new e(0,1,1,1), e.YELLOW=new e(1,1,0,1), e.MAGENTA=new e(1,0,1,1), e.LIGHT_GRAY=new e(.75,.75,.75,1), e.MEDIUM_GRAY=new e(.5,.5,.5,1), e.DARK_GRAY=new e(.25,.25,.25,1), e.TRANSPARENT=new e(0,0,0,0), e.prototype.set=function(t,e,i,r){return this.red=t, this.green=e, this.blue=i, this.alpha=r, this}, e.prototype.copy=function(e){if(!e)throw new ArgumentError(t.logMessage(t.LEVEL_SEVERE,"Color","copy","missingColor"));return this.red=e.red, this.green=e.green, this.blue=e.blue, this.alpha=e.alpha, this}, e.prototype.clone=function(){return new e(this.red,this.green,this.blue,this.alpha)}, e.prototype.premultipliedComponents=function(t){var e=this.alpha;return t[0]=this.red*e, t[1]=this.green*e, t[2]=this.blue*e, t[3]=e, t}, e.colorFromByteArray=function(t){return new e(t[0]/255,t[1]/255,t[2]/255,t[3]/255)}, e.colorFromBytes=function(t,i,r,n){return new e(t/255,i/255,r/255,n/255)}, e.colorFromHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(i,r,n,o)}, e.colorFromKmlHex=function(t){var i=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(t.substring(6,8),16);return e.colorFromBytes(o,n,r,i)}, e.prototype.nextColor=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return t<255?this.red=(t+1)/255:e<255?(this.red=0, this.green=(e+1)/255):i<255?(this.red=0, this.green=0, this.blue=(i+1)/255):(this.red=1/255, this.green=0, this.blue=0), this}, e.prototype.equals=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha),o=Math.round(255*t.red),s=Math.round(255*t.green),a=Math.round(255*t.blue),l=Math.round(255*t.alpha);return e===o&&i===s&&r===a&&n===l}, e.prototype.equalsBytes=function(t){var e=Math.round(255*this.red),i=Math.round(255*this.green),r=Math.round(255*this.blue),n=Math.round(255*this.alpha);return e===t[0]&&i===t[1]&&r===t[2]&&n===t[3]}, e.prototype.toByteString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue),r=Math.round(255*this.alpha);return"("+t+","+e+","+i+","+r+")"}, e.prototype.toHexString=function(t){var e=Math.ceil(255*this.red).toString(16),i=Math.ceil(255*this.green).toString(16),r=Math.ceil(255*this.blue).toString(16),n=Math.ceil(255*this.alpha).toString(16),o="#";return o+=e.length<2?"0"+e:e, o+=i.length<2?"0"+i:i, o+=r.length<2?"0"+r:r, t&&(o+=n.length<2?"0"+n:n), o}, e.prototype.toCssColorString=function(){var t=Math.round(255*this.red),e=Math.round(255*this.green),i=Math.round(255*this.blue);return"rgba("+t+", "+e+", "+i+", "+this.alpha+")"}, e}), i("util/Font",["../error/ArgumentError","../util/Color","../util/Logger"],function(t,e,i){var r=function(e,r,n,o,s,a){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","missingSize"));if(e<=0)throw new t(i.logMessage(i.LEVEL_SEVERE,"Font","constructor","invalidSize"));this._size=e, this.style=r||"normal", this.variant=n||"normal", this.weight=o||"normal", this.family=s||"sans-serif", this.horizontalAlignment=a||"center";};return Object.defineProperties(r.prototype,{size:{get:function(){return this._size},set:function(t){this._fontString=null, this._size=t;}},style:{get:function(){return this._style},set:function(t){this._fontString=null, this._style=t;}},variant:{get:function(){return this._variant},set:function(t){this._fontString=null, this._variant=t;}},weight:{get:function(){return this._weight},set:function(t){this._fontString=null, this._weight=t;}},family:{get:function(){return this._family},set:function(t){this._fontString=null, this._family=t;}},horizontalAlignment:{get:function(){return this._horizontalAlignment},set:function(t){this._toString=null, this._horizontalAlignment=t;}},fontString:{get:function(){return this._fontString||(this._fontString=this._style+" "+this.variant+" "+this._weight+" "+this._size.toString()+"px "+this._family), this._fontString}}}), r.prototype.toString=function(){return this._toString&&this._fontString||(this._toString=this.fontString+" "+this.horizontalAlignment), this._toString}, r}), i("util/Insets",["../error/ArgumentError","../util/Logger"],function(t,e){var i=function(i,r,n,o){if(4!==arguments.length)throw new t(e.logMessage(e.LEVEL_SEVERE,"Insets","constructor","invalidArgumentCount"));this._top=i, this._left=r, this._bottom=n, this._right=o;};return i.prototype.set=function(t,e,i,r){this._top=t, this._left=e, this._bottom=i, this._right=r;}, i.prototype.clone=function(){return new i(this._top,this._left,this._bottom,this._right)}, i.prototype.toString=function(){return this._top+" "+this._left+" "+this._bottom+" "+this._right}, Object.defineProperties(i.prototype,{top:{get:function(){return this._top},set:function(t){this._top=t;}},left:{get:function(){return this._left},set:function(t){this._left=t;}},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t;}},right:{get:function(){return this._right},set:function(t){this._right=t;}}}), i}), i("geom/Vec3",["../util/Logger","../error/ArgumentError"],function(t,e){var i=function(t,e,i){this[0]=t, this[1]=e, this[2]=i;};return i.prototype=new Float64Array(3), i.ZERO=new i(0,0,0), i.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","average","missingResult"));var n,o=i.length;r[0]=0, r[1]=0, r[2]=0;for(var s=0,a=i.length;s<a;s++)n=i[s], r[0]+=n[0]/o, r[1]+=n[1]/o, r[2]+=n[2]/o;return r}, i.averageOfBuffer=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","averageBuffer","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","averageBuffer","missingResult"));var n=i.length/3;r[0]=0, r[1]=0, r[2]=0;for(var o=0;o<n;o++)r[0]+=i[3*o]/n, r[1]+=i[3*o+1]/n, r[2]+=i[3*o+2]/n;return r}, i.areColinear=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=new i(r[0]-n[0],r[1]-n[1],r[2]-n[2]).normalize(),a=new i(o[0]-n[0],o[1]-n[1],o[2]-n[2]).normalize();return Math.abs(s.dot(a))>.999}, i.computeTriangleNormal=function(r,n,o){if(!r||!n||!o)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","areColinear","missingVector"));var s=(n[1]-r[1])*(o[2]-r[2])-(n[2]-r[2])*(o[1]-r[1]),a=(n[2]-r[2])*(o[0]-r[0])-(n[0]-r[0])*(o[2]-r[2]),l=(n[0]-r[0])*(o[1]-r[1])-(n[1]-r[1])*(o[0]-r[0]),h=s*s+a*a+l*l;return 0===h?new i(s,a,l):(h=Math.sqrt(h), new i(s/h,a/h,l/h))}, i.findThreeIndependentVertices=function(t,e){var r=e&&e>0?e:3;if(!t||t.length<3*r)return null;for(var n=new i(t[0],t[1],t[2]),o=null,s=null,a=r;a<t.length&&(o=new i(t[a],t[a+1],t[a+2]), o[0]===n[0]&&o[1]===n[1]&&o[2]===n[2]);a+=r)o=null;if(!o)return null;for(a+=r;a<t.length&&(s=new i(t[a],t[a+1],t[a+2]), s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]||s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]||i.areColinear(n,o,s));a+=r)s=null;return s?[n,o,s]:null}, i.computeBufferNormal=function(t,e){var r=i.findThreeIndependentVertices(t,e);return r?i.computeTriangleNormal(r[0],r[1],r[2]):null}, i.prototype.set=function(t,e,i){return this[0]=t, this[1]=e, this[2]=i, this}, i.prototype.copy=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","copy","missingVector"));return this[0]=i[0], this[1]=i[1], this[2]=i[2], this}, i.prototype.equals=function(t){return this[0]===t[0]&&this[1]===t[1]&&this[2]===t[2]}, i.prototype.add=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","add","missingVector"));return this[0]+=i[0], this[1]+=i[1], this[2]+=i[2], this}, i.prototype.subtract=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","subtract","missingVector"));return this[0]-=i[0], this[1]-=i[1], this[2]-=i[2], this}, i.prototype.multiply=function(t){return this[0]*=t, this[1]*=t, this[2]*=t, this}, i.prototype.divide=function(t){return this[0]/=t, this[1]/=t, this[2]/=t, this}, i.prototype.multiplyByMatrix=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","multiplyByMatrix","missingMatrix"));var r=i[0]*this[0]+i[1]*this[1]+i[2]*this[2]+i[3],n=i[4]*this[0]+i[5]*this[1]+i[6]*this[2]+i[7],o=i[8]*this[0]+i[9]*this[1]+i[10]*this[2]+i[11],s=i[12]*this[0]+i[13]*this[1]+i[14]*this[2]+i[15];return this[0]=r/s, this[1]=n/s, this[2]=o/s, this}, i.prototype.mix=function(i,r){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","mix","missingVector"));var n=1-r,o=r;return this[0]=this[0]*n+i[0]*o, this[1]=this[1]*n+i[1]*o, this[2]=this[2]*n+i[2]*o, this}, i.prototype.negate=function(){return this[0]=-this[0], this[1]=-this[1], this[2]=-this[2], this}, i.prototype.dot=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","dot","missingVector"));return this[0]*i[0]+this[1]*i[1]+this[2]*i[2]}, i.prototype.cross=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","cross","missingVector"));var r=this[1]*i[2]-this[2]*i[1],n=this[2]*i[0]-this[0]*i[2],o=this[0]*i[1]-this[1]*i[0];return this[0]=r, this[1]=n, this[2]=o, this}, i.prototype.magnitudeSquared=function(){return this.dot(this)}, i.prototype.magnitude=function(){return Math.sqrt(this.magnitudeSquared())}, i.prototype.normalize=function(){var t=this.magnitude(),e=1/t;return this[0]*=e, this[1]*=e, this[2]*=e, this}, i.prototype.distanceToSquared=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","distanceToSquared","missingVector"));var r=this[0]-i[0],n=this[1]-i[1],o=this[2]-i[2];return r*r+n*n+o*o}, i.prototype.distanceTo=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec3","distanceTo","missingVector"));return Math.sqrt(this.distanceToSquared(i))}, i.prototype.swap=function(t){var e=this[0];return this[0]=t[0], t[0]=e, e=this[1], this[1]=t[1], t[1]=e, e=this[2], this[2]=t[2], t[2]=e, this}, i.prototype.toString=function(){return"("+this[0]+", "+this[1]+", "+this[2]+")"}, i}), i("geom/Vec2",["../util/Logger","../error/ArgumentError","../geom/Vec3"],function(t,e,i){var r=function(t,e){this[0]=t, this[1]=e;};return r.prototype=new Float64Array(2), r.prototype.set=function(t,e){return this[0]=t, this[1]=e, this}, r.prototype.copy=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","copy","missingVector"));return this[0]=i[0], this[1]=i[1], this}, r.prototype.equals=function(t){return this[0]===t[0]&&this[1]===t[1]}, r.average=function(i,r){if(!i||i.length<1)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","average","missingArray"));if(!r)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","average","missingResult"));var n,o=i.length;r[0]=0, r[1]=0;for(var s=0,a=i.length;s<a;s++)n=i[s], r[0]+=n[0]/o, r[1]+=n[1]/o;return r}, r.prototype.add=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","add","missingVector"));return this[0]+=i[0], this[1]+=i[1], this}, r.prototype.subtract=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","subtract","missingVector"));return this[0]-=i[0], this[1]-=i[1], this}, r.prototype.multiply=function(t){return this[0]*=t, this[1]*=t, this}, r.prototype.divide=function(t){return this[0]/=t, this[1]/=t, this}, r.prototype.mix=function(i,r){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","mix","missingVector"));var n=1-r,o=r;return this[0]=this[0]*n+i[0]*o, this[1]=this[1]*n+i[1]*o, this}, r.prototype.negate=function(){return this[0]=-this[0], this[1]=-this[1], this}, r.prototype.dot=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","dot","missingVector"));return this[0]*i[0]+this[1]*i[1]}, r.prototype.magnitudeSquared=function(){return this.dot(this)}, r.prototype.magnitude=function(){return Math.sqrt(this.magnitudeSquared())}, r.prototype.normalize=function(){var t=this.magnitude(),e=1/t;return this[0]*=e, this[1]*=e, this}, r.prototype.distanceToSquared=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","distanceToSquared","missingVector"));var r=this[0]-i[0],n=this[1]-i[1];return r*r+n*n}, r.prototype.distanceTo=function(i){if(!i)throw new e(t.logMessage(t.LEVEL_SEVERE,"Vec2","distanceTo","missingVector"));return Math.sqrt(this.distanceToSquared(i))}, r.prototype.toVec3=function(){return new i(this[0],this[1],0)}, r.prototype.swap=function(t){var e=this[0];return this[0]=t[0], t[0]=e, e=this[1], this[1]=t[1], t[1]=e, this}, r.prototype.toString=function(){return"("+this[0]+", "+this[1]+")"}, r}), i("util/Offset",["../geom/Vec2"],function(t){var e=function(t,e,i,r){this.x=e, this.y=r, this.xUnits=t, this.yUnits=i;};return e.prototype.clone=function(){return new e(this.xUnits,this.x,this.yUnits,this.y)}, e.prototype.offsetForSize=function(e,i){var r,n;return r=this.xUnits===WorldWind.OFFSET_FRACTION?e*this.x:this.xUnits===WorldWind.OFFSET_INSET_PIXELS?e-this.x:this.x, n=this.yUnits===WorldWind.OFFSET_FRACTION?i*this.y:this.yUnits===WorldWind.OFFSET_INSET_PIXELS?i-this.y:this.y, new t(r,n)}, e.prototype.toString=function(){return this.xUnits+" "+this.x+" "+this.yUnits+" "+this.y}, e}), i("shapes/TextAttributes",["../util/Color","../util/Font","../util/Offset"],function(t,e,i){var r=function(r){this._color=r?r._color.clone():t.WHITE.clone(), this._font=r?r._font:new e(14), this._offset=r?r._offset:new i(WorldWind.OFFSET_FRACTION,.5,WorldWind.OFFSET_FRACTION,0), this._scale=r?r._scale:1, this._depthTest=!!r&&r._depthTest, this._enableOutline=!r||r._enableOutline, this._outlineWidth=r?r._outlineWidth:4, this._outlineColor=r?r._outlineColor:new t(0,0,0,.5), this.stateKeyInvalid=!0;};return r.prototype.computeStateKey=function(){return"c "+this._color.toHexString(!0)+" f "+this._font.toString()+" o "+this._offset.toString()+" s "+this._scale+" dt "+this._depthTest+" eo "+this._enableOutline+" ow "+this._outlineWidth+" oc "+this._outlineColor.toHexString(!0)}, Object.defineProperties(r.prototype,{stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(), this.stateKeyInvalid=!1), this._stateKey}},color:{get:function(){return this._color},set:function(t){this._color=t, this.stateKeyInvalid=!0;}},font:{get:function(){return this._font},set:function(t){this._font=t, this.stateKeyInvalid=!0;}},offset:{get:function(){return this._offset},set:function(t){this._offset=t, this.stateKeyInvalid=!0;}},scale:{get:function(){return this._scale},set:function(t){this._scale=t, this.stateKeyInvalid=!0;}},depthTest:{get:function(){return this._depthTest},set:function(t){this._depthTest=t, this.stateKeyInvalid=!0;}},enableOutline:{get:function(){return this._enableOutline},set:function(t){this._enableOutline=t, this.stateKeyInvalid=!0;}},outlineWidth:{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth=t, this.stateKeyInvalid=!0;}},outlineColor:{get:function(){return this._outlineColor},set:function(t){this._outlineColor=t, this.stateKeyInvalid=!0;}}}), r}), i("shapes/AnnotationAttributes",["../util/Color","../util/Font","../util/Insets","../shapes/TextAttributes"],function(t,e,i,r){var n=function(e){this._cornerRadius=e?e._cornerRadius:0, this._insets=e?e._insets:new i(0,0,0,0), this._backgroundColor=e?e._backgroundColor.clone():t.WHITE.clone(), this._leaderGapWidth=e?e._leaderGapWidth:40, this._leaderGapHeight=e?e._leaderGapHeight:30, this._opacity=e?e._opacity:1, this._scale=e?e._scale:1, this._drawLeader=!e||e._drawLeader, this._width=e?e._width:200, this._height=e?e._height:100, this._textAttributes=e?e._textAttributes:this.createDefaultTextAttributes(), this.stateKeyInvalid=!0;};return n.prototype.computeStateKey=function(){return"wi "+this._width+" he "+this._height+" cr "+this._cornerRadius+" in "+this._insets.toString()+" bg "+this.backgroundColor.toHexString(!0)+" dl "+this.drawLeader+" lgw "+this.leaderGapWidth+" lgh "+this.leaderGapHeight+" op "+this.opacity+" ta "+this._textAttributes.stateKey+" sc "+this.scale}, n.prototype.createDefaultTextAttributes=function(){var t=new r(null);return t.enableOutline=!1, t}, Object.defineProperties(n.prototype,{width:{get:function(){return this._width},set:function(t){this._width=t, this.stateKeyInvalid=!0;}},height:{get:function(){return this._height},set:function(t){this._height=t, this.stateKeyInvalid=!0;}},cornerRadius:{get:function(){return this._cornerRadius},set:function(t){this._cornerRadius=t, this.stateKeyInvalid=!0;}},insets:{get:function(){return this._insets},set:function(t){this._insets=t, this.stateKeyInvalid=!0;}},backgroundColor:{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t, this.stateKeyInvalid=!0;}},textAttributes:{get:function(){return this._textAttributes},set:function(t){this._textAttributes=t, this.stateKeyInvalid=!0;}},drawLeader:{get:function(){return this._drawLeader},set:function(t){this._drawLeader=t, this.stateKeyInvalid=!0;}},leaderGapWidth:{get:function(){return this._leaderGapWidth},set:function(t){this._leaderGapWidth=t, this.stateKeyInvalid=!0;}},leaderGapHeight:{get:function(){return this._leaderGapHeight},set:function(t){this._leaderGapHeight=t, this.stateKeyInvalid=!0;}},opacity:{get:function(){return this._opacity},set:function(t){this._opacity=t, this.stateKeyInvalid=!0;}},scale:{get:function(){return this._scale},set:function(t){this._scale=t, this.stateKeyInvalid=!0;}},stateKey:{get:function(){return this.stateKeyInvalid&&(this._stateKey=this.computeStateKey(), this.stateKeyInvalid=!1), this._stateKey}}}), n}), i("shaders/GpuShader",["../error/ArgumentError","../util/Logger"],function(t,e){var i=function(i,r,n){if(r!==i.VERTEX_SHADER&&r!==i.FRAGMENT_SHADER)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","The specified shader type is unrecognized."));if(!n)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","The specified shader source is null or undefined."));var o=i.createShader(r);if(!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","Unable to create shader of type "+(r==i.VERTEX_SHADER?"VERTEX_SHADER.":"FRAGMENT_SHADER.")));if(!this.compile(i,o,r,n)){var s=i.getShaderInfoLog(o);throw i.deleteShader(o), new t(e.logMessage(e.LEVEL_SEVERE,"GpuShader","constructor","Unable to compile shader: "+s))}this.shaderId=o;};return i.prototype.compile=function(t,e,i,r){return t.shaderSource(e,r), t.compileShader(e), t.getShaderParameter(e,t.COMPILE_STATUS)}, i.prototype.dispose=function(t){this.shaderId&&(t.deleteShader(this.shaderId), delete this.shaderId);}, i}), i("shaders/GpuProgram",["../error/ArgumentError","../util/Color","../shaders/GpuShader","../util/Logger"],function(t,e,i,r){var n=function(e,n,o,s){if(!n||!o)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","The specified shader source is null or undefined."));var a,l,h;try{l=new i(e,e.VERTEX_SHADER,n), h=new i(e,e.FRAGMENT_SHADER,o);}catch(t){throw l&&l.dispose(e), h&&h.dispose(e), t}if(a=e.createProgram(), !a)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","Unable to create shader program."));
if(e.attachShader(a,l.shaderId), e.attachShader(a,h.shaderId), s)for(var u=0,c=s.length;u<c;u++)e.bindAttribLocation(a,u,s[u]);if(!this.link(e,a)){var d=e.getProgramInfoLog(a);throw e.detachShader(a,l.shaderId), e.detachShader(a,h.shaderId), e.deleteProgram(a), l.dispose(e), h.dispose(e), new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","constructor","Unable to link shader program: "+d))}this.programId=a, this.attributeLocations={}, this.uniformLocations={}, this.vertexShader=l, this.fragmentShader=h, this.size=n.length+o.length, this.scratchArray=new Float32Array(16);};return n.prototype.dispose=function(t){this.programId&&(this.vertexShader&&t.detachShader(this.programId,this.vertexShader.shaderId), this.fragmentShader&&t.detachShader(this.programId,this.fragmentShader.shaderId), t.deleteProgram(this.programId), delete this.programId), this.vertexShader&&(this.vertexShader.dispose(t), delete this.vertexShader), this.fragmentShader&&(this.fragmentShader.dispose(t), delete this.fragmentShader), this.attributeLocations={}, this.uniformLocations={};}, n.prototype.attributeLocation=function(e,i){if(!i||0==i.length)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","attributeLocation","The specified attribute name is null, undefined or empty."));var n=this.attributeLocations[i];return n||(n=e.getAttribLocation(this.programId,i), this.attributeLocations[i]=n), n}, n.prototype.uniformLocation=function(e,i){if(!i||0==i.length)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","uniformLocation","The specified uniform name is null, undefined or empty."));var n=this.uniformLocations[i];return n||(n=e.getUniformLocation(this.programId,i), this.uniformLocations[i]=n), n}, n.prototype.link=function(t,e){return t.linkProgram(e), t.getProgramParameter(e,t.LINK_STATUS)}, n.prototype.loadUniformMatrix=function(e,i,n){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","loadUniformMatrix","missingMatrix"));var o=i.columnMajorComponents(this.scratchArray);e.uniformMatrix4fv(n,!1,o);}, n.prototype.loadUniformColor=function(e,i,n){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"GpuProgram","loadUniformColor","missingColor"));var o=i.premultipliedComponents(this.scratchArray);e.uniform4f(n,o[0],o[1],o[2],o[3]);}, n.prototype.loadUniformColorComponents=function(t,e,i,r,n,o){t.uniform4f(o,e*n,i*n,r*n,n);}, n}), i("shaders/BasicTextureProgram",["../error/ArgumentError","../util/Color","../shaders/GpuProgram","../util/Logger"],function(t,e,i,r){var n=function(t){var e="attribute vec4 vertexPoint;\nattribute vec4 vertexTexCoord;\nattribute vec4 normalVector;\nuniform mat4 mvpMatrix;\nuniform mat4 mvInverseMatrix;\nuniform mat4 texCoordMatrix;\nuniform bool applyLighting;\nvarying vec2 texCoord;\nvarying vec4 normal;\nvoid main() {gl_Position = mvpMatrix * vertexPoint;\ntexCoord = (texCoordMatrix * vertexTexCoord).st;\nif (applyLighting) {normal = mvInverseMatrix * normalVector;}\n}",r="precision mediump float;\nuniform float opacity;\nuniform vec4 color;\nuniform bool enableTexture;\nuniform bool modulateColor;\nuniform sampler2D textureSampler;\nuniform bool applyLighting;\nvarying vec2 texCoord;\nvarying vec4 normal;\nvoid main() {\nvec4 textureColor = texture2D(textureSampler, texCoord);\nfloat ambient = 0.15; vec4 lightDirection = vec4(0, 0, 1, 0);\nif (enableTexture && !modulateColor)\n gl_FragColor = textureColor * color * opacity;\nelse if (enableTexture && modulateColor)\n gl_FragColor = color * floor(textureColor.a + 0.5);\nelse\n gl_FragColor = color * opacity;\nif (gl_FragColor.a == 0.0) {discard;}\nif (applyLighting) {\n vec4 n = normal * (gl_FrontFacing ? 1.0 : -1.0);\n gl_FragColor.rgb *= clamp(ambient + dot(lightDirection, n), 0.0, 1.0);\n}\n}",n=["vertexPoint","normalVector","vertexTexCoord"];i.call(this,t,e,r,n), this.vertexPointLocation=this.attributeLocation(t,"vertexPoint"), this.normalVectorLocation=this.attributeLocation(t,"normalVector"), this.vertexTexCoordLocation=this.attributeLocation(t,"vertexTexCoord"), this.mvpMatrixLocation=this.uniformLocation(t,"mvpMatrix"), this.mvInverseMatrixLocation=this.uniformLocation(t,"mvInverseMatrix"), this.colorLocation=this.uniformLocation(t,"color"), this.textureEnabledLocation=this.uniformLocation(t,"enableTexture"), this.modulateColorLocation=this.uniformLocation(t,"modulateColor"), this.textureUnitLocation=this.uniformLocation(t,"textureSampler"), this.textureMatrixLocation=this.uniformLocation(t,"texCoordMatrix"), this.opacityLocation=this.uniformLocation(t,"opacity"), this.applyLightingLocation=this.uniformLocation(t,"applyLighting");};return n.key="WorldWindGpuBasicTextureProgram", n.prototype=Object.create(i.prototype), n.prototype.loadModelviewInverse=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadModelviewInverse","missingMatrix"));this.loadUniformMatrix(e,i,this.mvInverseMatrixLocation);}, n.prototype.loadModelviewProjection=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadModelviewProjection","missingMatrix"));this.loadUniformMatrix(e,i,this.mvpMatrixLocation);}, n.prototype.loadColor=function(e,i){if(!i)throw new t(r.logMessage(r.LEVEL_SEVERE,"BasicTextureProgram","loadColor","missingColor"));this.loadUniformColor(e,i,this.colorLocation);}, n.prototype.loadTextureEnabled=function(t,e){t.uniform1i(this.textureEnabledLocation,e?1:0);}, n.prototype.loadModulateColor=function(t,e){t.uniform1i(this.modulateColorLocation,e?1:0);}, n.prototype.loadTextureUnit=function(t,e){t.uniform1i(this.textureUnitLocation,e-t.TEXTURE0);}, n.prototype.loadTextureMatrix=function(t,e){this.loadUniformMatrix(t,e,this.textureMatrixLocation);}, n.prototype.loadOpacity=function(t,e){t.uniform1f(this.opacityLocation,e);}, n.prototype.loadApplyLighting=function(t,e){t.uniform1i(this.applyLightingLocation,e);}, n}), i("geom/Line",["../error/ArgumentError","../util/Logger","../geom/Vec3"],function(t,e,i){var r=function(i,r){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","constructor","Origin is null or undefined."));if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","constructor","Direction is null or undefined."));this.origin=i, this.direction=r;};return r.fromSegment=function(n,o){if(!n||!o)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","fromSegment","missingPoint"));var s=new i(n[0],n[1],n[2]),a=new i(o[0]-n[0],o[1]-n[1],o[2]-n[2]);return new r(s,a)}, r.prototype.pointAt=function(i,r){if(!r)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","pointAt","missingResult."));return r[0]=this.origin[0]+this.direction[0]*i, r[1]=this.origin[1]+this.direction[1]*i, r[2]=this.origin[2]+this.direction[2]*i, r}, r.prototype.equals=function(t){return!!t&&(this.origin.equals(t.origin)&&this.direction.equals(t.direction))}, r.prototype.clone=function(){var t=new r(new i(0,0,0),new i(0,0,0));return t.copy(this), t}, r.prototype.copy=function(i){if(!i)throw new t(e.logMessage(e.LEVEL_SEVERE,"Line","copy","missingLine"));return this.origin.copy(i.origin), this.direction.copy(i.direction), this}, r}), i("geom/Plane",["../error/ArgumentError","../geom/Line","../util/Logger","../geom/Vec3"],function(t,e,i,r){var n=function(t,e,i,n){this.normal=new r(t,e,i), this.distance=n;};return n.fromPoints=function(e,o,s){if(!e||!o||!s)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","fromPoints","missingVector"));var a=new r(o[0],o[1],o[2]);a.subtract(e);var l=new r(s[0],s[1],s[2]);l.subtract(e), a.cross(l), a.normalize();var h=-a.dot(e);return new n(a[0],a[1],a[2],h)}, n.prototype.dot=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","dot","missingVector"));return this.normal.dot(e)+this.distance}, n.prototype.distanceToPoint=function(t){return this.dot(t)}, n.prototype.transformByMatrix=function(e){if(!e)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","transformByMatrix","missingMatrix"));var r=e[0]*this.normal[0]+e[1]*this.normal[1]+e[2]*this.normal[2]+e[3]*this.distance,n=e[4]*this.normal[0]+e[5]*this.normal[1]+e[6]*this.normal[2]+e[7]*this.distance,o=e[8]*this.normal[0]+e[9]*this.normal[1]+e[10]*this.normal[2]+e[11]*this.distance,s=e[12]*this.normal[0]+e[13]*this.normal[1]+e[14]*this.normal[2]+e[15]*this.distance;return this.normal[0]=r, this.normal[1]=n, this.normal[2]=o, this.distance=s, this}, n.prototype.normalize=function(){var t=this.normal.magnitude();return 0===t?this:(this.normal.divide(t), this.distance/=t, this)}, n.prototype.intersectsSegment=function(t,e){var i=this.dot(t),r=this.dot(e);return i*r<=0}, n.prototype.intersectsSegmentAt=function(t,e,i){var r=this.dot(t),n=this.dot(e);if(0===r&&0===n)return i[0]=t[0], i[1]=t[1], i[2]=t[2], !0;if(r===n)return!1;var o=-r/(n-r),s=1-o;return i[0]=o*t[0]+s*e[0], i[1]=o*t[1]+s*e[1], i[2]=o*t[2]+s*e[2], r*n<=0}, n.prototype.onSameSide=function(e,r){if(!e||!r)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","onSameSide","missingPoint"));var n=this.distanceToPoint(e),o=this.distanceToPoint(r);return n<0&&o<0?-1:n>0&&o>0?1:0}, n.prototype.clip=function(n,o){if(!n||!o)throw new t(i.logMessage(i.LEVEL_SEVERE,"Plane","clip","missingPoint"));if(n.equals(o))return null;var s,a,l,h=e.fromSegment(n,o),u=this.normal.dot(h.direction);return 0===u?(s=this.dot(h.origin), 0===s?[n,o]:null):(a=-this.dot(h.