@dvgis/cesium-map
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,r){var n=r(6);e.exports=function(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&&n(e,t)}},function(e,t,r){var n=r(7),i=r(8);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){e.exports=r(9)},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){"use strict";r.r(t);var n=r(1),i=r.n(n),o=r(4),u=r.n(o),s="http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",c="http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020",l="http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}",a=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,e),this._url="img"===t.style?s:"vec"===t.style?c:l,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._tilingScheme=new Cesium.WebMercatorTilingScheme({rectangleSouthwestInMeters:new Cesium.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new Cesium.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=t.style||"normal"}return u()(e,[{key:"getTileCredits",value:function(e,t,r){}},{key:"requestImage",value:function(e,t,r){if(!this.ready)throw new Cesium.DeveloperError("requestImage must not be called before the imagery provider is ready.");var n=this._tilingScheme.getNumberOfXTilesAtLevel(r),i=this._tilingScheme.getNumberOfYTilesAtLevel(r),o=this._url.replace("{x}",e-n/2).replace("{y}",i/2-t-1).replace("{z}",r).replace("{s}",1).replace("{style}",this._style);return Cesium.ImageryProvider.loadImage(this,o)}},{key:"url",get:function(){return this._url}},{key:"token",get:function(){return this._token}},{key:"tileWidth",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},{key:"tileHeight",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},{key:"maximumLevel",get:function(){if(!this.ready)throw new Cesium.DeveloperError("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},{key:"minimumLevel",get:function(){if(!this.ready)throw new Cesium.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},{key:"tilingScheme",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},{key:"rectangle",get:function(){if(!this.ready)throw new Cesium.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},{key:"ready",get:function(){return!!this._url}},{key:"credit",get:function(){return this._credit}},{key:"hasAlphaChannel",get:function(){return!0}}]),e}(),f=r(2),y=r.n(f),m=r(3),p=r.n(m),h=r(0),g=r.n(h);function d(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 r,n=g()(e);if(t){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}var v="http://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",b=function(e){y()(r,e);var t=d(r);function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),e.url="img"===e.style?"https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}":v,e.subdomains&&e.subdomains.length||(e.subdomains=["01","02","03","04"]),t.call(this,e)}return r}(Cesium.UrlTemplateImageryProvider);function x(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 r,n=g()(e);if(t){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}var _=function(e){y()(r,e);var t=x(r);function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,r);var n="img"===e.style?"https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400":"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid={style}&scene=0&version=347";return e.url=n.replace("{style}",e.style||1),e.subdomains&&e.subdomains.length||(e.subdomains=["0","1","2"]),"img"===e.style&&(e.customTags={sx:function(e,t,r,n){return t>>4},sy:function(e,t,r,n){return(1<<n)-r>>4}}),t.call(this,e)}return r}(Cesium.UrlTemplateImageryProvider);function w(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 r,n=g()(e);if(t){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}var C="https://t{s}.tianditu.gov.cn/DataServer?T={style}_w&x={x}&y={y}&l={z}&tk={key}",S=function(e){y()(r,e);var t=w(r);function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),t.call(this,{url:C.replace(/\{style\}/g,e.style||"vec").replace(/\{key\}/g,e.key||""),subdomains:["0","1","2","3","4","5","6","7"],tilingScheme:new Cesium.WebMercatorTilingScheme,maximumLevel:18})}return r}(Cesium.UrlTemplateImageryProvider);function z(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 r,n=g()(e);if(t){var i=g()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p()(this,r)}}var P="http://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",R="http://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile",k=function(e){y()(r,e);var t=z(r);function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),e.url="img"===e.style?"http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali":"ter"===e.style?R:P,e.subdomains&&e.subdomains.length||(e.subdomains=["1","2","3"]),t.call(this,e)}return r}(Cesium.UrlTemplateImageryProvider);Cesium.AmapImageryProvider=b,Cesium.BaiduImageryProvider=a,Cesium.TencentImageryProvider=_,Cesium.TdtImageryProvider=S,Cesium.GoogleImageryProvider=k}]); | ||
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e,r){var n=r(6);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e,r){var n=r(7),i=r(8);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e,r){t.exports=r(9)},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n),o=r(4),a=r.n(o),u=r(2),s=r.n(u),l=r(3),c=r.n(l),f=r(1),h=r.n(f),g=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],y=[75,60,45,30,15,0],m=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],v=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],p=function(){function t(){i()(this,t),this.isWgs84=!1}return a()(t,[{key:"getDistanceByMC",value:function(t,e){if(!t||!e)return 0;if(!(t=this.convertMC2LL(t)))return 0;var r=this.toRadians(t.lng),n=this.toRadians(t.lat);if(!(e=this.convertMC2LL(e)))return 0;var i=this.toRadians(e.lng),o=this.toRadians(e.lat);return this.getDistance(r,i,n,o)}},{key:"getDistanceByLL",value:function(t,e){if(!t||!e)return 0;t.lng=this.getLoop(t.lng,-180,180),t.lat=this.getRange(t.lat,-74,74),e.lng=this.getLoop(e.lng,-180,180),e.lat=this.getRange(e.lat,-74,74);var r=this.toRadians(t.lng),n=this.toRadians(t.lat),i=this.toRadians(e.lng),o=this.toRadians(e.lat);return this.getDistance(r,i,n,o)}},{key:"convertMC2LL",value:function(t){if(!t)return{lng:0,lat:0};var e={};if(this.isWgs84){e.lng=t.lng/20037508.34*180;var r=t.lat/20037508.34*180;return e.lat=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),{lng:e.lng.toFixed(6),lat:e.lat.toFixed(6)}}Math.abs(t.lng);for(var n=Math.abs(t.lat),i=void 0,o=0;o<g.length;o++)if(n>=g[o]){i=m[o];break}return{lng:(e=this.convertor(t,i)).lng.toFixed(6),lat:e.lat.toFixed(6)}}},{key:"convertLL2MC",value:function(t){if(!t)return{lng:0,lat:0};if(t.lng>180||t.lng<-180||t.lat>90||t.lat<-90)return t;if(this.isWgs84){var e={};e.lng=t.lng*Math.PI/180*6378137;var r=t.lat*Math.PI/180;return e.lat=3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r))),{lng:parseFloat(e.lng.toFixed(2)),lat:parseFloat(e.lat.toFixed(2))}}t.lng=this.getLoop(t.lng,-180,180),t.lat=this.getRange(t.lat,-74,74);t.lng;for(var n=t.lat,i=void 0,o=0;o<y.length;o++)if(n>=y[o]){i=v[o];break}if(!i)for(var a=0;a<y.length;a++)if(n<=-y[a]){i=v[a];break}var u=this.convertor(t,i);return{lng:parseFloat(u.lng.toFixed(2)),lat:parseFloat(u.lat.toFixed(2))}}},{key:"convertor",value:function(t,e){if(!t||!e)return{lng:0,lat:0};var r=e[0]+e[1]*Math.abs(t.lng),n=Math.abs(t.lat)/e[9],i=e[2]+e[3]*n+e[4]*n*n+e[5]*n*n*n+e[6]*n*n*n*n+e[7]*n*n*n*n*n+e[8]*n*n*n*n*n*n;return{lng:r*=t.lng<0?-1:1,lat:i*=t.lat<0?-1:1}}},{key:"getDistance",value:function(t,e,r,n){return 6370996.81*Math.acos(Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos(e-t))}},{key:"toRadians",value:function(t){return Math.PI*t/180}},{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"getRange",value:function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}},{key:"getLoop",value:function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t}},{key:"lngLatToMercator",value:function(t){return this.convertLL2MC(t)}},{key:"lngLatToPoint",value:function(t){var e=this.convertLL2MC(t);return{x:e.lng,y:e.lat}}},{key:"mercatorToLngLat",value:function(t){return this.convertMC2LL(t)}},{key:"pointToLngLat",value:function(t){var e={lng:t.x,lat:t.y};return this.convertMC2LL(e)}},{key:"pointToPixel",value:function(t,e,r,n){if(t){t=this.lngLatToMercator(t);var i=this.getZoomUnits(e);return{x:Math.round((t.lng-r.lng)/i+n.width/2),y:Math.round((r.lat-t.lat)/i+n.height/2)}}}},{key:"pixelToPoint",value:function(t,e,r,n){if(t){var i=this.getZoomUnits(e),o={lng:r.lng+i*(t.x-n.width/2),lat:r.lat-i*(t.y-n.height/2)};return this.mercatorToLngLat(o)}}},{key:"getZoomUnits",value:function(t){return Math.pow(2,18-t)}}]),t}(),d=52.35987755982988,M=3.141592653589793,x=.006693421622965943,C=function(){function t(){i()(this,t)}return a()(t,null,[{key:"BD09ToGCJ02",value:function(t,e){var r=+t-.0065,n=+e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*d),o=Math.atan2(n,r)-3e-6*Math.cos(r*d);return[i*Math.cos(o),i*Math.sin(o)]}},{key:"GCJ02ToBD09",value:function(t,e){e=+e,t=+t;var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*d),n=Math.atan2(e,t)+3e-6*Math.cos(t*d);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]}},{key:"WGS84ToGCJ02",value:function(t,e){if(e=+e,t=+t,this.out_of_china(t,e))return[t,e];var r=this.delta(t,e);return[t+r[0],e+r[1]]}},{key:"GCJ02ToWGS84",value:function(t,e){if(e=+e,t=+t,this.out_of_china(t,e))return[t,e];var r=this.delta(t,e);return[2*t-(t+r[0]),2*e-(e+r[1])]}},{key:"delta",value:function(t,e){var r=this.transformLng(t-105,e-35),n=this.transformLat(t-105,e-35),i=e/180*M,o=Math.sin(i);o=1-x*o*o;var a=Math.sqrt(o);return[r=180*r/(6378245/a*Math.cos(i)*M),n=180*n/(6378245*(1-x)/(o*a)*M)]}},{key:"transformLng",value:function(t,e){var r=300+(t=+t)+2*(e=+e)+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*M)+20*Math.sin(2*t*M))/3,r+=2*(20*Math.sin(t*M)+40*Math.sin(t/3*M))/3,r+=2*(150*Math.sin(t/12*M)+300*Math.sin(t/30*M))/3}},{key:"transformLat",value:function(t,e){var r=2*(t=+t)-100+3*(e=+e)+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*M)+20*Math.sin(2*t*M))/3,r+=2*(20*Math.sin(e*M)+40*Math.sin(e/3*M))/3,r+=2*(160*Math.sin(e/12*M)+320*Math.sin(e*M/30))/3}},{key:"out_of_china",value:function(t,e){return e=+e,!((t=+t)>73.66&&t<135.05&&e>3.86&&e<53.55)}}]),t}();function b(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var R=function(t){s()(r,t);var e=b(r);function r(t){var n;i()(this,r),n=e.call(this,t);var o=new p;return n._projection.project=function(e,r){return r=r||{},"WGS84"===(null==t?void 0:t.crs)?(r=C.WGS84ToGCJ02(Cesium.Math.toDegrees(e.longitude),Cesium.Math.toDegrees(e.latitude)),r=C.GCJ02ToBD09(r[0],r[1])):r=C.GCJ02ToBD09(Cesium.Math.toDegrees(e.longitude),Cesium.Math.toDegrees(e.latitude)),r[0]=Math.min(r[0],180),r[0]=Math.max(r[0],-180),r[1]=Math.min(r[1],74.000022),r[1]=Math.max(r[1],-71.988531),r=o.lngLatToPoint({lng:r[0],lat:r[1]}),new Cesium.Cartesian2(r.x,r.y)},n._projection.unproject=function(e,r){return r=r||{},(r=o.mercatorToLngLat({lng:e.x,lat:e.y}))[0]=(r[0]+180)%360-180,"WGS84"===(null==t?void 0:t.crs)?(r=C.BD09ToGCJ02(r.lng,r.lat),r=C.GCJ02ToWGS84(r[0],r[1])):r=C.BD09ToGCJ02(r.lng,r.lat),new Cesium.Cartographic(Cesium.Math.toRadians(r[0]),Cesium.Math.toRadians(r[1]))},n.resolutions=t.resolutions||[],n}return a()(r,[{key:"tileXYToNativeRectangle",value:function(t,e,r,n){var i=this.resolutions[r],o=t*i,a=(t+1)*i,u=(1+(e=-e))*i,s=e*i;return Cesium.defined(n)?(n.west=o,n.south=s,n.east=a,n.north=u,n):new Cesium.Rectangle(o,s,a,u)}},{key:"positionToTileXY",value:function(t,e,r){var n=this._rectangle;if(Cesium.Rectangle.contains(n,t)){var i=this._projection.project(t);if(Cesium.defined(i)){var o=this.resolutions[e],a=Math.floor(i.x/o),u=-Math.floor(i.y/o);return Cesium.defined(r)?(r.x=a,r.y=u,r):new Cesium.Cartesian2(a,u)}}}}]),r}(Cesium.WebMercatorTilingScheme),k="http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46",_="http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=sl&v=020",w="http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}",L=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,t),this._url="img"===e.style?k:"vec"===e.style?_:w,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18;for(var r=[],n=0;n<19;n++)r[n]=256*Math.pow(2,18-n);this._tilingScheme=new R({rectangleSouthwestInMeters:new Cesium.Cartesian2(-20037726.37,-12474104.17),rectangleNortheastInMeters:new Cesium.Cartesian2(20037726.37,12474104.17),resolutions:r,crs:e.crs||""}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=e.style||"normal"}return a()(t,[{key:"getTileCredits",value:function(t,e,r){}},{key:"requestImage",value:function(t,e,r){if(!this.ready)throw new Cesium.DeveloperError("requestImage must not be called before the imagery provider is ready.");var n=this._url.replace("{x}",String(t)).replace("{y}",String(-e)).replace("{z}",r).replace("{s}",1).replace("{style}",this._style);return Cesium.ImageryProvider.loadImage(this,n)}},{key:"url",get:function(){return this._url}},{key:"token",get:function(){return this._token}},{key:"tileWidth",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},{key:"tileHeight",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},{key:"maximumLevel",get:function(){if(!this.ready)throw new Cesium.DeveloperError("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},{key:"minimumLevel",get:function(){if(!this.ready)throw new Cesium.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},{key:"tilingScheme",get:function(){if(!this.ready)throw new Cesium.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},{key:"rectangle",get:function(){if(!this.ready)throw new Cesium.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},{key:"ready",get:function(){return!!this._url}},{key:"credit",get:function(){return this._credit}},{key:"hasAlphaChannel",get:function(){return!0}}]),t}();function T(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var D=function(t){s()(r,t);var e=T(r);function r(t){var n;i()(this,r),n=e.call(this,t);var o=new Cesium.WebMercatorProjection;return n._projection.project=function(t,e){return e=C.WGS84ToGCJ02(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude)),e=o.project(new Cesium.Cartographic(Cesium.Math.toRadians(e[0]),Cesium.Math.toRadians(e[1]))),new Cesium.Cartesian2(e.x,e.y)},n._projection.unproject=function(t,e){var r=o.unproject(t);return e=C.GCJ02ToWGS84(Cesium.Math.toDegrees(r.longitude),Cesium.Math.toDegrees(r.latitude)),new Cesium.Cartographic(Cesium.Math.toRadians(e[0]),Cesium.Math.toRadians(e[1]))},n}return r}(Cesium.WebMercatorTilingScheme);function S(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var P="http://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",j=function(t){s()(r,t);var e=S(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),t.url="img"===t.style?"https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}":P,t.subdomains&&t.subdomains.length||(t.subdomains=["01","02","03","04"]),"WGS84"===t.crs&&(t.tilingScheme=new D),e.call(this,t)}return r}(Cesium.UrlTemplateImageryProvider);function z(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var G=function(t){s()(r,t);var e=z(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,r);var n="img"===t.style?"https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400":"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid={style}&scene=0&version=347";return t.url=n.replace("{style}",t.style||1),t.subdomains&&t.subdomains.length||(t.subdomains=["0","1","2"]),"img"===t.style&&(t.customTags={sx:function(t,e,r,n){return e>>4},sy:function(t,e,r,n){return(1<<n)-r>>4}}),e.call(this,t)}return r}(Cesium.UrlTemplateImageryProvider);function I(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var W="https://t{s}.tianditu.gov.cn/DataServer?T={style}_w&x={x}&y={y}&l={z}&tk={key}",O=function(t){s()(r,t);var e=I(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),e.call(this,{url:W.replace(/\{style\}/g,t.style||"vec").replace(/\{key\}/g,t.key||""),subdomains:["0","1","2","3","4","5","6","7"],tilingScheme:new Cesium.WebMercatorTilingScheme,maximumLevel:18})}return r}(Cesium.UrlTemplateImageryProvider);function F(t){var e=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(t){return!1}}();return function(){var r,n=h()(t);if(e){var i=h()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c()(this,r)}}var J="http://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",E="http://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile",B=function(t){s()(r,t);var e=F(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,r),t.url="img"===t.style?"http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali":"ter"===t.style?E:J,t.subdomains&&t.subdomains.length||(t.subdomains=["1","2","3"]),e.call(this,t)}return r}(Cesium.UrlTemplateImageryProvider);Cesium.AmapImageryProvider=j,Cesium.BaiduImageryProvider=L,Cesium.TencentImageryProvider=G,Cesium.TdtImageryProvider=O,Cesium.GoogleImageryProvider=B}]); |
{ | ||
"name": "@dvgis/cesium-map", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/dvgis/cesium-map.git", |
@@ -44,3 +44,4 @@ # cesium-map | ||
var options = { | ||
style: 'normal' // style: img、vec、normal、dark | ||
style: 'normal', // style: img、vec、normal、dark | ||
crs: 'WGS84' // 使用84坐标系,默认为:BD09 | ||
} | ||
@@ -84,3 +85,4 @@ viewer.imageryLayers.addImageryProvider( | ||
var options = { | ||
style: 'img' // style: img、elec | ||
style: 'img', // style: img、elec | ||
crs: 'WGS84' // 使用84坐标系,默认为:GCJ02 | ||
} | ||
@@ -87,0 +89,0 @@ viewer.imageryLayers.addImageryProvider(new Cesium.AmapImageryProvider(options)) |
@@ -6,2 +6,4 @@ /** | ||
import AmapMercatorTilingScheme from './AmapMercatorTilingScheme' | ||
const IMG_URL = | ||
@@ -19,2 +21,5 @@ 'https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}' | ||
} | ||
if (options.crs === 'WGS84') { | ||
options['tilingScheme'] = new AmapMercatorTilingScheme() | ||
} | ||
super(options) | ||
@@ -21,0 +26,0 @@ } |
@@ -6,2 +6,4 @@ /** | ||
import BaiduMercatorTilingScheme from './BaiduMercatorTilingScheme' | ||
const IMG_URL = | ||
@@ -27,5 +29,17 @@ 'http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46' | ||
this._maximumLevel = 18 | ||
this._tilingScheme = new Cesium.WebMercatorTilingScheme({ | ||
rectangleSouthwestInMeters: new Cesium.Cartesian2(-33554054, -33746824), | ||
rectangleNortheastInMeters: new Cesium.Cartesian2(33554054, 33746824) | ||
let resolutions = [] | ||
for (let i = 0; i < 19; i++) { | ||
resolutions[i] = 256 * Math.pow(2, 18 - i) | ||
} | ||
this._tilingScheme = new BaiduMercatorTilingScheme({ | ||
rectangleSouthwestInMeters: new Cesium.Cartesian2( | ||
-20037726.37, | ||
-12474104.17 | ||
), | ||
rectangleNortheastInMeters: new Cesium.Cartesian2( | ||
20037726.37, | ||
12474104.17 | ||
), | ||
resolutions, | ||
crs: options.crs || '' | ||
}) | ||
@@ -119,7 +133,5 @@ this._rectangle = this._tilingScheme.rectangle | ||
} | ||
let xTiles = this._tilingScheme.getNumberOfXTilesAtLevel(level) | ||
let yTiles = this._tilingScheme.getNumberOfYTilesAtLevel(level) | ||
let url = this._url | ||
.replace('{x}', x - xTiles / 2) | ||
.replace('{y}', yTiles / 2 - y - 1) | ||
.replace('{x}', String(x)) | ||
.replace('{y}', String(-y)) | ||
.replace('{z}', level) | ||
@@ -126,0 +138,0 @@ .replace('{s}', 1) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63151
22
1055
106
1