UNPKG

@cpc/cesium-api

Version:

6 lines 283 kB
/*! * @cpc/cesium-api * @cpc/cesium-api v1.0.19 * (c) 2021 939979509@qq.com */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).cpc={})}(this,(function(e){"use strict";function t(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=s(e);if(t){var r=s(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return u(this,n)}}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){r=!0,a=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw a}}return n}(e,t)||p(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function f(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=p(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}t("\r\n#_cesiumEchartLayer_ > div:not(:first-child){\r\n display: none !important;\r\n }\r\n/*卷帘效果--start*/\r\n.cpc-shutter-slider{\r\n position: absolute;\r\n top: 0;\r\n left: 50%;\r\n background-color: #d3d3d3;\r\n width: 5px;\r\n height: 100%;\r\n z-index: 9999;\r\n}\r\n.cpc-shutter-slider .splitter{\r\n position: absolute;\r\n left: -21px;\r\n top: calc(50% - 21px);\r\n width: 42px;\r\n height: 42px;\r\n background: #fff;\r\n border-radius: 50%;\r\n text-align: center;\r\n line-height: 58px;\r\n padding: 2px;\r\n border: 1px solid #d3d3d3;\r\n cursor: w-resize;\r\n}\r\n/*卷帘效果--end*/\r\n/*绘制提示样式*/\r\n.cpc-draw-tips{\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n background-color: #d1d333;\r\n transform: translateY(-50%);\r\n user-select:none;\r\n pointer-events: none;\r\n padding: 3px 10px;\r\n font-size: 14px;\r\n}\r\n");var y,g=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(e){var t,i=Object.prototype,r=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof y?t:y,a=Object.create(r.prototype),o=new L(i||[]);return a._invoke=function(e,t,n){var i=d;return function(r,a){if(i===p)throw new Error("Generator is already running");if(i===v){if("throw"===r)throw a;return D()}for(n.method=r,n.arg=a;;){var o=n.delegate;if(o){var s=E(o,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=h(e,t,n);if("normal"===l.type){if(i=n.done?v:m,l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}(e,n,o),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d="suspendedStart",m="suspendedYield",p="executing",v="completed",f={};function y(){}function g(){}function w(){}var x={};x[o]=function(){return this};var _=Object.getPrototypeOf,b=_&&_(_(P([])));b&&b!==i&&r.call(b,o)&&(x=b);var C=w.prototype=y.prototype=Object.create(x);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){function i(a,o,s,l){var c=h(e[a],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"===n(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}))}l(c.arg)}var a;this._invoke=function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}}function E(e,n){var i=e.iterator[n.method];if(i===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return f;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=h(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,f;var a=r.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,f):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function P(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:D}}function D(){return{value:t,done:!0}}return g.prototype=C.constructor=w,w.constructor=g,g.displayName=c(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},e.awrap=function(e){return{__await:e}},k(M.prototype),M.prototype[s]=function(){return this},e.AsyncIterator=M,e.async=function(t,n,i,r,a){void 0===a&&(a=Promise);var o=new M(u(t,n,i,r),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},k(C),c(C,l,"Generator"),C[o]=function(){return this},C.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=P,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(i,r){return s.type="throw",s.arg=e,n.next=i,r&&(n.method="next",n.arg=t),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;T(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:P(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),w=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))},x=function(){function e(){i(this,e)}return a(e,null,[{key:"isString",value:function(e){return"[object String]"==Object.prototype.toString.call(e)}},{key:"isNumber",value:function(e){return"[object Number]"==Object.prototype.toString.call(e)}},{key:"isBoolean",value:function(e){return"[object Boolean]"==Object.prototype.toString.call(e)}},{key:"isUndefined",value:function(e){return"[object Undefined]"==Object.prototype.toString.call(e)}},{key:"isNull",value:function(e){return"[object Null]"==Object.prototype.toString.call(e)}},{key:"isArray",value:function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{key:"isFunction",value:function(e){return"[object Function]"==Object.prototype.toString.call(e)}},{key:"isObject",value:function(e){return"[object Object]"==Object.prototype.toString.call(e)}},{key:"isRegExp",value:function(e){return"[object RegExp]"==Object.prototype.toString.call(e)}},{key:"isDate",value:function(e){return"[object Date]"==Object.prototype.toString.call(e)}},{key:"isIncludeJsOrCss",value:function(e){for(var t=/js$/i.test(e),n=document.getElementsByTagName(t?"script":"link"),i=0;i<n.length;i++)if(-1!=n[i][t?"src":"href"].indexOf(e))return!0;return!1}},{key:"loadScripts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return w(this,void 0,void 0,g.mark((function t(){var n,i,r;return g.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.isArray(e)){t.next=2;break}return t.abrupt("return");case 2:n=f(e),t.prev=3,n.s();case 5:if((i=n.n()).done){t.next=11;break}return r=i.value,t.next=9,this.loadScript(r);case 9:t.next=5;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(3),n.e(t.t0);case 16:return t.prev=16,n.f(),t.finish(16);case 19:case"end":return t.stop()}}),t,this,[[3,13,16,19]])})))}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(t.isIncludeJsOrCss(e))n(!0);else{var r=document.createElement("script");r.type="text/javascript",r.readyState?r.onreadystatechange=function(){"loaded"!=r.readyState&&"complete"!=r.readyState||(r.onreadystatechange=null,n(!0))}:r.onload=function(){n(!0)},r.src=e,document.getElementsByTagName("head")[0].appendChild(r)}}))}},{key:"deepClone",value:function(e){var t;if(this.isObject(e))t={};else{if(!this.isArray(e))return e;t=[]}for(var n in e){var i=e[n];this.isObject(i)||this.isArray(i)?t[n]=this.deepClone(i):t[n]=e[n]}return t}},{key:"getMax",value:function(e,t){return e.x=e.x>t.x?e.x:t.x,e.y=e.y>t.y?e.x:t.y,e.z=e.z>t.z?e.z:t.z,e}},{key:"getMin",value:function(e,t){return e.x=e.x<t.x?e.x:t.x,e.y=e.y<t.y?e.x:t.y,e.z=e.z<t.z?e.z:t.z,e}},{key:"uuidv1",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}}]),e}(),_=function e(){i(this,e),this.id=x.uuidv1()},b=window,C=b.echarts,k=b.Cesium,M=b.h337,E=b.turf,S=function(e){o(n,e);var t=h(n);function n(){var e;return i(this,n),(e=t.apply(this,arguments)).nameMapcallBacks=new Map,e}return a(n,[{key:"hasEventsByName",value:function(e){var t=this.nameMapcallBacks.get(e);return!(!t||!t.length)}},{key:"getEventsByName",value:function(e){return this.nameMapcallBacks.get(e)}},{key:"on",value:function(e,t){var n=this.nameMapcallBacks;n.has(e)||n.set(e,[]);var i,r=n.get(e)||[],a=f(r);try{for(a.s();!(i=a.n()).done;){if(i.value===t)return console.error("同一个方法重复绑定在同一个事件上,绑定失败",e),!1}}catch(e){a.e(e)}finally{a.f()}return r.push(t),!0}},{key:"off",value:function(e,t){var n=this.nameMapcallBacks;if(!n.has(e))return!1;for(var i=n.get(e)||[],r=0;r<i.length;r++)if(i[r]===t)return i.splice(r,1),!0;return!1}},{key:"emit",value:function(e){var t=this.nameMapcallBacks,n=t.get(e);if(n&&n.length){for(var i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];for(var o=0;o<n.length;o++){var s=n[o];s.call.apply(s,[s].concat(r))}}}}]),n}(_),T=new k.WebMercatorProjection,L=function(e){o(n,e);var t=h(n);function n(){return i(this,n),t.call(this)}return a(n,null,[{key:"wgs84_screen_position",value:function(e,t){var n=t.scene;return k.SceneTransforms.wgs84ToWindowCoordinates(n,this.wgs84_cartesian_position(e))}},{key:"wgs84_cartesian",value:function(e,t,n){return k.Cartesian3.fromDegrees(e,t,n,k.Ellipsoid.WGS84)}},{key:"wgs84_cartesian_position",value:function(e){var t=e.x,n=e.y,i=e.z;return k.Cartesian3.fromDegrees(t,n,i,k.Ellipsoid.WGS84)}},{key:"wgs84_cartesian_array",value:function(e){return k.Cartesian3.fromDegreesArray(e)}},{key:"wgs84_H_cartesian_array",value:function(e){return k.Cartesian3.fromDegreesArrayHeights(e)}},{key:"wgs84_mercator",value:function(e,t,n){return T.project(k.Cartographic.fromDegrees(e,t,n))}},{key:"wgs84_cartesian_angle",value:function(e){return{heading:k.Math.toRadians(e.heading),pitch:k.Math.toRadians(e.pitch),roll:e.roll}}},{key:"wgs84_cartesian_camera",value:function(e){return{destination:this.wgs84_cartesian_position(e.position),orientation:this.wgs84_cartesian_angle(e.angle)}}},{key:"cartesian_cartesian_xyz",value:function(e,t,n){return k.Cartesian3.fromElements(e,t,n)}},{key:"cartesian_wgs84_position",value:function(e){var t=k.Ellipsoid.WGS84.cartesianToCartographic(e);return{x:k.Math.toDegrees(t.longitude).toFixed(7),y:k.Math.toDegrees(t.latitude).toFixed(7),z:t.height.toFixed(2)}}},{key:"cartesian_wgs84_angle",value:function(e,t){return{heading:parseFloat(k.Math.toDegrees(t.heading).toFixed(2)),pitch:parseFloat(k.Math.toDegrees(t.pitch).toFixed(2)),roll:t.roll}}},{key:"mercator_wgs84",value:function(e,t,n){var i=T.unproject(new k.Cartesian3(e,t,n));return{x:k.Math.toDegrees(i.longitude),y:k.Math.toDegrees(i.latitude),z:i.height}}},{key:"screen_wgs84_position",value:function(e,t){var n,i=t.scene;if(i.mode===k.SceneMode.SCENE3D){var r=i.camera.getPickRay(e);n=i.globe.pick(r,i)}else n=i.camera.pickEllipsoid(e,k.Ellipsoid.WGS84);return this.cartesian_wgs84_position(n)}}]),n}(_),P=new(function(e){o(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return a(n,[{key:"toConstructResult",value:function(e,t){var n=t.position,i=e.camera.pickEllipsoid(n,e.scene.globe.ellipsoid),r=e.scene.pickPosition(t),a=L.cartesian_wgs84_position(i),o=e.scene.pick(n);return console.log("得到点",n,i,r),k.defined(o)?{screenPoint:n,cesiumPoint:i,mapPoint:a,status:0,msg:"成功",result:o}:{screenPoint:n,cesiumPoint:i,mapPoint:a,status:-1,msg:"失败"}}}]),n}(_)),D=[],z=function(e){o(n,e);var t=h(n);function n(e){var r;i(this,n),(r=t.call(this)).eventBus=new S,r.viewer=e;var a=new k.ScreenSpaceEventHandler(e.scene.canvas);return e.cesiumWidget.screenSpaceEventHandler.removeInputAction(k.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),a.setInputAction(r.on_left_click.bind(c(r)),k.ScreenSpaceEventType.LEFT_CLICK),a.setInputAction(r.on_double_click.bind(c(r)),k.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),a.setInputAction(r.on_middle_click.bind(c(r)),k.ScreenSpaceEventType.MIDDLE_CLICK),a.setInputAction(r.on_right_click.bind(c(r)),k.ScreenSpaceEventType.RIGHT_CLICK),r.handler=a,r}return a(n,[{key:"on",value:function(e,t){this.eventBus.on(e,t)}},{key:"off",value:function(e,t){this.eventBus.off(e,t)}},{key:"on_mouse_move",value:function(e){console.log("移动事件:",e)}},{key:"on_left_click",value:function(e){var t="click";if(this.eventBus.hasEventsByName(t)){var n=P.toConstructResult(this.viewer,e);this.eventBus.emit(t,n)}}},{key:"on_double_click",value:function(e){console.log("左键双击事件:",e)}},{key:"on_middle_click",value:function(e){console.log("中键单击事​​件:",e)}},{key:"on_right_click",value:function(e){var t=P.toConstructResult(this.viewer,e);console.log(t);var n=t.mapPoint,i=n.x,r=n.y,a=n.z;console.log([i,r,a]),D.push(i),D.push(r),D.push(a),console.info(D);var o=t.cesiumPoint;i=o.x,r=o.y,a=o.z;console.log([i,r,a])}},{key:"on_left_down",value:function(e){console.log("左键按下事件:",e)}},{key:"on_left_up",value:function(e){console.log("左键弹起事件:",e)}},{key:"on_middle_down",value:function(e){console.log("中键按下事件:",e)}},{key:"on_middle_up",value:function(e){console.log("中键弹起事件:",e)}},{key:"on_right_down",value:function(e){console.log("右键按下事件",e)}},{key:"on_right_up",value:function(e){console.log("右键弹起事件",e)}},{key:"on_wheelment",value:function(e){console.log("滚轮事件:",e)}},{key:"re",value:function(){}}]),n}(_),I={copyright:!1,switch23DDuration:0,debugShowFramesPerSecond:!1},A=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:I;for(var o in i(this,n),(r=t.call(this)).viewer=null,r.viewer=e,a=Object.assign(Object.assign({},I),a))r[o]=a[o];return r}return a(n,[{key:"copyright",get:function(){return"none"!==this.viewer._cesiumWidget._creditContainer.style.display},set:function(e){this.viewer._cesiumWidget._creditContainer.style.display=e?"block":"none"}},{key:"animation",get:function(){return"hidden"!==this.viewer.animation.container.style.visibility},set:function(e){this.viewer.animation.container.style.visibility=e?"visible":"none"}},{key:"timeline",get:function(){return"hidden"!==this.viewer.timeline.container.style.visibility},set:function(e){this.viewer.timeline.container.style.visibility=e?"visible":"hidden"}},{key:"switch23DDuration",get:function(){return this.viewer.sceneModePicker&&this.viewer.sceneModePicker.viewModel?this.viewer.sceneModePicker.viewModel.duration:0},set:function(e){this.viewer.sceneModePicker&&this.viewer.sceneModePicker.viewModel&&(this.viewer.sceneModePicker.viewModel.duration=e)}},{key:"debugShowFramesPerSecond",get:function(){return this.viewer.scene.debugShowFramesPerSecond},set:function(e){this.viewer.scene.debugShowFramesPerSecond=e}}]),n}(_);!function(e){e[e.default=0]="default",e[e.cesium=1]="cesium"}(y||(y={}));var O=[{rotateEventTypes:[k.CameraEventType.LEFT_DRAG],tiltEventTypes:[k.CameraEventType.RIGHT_DRAG,k.CameraEventType.PINCH,{eventType:k.CameraEventType.LEFT_DRAG,modifier:k.KeyboardEventModifier.CTRL},{eventType:k.CameraEventType.RIGHT_DRAG,modifier:k.KeyboardEventModifier.CTRL}],zoomEventTypes:[k.CameraEventType.MIDDLE_DRAG,k.CameraEventType.WHEEL,k.CameraEventType.PINCH]},{rotateEventTypes:[k.CameraEventType.LEFT_DRAG],tiltEventTypes:[k.CameraEventType.MIDDLE_DRAG,k.CameraEventType.PINCH,{eventType:k.CameraEventType.LEFT_DRAG,modifier:k.KeyboardEventModifier.CTRL},{eventType:k.CameraEventType.RIGHT_DRAG,modifier:k.KeyboardEventModifier.CTRL}],zoomEventTypes:[k.CameraEventType.RIGHT_DRAG,k.CameraEventType.WHEEL,k.CameraEventType.PINCH]}],F=function(e){o(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this)).viewer=e,r.switchHabit(y.default),r}return a(n,[{key:"switchHabit",value:function(e){var t=this.viewer,n=O[e];t.scene.screenSpaceCameraController.rotateEventTypes=n.rotateEventTypes,t.scene.screenSpaceCameraController.tiltEventTypes=n.tiltEventTypes,t.scene.screenSpaceCameraController.zoomEventTypes=n.zoomEventTypes}}]),n}(_),R={position:{x:105.7974307,y:31.547369,z:11037962.75},angle:{heading:2.47,pitch:-88.63,roll:0},duration:0},B=function(e){o(n,e);var t=h(n);function n(e,r){var a;if(i(this,n),(a=t.call(this)).viewer=e,r)if(r.duration){var o=r.complete;a.flyTo(r).then(o)}else a.setCamera(r);return e.homeButton&&e.homeButton.viewModel&&e.homeButton.viewModel.command.beforeExecute.addEventListener((function(e){e.cancel=!0,r&&(r.duration=2,a.flyTo(r))})),a}return a(n,[{key:"setCamera",value:function(e){this.viewer.camera.setView(L.wgs84_cartesian_camera(e))}},{key:"flyTo",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;return new Promise((function(n,i){var r=L.wgs84_cartesian_camera(t);r.complete=n,r.cancel=i,r.duration=t.duration,r.pitchAdjustHeight=t.pitchAdjustHeight,r.maximumHeight=t.maximumHeight,e.viewer.camera.flyTo(r)}))}},{key:"getCamera",value:function(){return{position:L.cartesian_wgs84_position(this.viewer.camera.position),angle:L.cartesian_wgs84_angle(this.viewer,this.viewer.camera)}}}]),n}(_),N=function(e){o(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this)).viewer=e,r}return a(n,[{key:"setCurTIme",value:function(){var e=new Date,t=new Date(2020,11,1);return this.setClockTImeByDate(e,t),this}},{key:"setClockTImeByDate",value:function(e,t,n,i){var r=k.JulianDate.fromDate(e),a=k.JulianDate.fromDate(t);return this.setClockTimeByJulianDate(r,a,n,i),this}},{key:"setClockTImeByIso8601",value:function(e,t,n,i){var r=k.JulianDate.fromIso8601(e),a=k.JulianDate.fromIso8601(t);return this.setClockTimeByJulianDate(r,a,n,i),this}},{key:"setClockTimeByJulianDate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k.ClockRange.LOOP_STOP,r=this.viewer;return r.timeline?(e=k.JulianDate.addHours(e,8,new k.JulianDate),t=k.JulianDate.addSeconds(e,360,new k.JulianDate),r.clock.startTime=e.clone(),r.clock.currentTime=e.clone(),r.clock.stopTime=t.clone(),r.clock.multiplier=n,r.timeline.zoomTo(e,t),r.clock.clockRange=i,this):this}}]),n}(_),j=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))},H={type:"",option:{}},V=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H;return i(this,n),(r=t.call(this)).viewer=e,r.terrain=a,r.setTerrain(a),r}return a(n,[{key:"setTerrain",value:function(e){if(e.type){if(!e.option)throw new Error("没有填写option");var t=this[e.type];t?t.call(this,e.option):console.error("地形的类型错误,不存在",e)}}},{key:"arcgis",value:function(e){var t=new k.ArcGISTiledElevationTerrainProvider(e);this.viewer.terrainProvider=t}},{key:"cesium",value:function(e){e.url||(e.url="https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path");var t=new k.CesiumTerrainProvider(e);this.viewer.terrainProvider=t}},{key:"tdt",value:function(e){return j(this,void 0,void 0,g.mark((function t(){var n,i,r,a,o;return g.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.tk){t.next=2;break}throw new Error("没有填写tk");case 2:if(e.urls){t.next=4;break}throw new Error("没有填写天地图插件的urls");case 4:return t.next=6,x.loadScripts(e.urls);case 6:for("https://t{s}.tianditu.gov.cn/",n=[0,1,2,3,4,5,6,7],i=[],r=0;r<n.length;r++)a="https://t{s}.tianditu.gov.cn/".replace("{s}",n[r])+"DataServer?T=elv_c&tk="+e.tk,i.push(a);o=new k.GeoTerrainProvider({urls:i}),this.viewer.terrainProvider=o;case 12:case"end":return t.stop()}}),t,this)})))}}]),n}(_),W=function(e){o(n,e);var t=h(n);function n(){var e;return i(this,n),(e=t.call(this)).map=null,e._successCallBack=null,e._errorCallBack=null,e._success=e._success.bind(c(e)),e._error=e._error.bind(c(e)),e}return a(n,[{key:"_success",value:function(e){this._successCallBack&&this._successCallBack(e)}},{key:"_error",value:function(e){this._errorCallBack&&this._errorCallBack(e)}},{key:"flyTo",value:function(e,t,n,i,r){return this.map&&this._flyTo(e,t,n,i,r),this}},{key:"addToMap",value:function(e){if(!(e instanceof _a))throw new Error("该参数不是map对象");return this.map=e,this._addToMap(e),this}},{key:"removeByMap",value:function(e){return this.map&&(this._removeByMap(e),this.map=null),this}},{key:"when",value:function(e){return this._successCallBack=e,this}},{key:"catch",value:function(e){return this._errorCallBack=e,this}}]),n}(_),G=function(e){o(n,e);var t=h(n);function n(e){var r;return i(this,n),(r=t.call(this)).type="Layer",r.name="",r.cesiumLayer=null,r.name=e,r}return a(n,[{key:"_flyTo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-90,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4?arguments[4]:void 0;return this.map.viewer.flyTo(this.cesiumLayer,{maximumHeight:r,duration:e,offset:{heading:k.Math.toRadians(n),pitch:k.Math.toRadians(t),range:i}}),this}},{key:"show",set:function(e){this.cesiumLayer.show=e},get:function(){return this.cesiumLayer.show}}]),n}(W),U=function(e){o(n,e);var t=h(n);function n(){var e;return i(this,n),(e=t.apply(this,arguments)).name="",e.type="ImageryLayer",e}return a(n,[{key:"_addToMap",value:function(e){e.viewer.imageryLayers.add(this.cesiumLayer)}},{key:"_removeByMap",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.cesiumLayer&&(this.map.viewer.imageryLayers.remove(this.cesiumLayer,e),this.cesiumLayer=null)}},{key:"splitDirection",value:function(e){this.cesiumLayer.splitDirection=e}}]),n}(G),Y=function(e){o(r,e);var t=h(r);function r(){var e,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),e=t.call(this,a.name),"object"!==n(a)&&(a={url:a}),a=Object.assign({enablePickFeatures:!1},a),e.type="ArcGisImageryLayer",e.imageryProvider=new k.ArcGisMapServerImageryProvider(a),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return r}(U),q={digital:{url:"http://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",subdomains:[1,2,3,4]},image:{url:"https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",subdomains:[1,2,3,4]},mark:{url:"http://webst0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8",subdomains:[1,2,3,4]}},$=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,n),e=t.call(this,r.name);var a=q[r.mold]||q.digital;return r=Object.assign(Object.assign({},a),r),e.type="AMapImageryLayer",e.imageryProvider=new k.UrlTemplateImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),K={digital:{url:"https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",subdomains:[0,1,2,3]}},X=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,n),e=t.call(this,r.name);var a=K[r.mold]||K.digital;return r=Object.assign(Object.assign({},a),r),e.type="GoogleImageryLayer",e.imageryProvider=new k.UrlTemplateImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),Z={digital:{url:"http://t{s}.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&",layer:"tdtVecBasicLayer",style:"default",format:"image/jpeg",subdomains:[0,1,2,3,4,5,6,7],tileMatrixSetID:"GoogleMapsCompatible",maximumLevel:18,show:!1},image:{url:"http://t{s}.tianditu.gov.cn/img_w/wmts?tilematrix={TileMatrix}&layer=img&style=default&tilerow={TileRow}&tilecol={TileCol}&tilematrixset=w&format=tiles&service=WMTS&version=1.0.0&request=GetTile&",layer:"img",style:"default",tileMatrixSetID:"w",subdomains:[0,1,2,3,4,5,6,7],maximumLevel:18,format:"tiles"},mark:{url:"http://t{s}.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&",layer:"tdtAnnoLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",subdomains:[0,1,2,3,4,5,6,7],maximumLevel:18,show:!1}},J=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(i(this,n),e=t.call(this,r.name),!r.tk)return alert("请填写tk"),u(e);var a=Z[r.mold]||Z.digital;return(r=Object.assign(Object.assign({},a),r)).url+="tk=".concat(r.tk),e.type="TDTImageryLayer",e.imageryProvider=new k.WebMapTileServiceImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),Q={digital:{url:"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=4&version=301",subdomains:[0,1,2,3],customTags:{sx:function(e,t,n,i){return t>>4},sy:function(e,t,n,i){return(1<<i)-n>>4}}},image:{url:"https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400",subdomains:[0,1,2,3],customTags:{sx:function(e,t,n,i){return t>>4},sy:function(e,t,n,i){return(1<<i)-n>>4}}},mark:{url:"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=2&version=297",subdomains:[0,1,2,3],customTags:{sx:function(e,t,n,i){return t>>4},sy:function(e,t,n,i){return(1<<i)-n>>4}}}},ee=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,n),e=t.call(this,r.name);var a=Q[r.mold]||Q.digital;return r=Object.assign(Object.assign({},a),r),e.type="TencentImageryLayer",e.imageryProvider=new k.UrlTemplateImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),te={digital:"http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1",image:"http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",mark:"http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020",xxx:"http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}"},ne=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,n),e=t.call(this,r.name);var a=te[r.mold]||te.digital;return r=Object.assign({url:a},r),e.type="BDImageryLayer",e.imageryProvider=new ie(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),ie=function(){function e(t){i(this,e),this._errorEvent=new k.Event,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1;var n=new k.Cartesian2(-33554054,-33746824),r=new k.Cartesian2(33554054,33746824);this._tilingScheme=new k.WebMercatorTilingScheme({rectangleSouthwestInMeters:n,rectangleNortheastInMeters:r}),this._rectangle=this._tilingScheme.rectangle;var a=k.Resource.createIfNeeded(t.url);this._resource=a,this._tileDiscardPolicy=void 0,this._credit=void 0,this._readyPromise=void 0}return a(e,[{key:"requestImage",value:function(e,t,n,i){var r=this._tilingScheme.getNumberOfXTilesAtLevel(n),a=this._tilingScheme.getNumberOfYTilesAtLevel(n),o=this.url.replace("{x}",e-r/2).replace("{y}",a/2-t-1).replace("{z}",n).replace("{s}",Math.floor(10*Math.random()));return k.ImageryProvider.loadImage(this,o)}},{key:"url",get:function(){return this._resource.url}},{key:"proxy",get:function(){return this._resource.proxy}},{key:"tileWidth",get:function(){if(!this.ready)throw new k.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},{key:"maximumLevel",get:function(){if(!this.ready)throw new k.DeveloperError("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},{key:"tilingScheme",get:function(){if(!this.ready)throw new k.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},{key:"rectangle",get:function(){if(!this.ready)throw new k.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},{key:"errorEvent",get:function(){return this._errorEvent}},{key:"ready",get:function(){return this._resource}},{key:"readyPromise",get:function(){return this._readyPromise}},{key:"credit",get:function(){if(!this.ready)throw new k.DeveloperError("credit must not be called before the imagery provider is ready.");return this._credit}}]),e}(),re=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,n),(e=t.call(this,r.name)).type="SingleTileImageryLayer",e.imageryProvider=new k.SingleTileImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),ae=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,n),(e=t.call(this,r.name)).type="WebMapServiceImageryLayer",e.imageryProvider=new k.WebMapServiceImageryProvider(r),e.cesiumLayer=new k.ImageryLayer(e.imageryProvider),e}return n}(U),oe={ArcGisImageryLayer:Y,AMapImageryLayer:$,GoogleImageryLayer:X,TDTImageryLayer:J,TencentImageryLayer:ee,BDImageryLayer:ne,SingleTileImageryLayer:re,WebMapServiceImageryLayer:ae},se=function(e){o(n,e);var t=h(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,n),(e=t.call(this,r.name)).type="ImageryProvider",x.isObject(r)||((r=r?{url:r}:{url:"http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer"}).type="ArcGisImageryLayer"),e.type=r.type,delete r.type;try{var a=new oe[e.type](r);e.imageryProvider=a.imageryProvider,e.cesiumLayer=a.cesiumLayer}catch(t){console.error("图层类型错误,无法解析",e.type,t)}return e}return n}(U),le=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return i(this,n),(r=t.call(this)).baseMaps=[],r.map=e,r.addBaseMaps(a),o||0===r.baseMaps.length||r.baseMaps[0].flyTo(),r}return a(n,[{key:"switchBasemaps",value:function(e){return this.removeAllBaseMap(),this.addBaseMaps(e),this}},{key:"addBaseMaps",value:function(e){var t,n=f(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.baseMaps.push(new se(i).addToMap(this.map))}}catch(e){n.e(e)}finally{n.f()}return this}},{key:"removeAllBaseMap",value:function(e){if(e){var t,n=f(e);try{for(n.s();!(t=n.n()).done;){t.value.removeByMap()}}catch(e){n.e(e)}finally{n.f()}}else{var i,r=f(this.baseMaps);try{for(r.s();!(i=r.n()).done;){i.value.removeByMap()}}catch(e){r.e(e)}finally{r.f()}this.baseMaps=[]}}}]),n}(_),ce=k.BoxGeometry,ue=k.Cartesian3,he=(k.defaultValue,k.defined),de=k.destroyObject,me=k.DeveloperError,pe=k.GeometryPipeline,ve=k.Matrix3,fe=k.Matrix4,ye=k.Transforms,ge=k.VertexFormat,we=k.BufferUsage,xe=k.CubeMap,_e=k.DrawCommand,be=k.loadCubeMap,Ce=k.RenderState,ke=k.VertexArray,Me=k.BlendingState,Ee=k.SceneMode,Se=k.ShaderProgram,Te=k.ShaderSource;k.defined(k.Matrix4.getRotation)||(k.Matrix4.getRotation=k.Matrix4.getMatrix3);var Le=new ve,Pe=function(e){o(r,e);var t=h(r);function r(e){var n;return i(this,r),(n=t.call(this))._sources=void 0,n.show=!0,n.sources=e.sources,n.show=e.show||!0,n._command=new _e({modelMatrix:fe.clone(fe.IDENTITY),owner:c(n)}),n._cubeMap=void 0,n._attributeLocations=void 0,n._useHdr=void 0,n}return a(r,[{key:"update",value:function(e,t){var i=this;if(this.show&&(e.mode===Ee.SCENE3D||e.mode===Ee.MORPHING)&&e.passes.render){var r=e.context;if(this._sources!==this.sources){this._sources=this.sources;var a=this.sources;if(!(he(a.positiveX)&&he(a.negativeX)&&he(a.positiveY)&&he(a.negativeY)&&he(a.positiveZ)&&he(a.negativeZ)))throw new me("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(n(a.positiveX)!==n(a.negativeX)||n(a.positiveX)!==n(a.positiveY)||n(a.positiveX)!==n(a.negativeY)||n(a.positiveX)!==n(a.positiveZ)||n(a.positiveX)!==n(a.negativeZ))throw new me("this.sources properties must all be the same type.");"string"==typeof a.positiveX?be(r,this._sources).then((function(e){i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e})):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new xe({context:r,source:a}))}var o=this._command;if(o.modelMatrix=ye.eastNorthUpToFixedFrame(e.camera._positionWC),!he(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return fe.getRotation(o.modelMatrix,Le)}};var s=ce.createGeometry(ce.fromDimensions({dimensions:new ue(2,2,2),vertexFormat:ge.POSITION_ONLY})),l=this._attributeLocations=pe.createAttributeLocations(s);o.vertexArray=ke.fromGeometry({context:r,geometry:s,attributeLocations:l,bufferUsage:we._DRAW}),o.renderState=Ce.fromCache({blending:Me.ALPHA_BLEND})}if(!he(o.shaderProgram)||this._useHdr!==t){var c=new Te({defines:[t?"HDR":""],sources:["uniform samplerCube u_cubeMap;\n varying vec3 v_texCoord;\n void main()\n {\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n "]});o.shaderProgram=Se.fromCache({context:r,vertexShaderSource:"attribute vec3 position;\n varying vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n }\n ",fragmentShaderSource:c,attributeLocations:this._attributeLocations}),this._useHdr=t}if(he(this._cubeMap))return o}}},{key:"isDestroyed",value:function(){return!1}},{key:"destroy",value:function(){var e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),de(this)}}]),r}(_),De=function(e){o(n,e);var t=h(n);function n(e,r){var a;return i(this,n),(a=t.call(this)).isEventListener=!1,a.defalutSkyBox=null,a.nearSkyBox=null,a.farSkyBox=null,a.map=e,a.skyBox=r,a.defalutSkyBox=e.viewer.scene.skyBox,r?(r.nearSkyBox&&a.setNearSkyBox(r.nearSkyBox),r.farSkyBox&&a.setFarSkyBox(r.farSkyBox),a):u(a)}return a(n,[{key:"setFarDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2500;this.skyBox.farDistance=e,this.isEventListener&&this.setSkyBox()}},{key:"setNearSkyBox",value:function(e){this.skyBox.nearSkyBox=e,this.nearSkyBox=e?new Pe({sources:e}):null,this.setSkyBox(),this.addEventListener()}},{key:"setFarSkyBox",value:function(e){this.skyBox.farSkyBox=e,this.farSkyBox=e?new k.SkyBox({sources:e}):null,this.setSkyBox()}},{key:"addEventListener",value:function(){if(!this.isEventListener){var e=this.map;e.viewer.scene.skyAtmosphere.show=!1,e.viewer.scene.globe.depthTestAgainstTerrain=!0,e.viewer.scene.postRender.addEventListener(this.setSkyBox.bind(this)),this.isEventListener=!0}}},{key:"setSkyBox",value:function(){var e=this.map,t=this.skyBox.farDistance||2500,n=e.viewer.camera.position,i=k.Cartographic.fromCartesian(n).height,r=this.defalutSkyBox;r=i<t?this.nearSkyBox||this.defalutSkyBox:this.farSkyBox||this.defalutSkyBox,e.viewer.scene.skyBox=r}}]),n}(_),ze={},Ie=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ze,o=arguments.length>2?arguments[2]:void 0;return i(this,n),(r=t.call(this)).positions=[],r.tempPositions=[],r.drawEntityMap=new Map,r.successBack=null,r.errorBack=null,r.tipsText="",r.option=a,r.handler=o||e.drawManager.handler,r.viewer=e.viewer,r}return a(n,[{key:"addTips",value:function(){this._tips||(this._tips=document.createElement("div"),this._tips.className="cpc-draw-tips",this.viewer.container.appendChild(this._tips))}},{key:"moveTips",value:function(e){var t=this._tips;t.innerHTML!==this.tipsText&&(t.innerHTML=this.tipsText),t.style.top=e.y+"px",t.style.left=e.x+"px"}},{key:"removeTips",value:function(){this._tips&&(this.viewer.container.removeChild(this._tips),this._tips=null)}},{key:"activate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.deactivate(),this.tipsText="左键绘制-右键取消",this.successBack=e,this.errorBack=t,this.viewer.enableCursorStyle=!1,this.viewer._element.style.cursor="default",this.registerEvents(),this}},{key:"deactivate",value:function(){return this.handleDeactivate(),this.clearDrawEntity(),this.unRegisterEvents(),this.positions=[],this.emitErrorCallBack({code:2,message:"代码触发的取消"}),this}},{key:"setOption",value:function(e){this.option=e}},{key:"emitSuccessCallBack",value:function(e){this.successBack&&(this.successBack(e),this.successBack=null,this.errorBack=null)}},{key:"emitErrorCallBack",value:function(e){this.errorBack&&(this.errorBack(e),this.successBack=null,this.errorBack=null)}},{key:"clearDrawEntity",value:function(){if(this.drawEntityMap.size>0){var e,t=f(this.drawEntityMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.viewer.entities.remove(n)}}catch(e){t.e(e)}finally{t.f()}this.drawEntityMap=new Map}this.tempPositions=[]}},{key:"registerEvents",value:function(){this.addTips(),this.handler.setInputAction(this.leftClickEvent.bind(this),k.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction(this.rightClickEvent.bind(this),k.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction(this.mouseMoveEvent.bind(this),k.ScreenSpaceEventType.MOUSE_MOVE)}},{key:"unRegisterEvents",value:function(){this.viewer.enableCursorStyle=!0,this.viewer._element.style.cursor="pointer",this.handler.removeInputAction(k.ScreenSpaceEventType.LEFT_CLICK),this.handler.removeInputAction(k.ScreenSpaceEventType.RIGHT_CLICK),this.handler.removeInputAction(k.ScreenSpaceEventType.MOUSE_MOVE),this.removeTips()}},{key:"leftClickEvent",value:function(e){var t=this.viewer.scene.pickPosition(e.position);(t||(t=this.viewer.scene.camera.pickEllipsoid(e.position,this.viewer.scene.globe.ellipsoid)))&&(0===this.positions.length?this.handleFirstPosition(t):this.handleOtherPosition(t))}},{key:"rightClickEvent",value:function(){this.drawEntityMap.size>0?(this.handleDrawEnd(),this.unRegisterEvents()):(this.emitErrorCallBack({code:1,message:"鼠标右键取消"}),this.deactivate())}},{key:"mouseMoveEvent",value:function(e){if(this.moveTips(e.endPosition),this.isMoveEvent){var t=this.viewer.scene.pickPosition(e.endPosition);(t||(t=this.viewer.scene.camera.pickEllipsoid(e.startPosition,this.viewer.scene.globe.ellipsoid)))&&this.positions.length>0&&this.handleMove(t)}}}]),n}(_),Ae={polygon:{material:k.Color.RED.withAlpha(.4),perPositionHeight:!0},polyline:{width:1,material:new k.PolylineDashMaterialProperty({color:k.Color.YELLOW}),depthFailMaterial:new k.PolylineDashMaterialProperty({color:k.Color.YELLOW})}},Oe=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ae,o=arguments.length>2?arguments[2]:void 0;return i(this,n),(r=t.call(this,e,a,o)).isMoveEvent=!0,r}return a(n,[{key:"setOption",value:function(e){this.option=e}},{key:"handleFirstPosition",value:function(e){this.positions.push(e),this.createPolygonEntity(),this.tipsText="开始绘制第"+this.positions.length+"个点"}},{key:"handleMove",value:function(e){this.tempPositions=this.positions.concat([e])}},{key:"handleOtherPosition",value:function(e){this.positions.push(e),this.tipsText="开始绘制第"+this.positions.length+"个点"}},{key:"handleDrawEnd",value:function(){if(this.positions.length<3)return this.emitErrorCallBack({code:1,message:"鼠标右键取消"}),void this.deactivate();this.unRegisterEvents();var e=this.drawEntityMap.get("polygon");e&&(e.polygon.hierarchy=this.positions,e.polyline.positions=this.positions.concat(this.positions[0])),this.emitSuccessCallBack({code:0,message:"成功",data:this.positions})}},{key:"handleDeactivate",value:function(){}},{key:"createPolygonEntity",value:function(){var e=this,t=this.option,n=this.viewer.entities.add({polygon:Object.assign(Object.assign({},t.polygon),{hierarchy:new k.CallbackProperty((function(){return new k.PolygonHierarchy(e.tempPositions)}),!1)}),polyline:Object.assign(Object.assign({},t.polyline),{positions:new k.CallbackProperty((function(){return e.tempPositions.concat(e.tempPositions[0])}),!1)})});this.drawEntityMap.set("polygon",n)}}]),n}(Ie),Fe={polyline:{width:2,material:k.Color.YELLOW,depthFailMaterial:k.Color.YELLOW}},Re=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe,o=arguments.length>2?arguments[2]:void 0;return i(this,n),(r=t.call(this,e,a,o)).isMoveEvent=!0,r}return a(n,[{key:"setOption",value:function(e){this.option=e}},{key:"handleFirstPosition",value:function(e){this.positions.push(e),this.tipsText="开始绘制第"+this.positions.length+"个点",this.createLineEntity()}},{key:"handleMove",value:function(e){this.tempPositions=this.positions.concat([e])}},{key:"handleOtherPosition",value:function(e){this.positions.push(e),this.tipsText="开始绘制第"+this.positions.length+"个点"}},{key:"handleDrawEnd",value:function(){if(this.positions.length<2)return this.emitErrorCallBack({code:1,message:"鼠标右键取消"}),void this.deactivate();this.unRegisterEvents();var e=this.drawEntityMap.get("polyline");e&&(e.polyline.positions=this.positions),this.emitSuccessCallBack({code:0,message:"成功",data:this.positions})}},{key:"handleDeactivate",value:function(){}},{key:"createLineEntity",value:function(){var e=this,t=this.option,n=this.viewer.entities.add({polyline:Object.assign(Object.assign({},t.polyline),{positions:new k.CallbackProperty((function(){return e.tempPositions}),!1)})});this.drawEntityMap.set("polyline",n)}}]),n}(Ie),Be={point:{pixelSize:10,color:k.Color.RED}},Ne=function(e){o(n,e);var t=h(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be,o=arguments.length>2?arguments[2]:void 0;return i(this,n),(r=t.call(this,e,a,o)).isMoveEvent=!1,r}return a(n,[{key:"setOption",value:function(e){this.option=e}},{key:"handleFirstPosition",value:function(e){this.positions.push(e),this.handleDrawEnd()}},{key:"createPoint",value:function(){var e=this.option,t=this.viewer.entities.add({position:this.positions[0],point:e.point});this.drawEntityMap.set("point",t)}},{key:"handleMove",value:function(e){}},{key:"handleOtherPosition",value:function(e){}},{key:"handleDrawEnd",value:function(){if(this.positions.length<1)return this.emitErrorCallBack({code:1,message:"鼠标右键取消"}),void this.deactivate();this.unRegisterEvents(),this.createPoint(),this.emitSuccessCallBack({code:0,message:"成功",data:this.positions[0]})}},{key:"handleDeactivate",value:function(){}}]),n}(Ie),je=Math.PI/180,He=180/Math.PI,Ve=new(function(e){o(n,e);var t=h(n);function n(){return i(this,n),t.apply(this,arguments)}return a(n,[{key:"getArea",value:function(e,t){for(var n=t.map((function(e){var t=k.Cartographic.fromCartesian(e);return{lon:k.Math.toDegrees(t.longitude),lat:k.Math.toDegrees(t.latitude),hei:t.height}})),i=0,r=0;r<n.length-2;r++){var a=(r+1)%n.length,o=(r+2)%n.length,s=this.Angle(n[r],n[a],n[o]);i+=this.distance(t[r],t[a])*this.distance(t[a],t[o])*Math.abs(Math.sin(s))}return Math.abs(i)}},{key:"Angle",value:function(e,t,n