@nsc-earth-2/layer 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
- import { TilingScheme, Viewer } from 'cesium';
1
+ import { Terrain, Cesium3DTileset, ImageryLayer, DataSource, TilingScheme, Viewer } from 'cesium';
2
+ import GeoJsonPrimitiveLayer from '@nsc-earth-2/primitive-geojson';
2
3
 
3
4
  type LayerType = 'TERRAIN' | //地形
4
5
  '3DTILES' | //模型
5
- 'ARCGIS' | 'URLTemplate' | 'WMS' | 'WMTS' | //地图服务
6
- 'KML' | 'GEOJSON';
6
+ 'ARCGIS' | 'URLTemplate' | 'Mbtiles' | 'WMS' | 'WMTS' | //地图服务
7
+ 'KML' | 'GEOJSON' | //矢量
8
+ 'SUPERMAP_WMTS';
9
+ type LayerObject = Terrain | Cesium3DTileset | Cesium3DTileset | ImageryLayer | GeoJsonPrimitiveLayer | Promise<DataSource> | DataSource;
7
10
  interface LayerOption {
8
11
  /**
9
12
  * @desc 图层唯一id
@@ -38,7 +41,7 @@ interface LayerOption {
38
41
  */
39
42
  alpha?: number;
40
43
  /**
41
- * @desc arcgis图层的token
44
+ * @desc arcgis图层的token,或者超图的token
42
45
  */
43
46
  token?: string;
44
47
  /**
@@ -95,6 +98,7 @@ declare class Layer {
95
98
  private _remove;
96
99
  private _locate;
97
100
  private _show;
101
+ private _refreshToken;
98
102
  private _id;
99
103
  private _typeClassMap;
100
104
  private _layersMap;
@@ -106,9 +110,14 @@ declare class Layer {
106
110
  */
107
111
  loadAsync(options: LayerOption): Promise<void>;
108
112
  private _isSupport;
113
+ getById(id: string): {
114
+ options: LayerOption;
115
+ layer: LayerObject;
116
+ } | undefined;
109
117
  removeById(id: string): void;
110
118
  locateById(id: string): void;
111
119
  showById(id: string, show: boolean): void;
120
+ refreshToken(id: string, token: string): void;
112
121
  destroy(): void;
113
122
  }
114
123
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{defaultValue as t,Terrain as e,CesiumTerrainProvider as s,EllipsoidTerrainProvider as n,Rectangle as r,Cesium3DTileset as i,Matrix4 as o,Cartographic as a,Cartesian3 as c,Transforms as h,Matrix3 as p,Math as u,ArcGisMapServerImageryProvider as l,ImageryLayer as f,GeographicTilingScheme as d,Ellipsoid as y,UrlTemplateImageryProvider as w,WebMapServiceImageryProvider as I,WebMapTileServiceImageryProvider as m,KmlDataSource as v}from"cesium";import{GeoJsonPrimitiveLayer as g}from"@nsc-earth-2/primitive-geojson";function _(t,e){const s=T();return(_=function(t,e){return s[t-=317]})(t,e)}const E=_;function T(){const t=["then","scene","_viewer","4247665ZsBmLH","load","16kwJOIg","remove","isArray","flyTo","6738543QoZXYo","12gjiIMj","8706bcXLEw","valid_bounds","terrainProvider","6wLlBoL","the layer type is not 'TERRAIN'","102550oOtarO","camera","bounds","817931eCAYJp","fromDegrees","resolve","TERRAIN","652780rmhNzQ","type","length","requestRender","setTerrain","fromUrl","9222690azbRzg","show"];return(T=function(){return t})()}!function(){const t=_,e=T();for(;;)try{if(488924===parseInt(t(321))/1+parseInt(t(325))/2+parseInt(t(344))/3*(-parseInt(t(343))/4)+-parseInt(t(336))/5*(parseInt(t(347))/6)+parseInt(t(318))/7*(parseInt(t(338))/8)+-parseInt(t(342))/9+parseInt(t(331))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class R{constructor(t){this[_(335)]=t}[E(337)](n){const r=E;n=t(n,{});if(t(n[r(326)],void 0)!==r(324))throw new Error(r(317));const i=t(n.url,void 0),o=new e(s[r(330)](i));return this._viewer[r(334)].setTerrain(o),this[r(335)].scene[r(328)](),Promise[r(323)](o)}[E(339)](t){const e=E,s=new n;this[e(335)][e(346)]=s,this._viewer[e(334)].requestRender()}locate(e,s){const n=E;e=t(e,{});const i=t(e.url,void 0);fetch(i+"/layer.json")[n(333)]((t=>t.json()))[n(333)]((t=>{const e=n;t[e(345)]&&Array.isArray(t[e(345)])&&4===t[e(345)][e(327)]?this._viewer[e(319)][e(341)]({destination:r[e(322)](t.valid_bounds[0],t[e(345)][1],t.valid_bounds[2],t[e(345)][3])}):t[e(320)]&&Array[e(340)](t[e(320)])&&4==t.bounds[e(327)]&&this[e(335)][e(319)][e(341)]({destination:r[e(322)](t[e(320)][0],t.bounds[1],t.bounds[2],t[e(320)][3])})}))}[E(332)](t,s){const r=E;if(t instanceof e){if(s)this[r(335)][r(334)][r(329)](t);else{const t=new n;this[r(335)][r(346)]=t}this._viewer[r(334)][r(328)]()}}}function S(){const t=["show","load","the url is needed","altitude","21591GcVWlI","849893KsmJDA","type","flyTo","92CplkQa","latitude","3764hetrfR","remove","_viewer","scene","fromRotationZ","toDegrees","getTranslation","8477rMoFIA","1486816ZBIPFQ","add","fromDegrees","root","eastNorthUpToFixedFrame","multiplyByMatrix3","170949YhiRcu","primitives","370WMEAlE","1110DIvetk","transferTileSet","1236BkNHTS","multiply","fromCartesian","1470CLbRga","toRadians","the layer type is not '3DTILES'","globe","requestRender","azimuth","transform"];return(S=function(){return t})()}const L=M;function M(t,e){const s=S();return(M=function(t,e){return s[t-=334]})(t,e)}!function(){const t=M,e=S();for(;;)try{if(243542===-parseInt(t(342))/1*(-parseInt(t(344))/2)+parseInt(t(358))/3+parseInt(t(363))/4*(parseInt(t(361))/5)+parseInt(t(366))/6*(parseInt(t(351))/7)+-parseInt(t(352))/8+-parseInt(t(338))/9*(parseInt(t(360))/10)+-parseInt(t(339))/11)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class b{constructor(t){this[M(346)]=t}async[L(335)](e){const s=L;e=t(e,{});if("3DTILES"!==t(e[s(340)],void 0))throw new Error(s(368));const n=e.url;if(!n)throw new Error(s(336));const r={longitude:t(e.longitude,0),latitude:t(e[s(343)],0),altitude:t(e[s(337)],0),azimuth:t(e[s(371)],0)},o=await i.fromUrl(n,{dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:.00278,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceErrorHeightFalloff:.25});return this.transferTileSet(o,r),this._viewer.scene[s(359)][s(353)](o),this[s(346)].scene[s(370)](),o}[L(362)](t,e){const s=L,{longitude:n,latitude:r,altitude:i,azimuth:l}=e;let f=new o;if(n&&r){let t=i;0==i&&(t=this[s(346)][s(347)][s(369)].getHeight(a.fromDegrees(n,r))||0);const e=c[s(354)](n,r,t),d=h[s(356)](e),y=new p(1,0,0,0,1,0,0,0,1),w=p[s(348)](u[s(367)](l));p[s(364)](y,w,y),f=o[s(357)](d,y,new o)}else if(i){const e=new c;o[s(350)](t[s(355)][s(372)],e);const n=a[s(365)](e);if(n){const t=u[s(349)](n[s(343)]),e=u.toDegrees(n.longitude),r=c[s(354)](e,t,i),a=h[s(356)](r),d=new p(1,0,0,0,1,0,0,0,1),y=p[s(348)](u[s(367)](l));p.multiply(d,y,d),f=o[s(357)](a,d,new o)}}else if(l){const e=new p(1,0,0,0,1,0,0,0,1),n=p[s(348)](u[s(367)](l));p[s(364)](e,n,e),f=o.multiplyByMatrix3(t[s(355)][s(372)],e,new o)}else f=t.root.transform;t.root.transform=f}[L(345)](t){const e=L;t instanceof i&&(this._viewer[e(347)][e(359)][e(345)](t),this._viewer.scene[e(370)]())}locate(t,e){const s=L;e instanceof i&&this[s(346)][s(341)](e)}[L(334)](t,e){const s=L;t instanceof i&&(t.show=e,this[s(346)][s(347)][s(370)]())}}function D(){const t=["33828960TZsYNi","249304rPeoFh","alpha","locate","348620IrLjED","the layer type is not 'ARCGIS'","readyEvent","fromProviderAsync","remove","288OEmHpV","type","55pDZgvA","897688rlNnqC","isArray","imageryLayers","load","rectangle","addEventListener","requestRender","176262ZpJJyb","fromUrl","8604477UQOXRK","38zxkABD","scene","4866900VykedM","fromDegrees","camera","then","GET","flyTo","show","the url is needed","extent","_viewer"];return(D=function(){return t})()}const A=z;!function(){const t=z,e=D();for(;;)try{if(632968===parseInt(t(195))/1+-parseInt(t(205))/2*(-parseInt(t(202))/3)+parseInt(t(187))/4*(parseInt(t(194))/5)+parseInt(t(207))/6+parseInt(t(204))/7+parseInt(t(184))/8*(-parseInt(t(192))/9)+-parseInt(t(183))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class C{constructor(t){this[z(182)]=t}async[A(198)](e){const s=A;e=t(e,{});if("ARCGIS"!==t(e[s(193)],void 0))throw new Error(s(188));const{url:n,alpha:i,token:o}=e;if(!n)throw new Error(s(180));let a=n;a=o?n+"/info/iteminfo?f=pjson&token="+o:n+"/info/iteminfo?f=pjson";const c=await fetch(a,{method:s(177)})[s(210)]((t=>t.json()))[s(210)]((t=>{const e=s,n={};return o&&(n.token=o),t&&t[e(181)]&&Array[e(196)](t[e(181)])&&(n[e(199)]=r[e(208)](t[e(181)][0][0],t[e(181)][0][1],t[e(181)][1][0],t[e(181)][1][1])),n})),h=l[s(203)](n,c),p=f[s(190)](h,{});return i&&(p[s(185)]=i),this[s(182)][s(197)].add(p),this[s(182)][s(206)][s(201)](),p}async[A(191)](t){const e=A;t instanceof f&&(this._viewer.imageryLayers[e(191)](t,!0),this[e(182)][e(206)][e(201)]())}[A(186)](t,e){const s=A;if(e instanceof f)if(e.ready){const t=e.getImageryRectangle();this[s(182)][s(206)][s(209)][s(178)]({destination:t})}else e[s(189)][s(200)]((t=>{const n=s,r=e.getImageryRectangle();this[n(182)][n(206)][n(209)][n(178)]({destination:r})}))}[A(179)](t,e){const s=A;t instanceof f&&(t.show=e,this[s(182)][s(206)][s(201)]())}}function z(t,e){const s=D();return(z=function(t,e){return s[t-=177]})(t,e)}const j=G;function k(){const t=["scene","_viewer","east","WGS84","camera","bounds","13207851VgTvbc","230766FzUYPt","10AdPYBE","minzoom","the url is needed","remove","6jHUUeW","tilingScheme","maximumLevel","5784vIEZCF","addEventListener","minimumLevel","imageryLayers","getImageryRectangle","readyEvent","alpha","the layer type is not 'URLTemplate'","2162332pspepF","north","tileWidth","fromDegrees","URLTemplate","3759640zDltTt","2773300pnkwjO","3034506UmUZLk","rectangle","10WqigVi","west","type","then","locate","tilesize","proj","{z}/{x}/{y}.png","136961KBOlFv","show","maxzoom","flyTo","tileHeight","7jeVrWD","ready","requestRender"];return(k=function(){return t})()}function G(t,e){const s=k();return(G=function(t,e){return s[t-=122]})(t,e)}!function(){const t=G,e=k();for(;;)try{if(768481===parseInt(t(146))/1*(-parseInt(t(123))/2)+-parseInt(t(151))/3*(parseInt(t(162))/4)+-parseInt(t(168))/5+-parseInt(t(169))/6+-parseInt(t(136))/7*(parseInt(t(167))/8)+-parseInt(t(145))/9*(parseInt(t(147))/10)+-parseInt(t(131))/11*(-parseInt(t(154))/12))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class O{constructor(t){this[G(140)]=t}async load(e){const s=G;e=t(e,{});if(t(e[s(125)],void 0)!==s(166))throw new Error(s(161));const{url:n,alpha:i}=e;if(!n)throw new Error(s(149));let o=s(130),a=n.substr(0,n.indexOf(o))+"meta.json";const c=await fetch(a,{method:"GET"})[s(126)]((t=>t.json()))[s(126)]((t=>{const e=s,i={url:n};return t&&t[e(144)]&&(i[e(122)]=r[e(165)](t[e(144)][e(124)],t[e(144)].south,t[e(144)][e(141)],t.bounds[e(163)])),t&&4326==t[e(129)]&&(i[e(152)]=new d({ellipsoid:y[e(142)]})),t&&t[e(133)]&&(i[e(153)]=t[e(133)]),t&&t[e(148)]&&(i[e(156)]=t[e(148)]),t&&t[e(128)]&&(i[e(164)]=i[e(135)]=t[e(128)]),i})),h=new w(c),p=new f(h,{});return i&&(p[s(160)]=i),this._viewer[s(157)].add(p),this[s(140)][s(139)].requestRender(),p}async remove(t){const e=G;t instanceof f&&(this[e(140)].imageryLayers[e(150)](t,!0),this[e(140)][e(139)][e(138)]())}[j(127)](t,e){const s=j;if(e instanceof f)if(e[s(137)]){const t=e.getImageryRectangle();this[s(140)][s(139)][s(143)][s(134)]({destination:t})}else e[s(159)][s(155)]((t=>{const n=s,r=e[n(158)]();this[n(140)][n(139)][n(143)][n(134)]({destination:r})}))}[j(132)](t,e){const s=j;t instanceof f&&(t[s(132)]=e,this[s(140)][s(139)][s(138)]())}}function Z(t,e){const s=W();return(Z=function(t,e){return s[t-=469]})(t,e)}const x=Z;function W(){const t=["692868jMmhZV","type","287612gnHYuO","165760eGZurA","3216168jiWLxF","flyTo","706657dzjcvk","requestRender","_viewer","scene","the layer type is not 'GEOJSON'","show","8KOxSYF","998895WVZizb","primitives","locate","load","primitiveCollection","3ZqCbIA","778380zUnScy"];return(W=function(){return t})()}!function(){const t=Z,e=W();for(;;)try{if(190101===-parseInt(t(475))/1+-parseInt(t(474))/2+-parseInt(t(470))/3*(-parseInt(t(472))/4)+parseInt(t(485))/5+-parseInt(t(471))/6+-parseInt(t(478))/7*(parseInt(t(484))/8)+parseInt(t(476))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class N{constructor(t){this[Z(480)]=t}async load(e){const s=Z;e=t(e,{});if("GEOJSON"!==t(e[s(473)],void 0))throw new Error(s(482));const{url:n,clampToGround:r}=e;if(!n)throw new Error("the url is needed");const i=new g({options:{useGroundGeometry:r??!1,clampToGround:r??!1,scene:this[s(480)][s(481)]}});return await i[s(488)](n),this[s(480)][s(481)].primitives.add(i[s(469)]),this[s(480)][s(481)][s(479)](),i}async remove(t){const e=Z;t instanceof g&&(this._viewer[e(481)][e(486)].remove(t[e(469)]),this[e(480)][e(481)][e(479)]())}[x(487)](t,e){const s=x;e instanceof g&&e[s(477)](this[s(480)],{tolerance:.015})}[x(483)](t,e){const s=x;t instanceof g&&(t.primitiveCollection.show=e,this[s(480)][s(481)][s(479)]())}}const q=F;function P(){const t=["locate","remove","ready","621860MnDSqe","354459tMzWIw","1564GLubhT","975246peFdCH","camera","the layers is needed","getImageryRectangle","addEventListener","81462bMJshQ","10HaLNas","requestRender","imageryLayers","3108opESuj","23736jLZlwF","933008wTyZKO","scene","add","81PTDWVw","readyEvent","show","flyTo","load","_viewer"];return(P=function(){return t})()}function F(t,e){const s=P();return(F=function(t,e){return s[t-=172]})(t,e)}!function(){const t=F,e=P();for(;;)try{if(258974===-parseInt(t(191))/1+-parseInt(t(181))/2+parseInt(t(190))/3*(parseInt(t(180))/4)+-parseInt(t(187))/5*(parseInt(t(186))/6)+-parseInt(t(179))/7+-parseInt(t(192))/8+parseInt(t(195))/9*(parseInt(t(178))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class U{constructor(t){this[F(174)]=t}async[q(173)](e){const s=q;e=t(e,{});if("WMS"!==t(e.type,void 0))throw new Error("the layer type is not 'WMS'");const{url:n,layers:r}=e;if(!n)throw new Error("the url is needed");if(!r)throw new Error(s(183));const i=new I({url:n}),o=new f(i,{});return this._viewer[s(189)][s(194)](o),this._viewer[s(193)][s(188)](),o}async[q(176)](t){const e=q;t instanceof f&&(this._viewer[e(189)][e(176)](t,!0),this[e(174)][e(193)][e(188)]())}[q(175)](t,e){const s=q;if(e instanceof f)if(e[s(177)]){const t=e.getImageryRectangle();this[s(174)][s(193)][s(182)].flyTo({destination:t})}else e[s(196)][s(185)]((t=>{const n=s,r=e[n(184)]();this._viewer[n(193)][n(182)][n(172)]({destination:r})}))}[q(197)](t,e){const s=q;t instanceof f&&(t[s(197)]=e,this[s(174)][s(193)][s(188)]())}}const B=J;function J(t,e){const s=V();return(J=function(t,e){return s[t-=266]})(t,e)}!function(){const t=J,e=V();for(;;)try{if(508806===-parseInt(t(273))/1*(parseInt(t(270))/2)+parseInt(t(277))/3+parseInt(t(281))/4+parseInt(t(268))/5*(-parseInt(t(290))/6)+parseInt(t(280))/7*(parseInt(t(266))/8)+-parseInt(t(291))/9+-parseInt(t(272))/10*(parseInt(t(285))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class K{constructor(t){this[J(278)]=t}async[B(288)](e){const s=B;e=t(e,{});if(t(e.type,void 0)!==s(275))throw new Error(s(267));const{url:n,layer:r,style:i,tileMatrixSetID:o,subdomains:a,format:c,tilingScheme:h,tileMatrixLabels:p}=e;if(!n)throw new Error("the url is needed");if(!r)throw new Error(s(286));if(!i)throw new Error("the style is needed");if(!o)throw new Error("the tileMatrixSetID is needed");const u={url:n,layer:r,style:i,tileMatrixSetID:o};a&&(u[s(293)]=a),c&&(u[s(292)]=c),h&&(u[s(269)]=h),p&&(u.tileMatrixLabels=p);const l=new m(u),d=new f(l,{});return this[s(278)].imageryLayers[s(294)](d),this[s(278)][s(276)].requestRender(),d}async[B(282)](t){const e=B;t instanceof f&&(this[e(278)].imageryLayers[e(282)](t,!0),this[e(278)][e(276)].requestRender())}[B(271)](t,e){const s=B;if(e instanceof f)if(e.ready){const t=e.getImageryRectangle();this[s(278)][s(276)][s(279)][s(287)]({destination:t})}else e[s(289)].addEventListener((t=>{const n=s,r=e[n(274)]();this[n(278)].scene[n(279)][n(287)]({destination:r})}))}[B(284)](t,e){const s=B;t instanceof f&&(t[s(284)]=e,this[s(278)][s(276)][s(283)]())}}function V(){const t=["show","11rshziB","the layer is needed","flyTo","load","readyEvent","648STxKxu","514269DMLSvg","format","subdomains","add","1811720JWmRdm","the layer type is not 'WMTS'","13215gzhuho","tilingScheme","70388fzuMoo","locate","1499240PGIhRQ","22UzoRTY","getImageryRectangle","WMTS","scene","675390pyVDvD","_viewer","camera","21JGVuDg","3484232yAOXhM","remove","requestRender"];return(V=function(){return t})()}const Q=H;function H(t,e){const s=X();return(H=function(t,e){return s[t-=396]})(t,e)}!function(){const t=H,e=X();for(;;)try{if(947449===parseInt(t(418))/1+-parseInt(t(399))/2*(-parseInt(t(404))/3)+parseInt(t(416))/4+-parseInt(t(407))/5*(parseInt(t(413))/6)+-parseInt(t(421))/7+parseInt(t(420))/8*(-parseInt(t(406))/9)+-parseInt(t(397))/10*(parseInt(t(417))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class Y{constructor(t){this[H(398)]=t}async[Q(400)](e){const s=Q;e=t(e,{});const n=t(e[s(419)],void 0);if(n!==s(414)&&"KMZ"!==n)throw new Error(s(411));const{url:r,clampToGround:i}=e;if(!r)throw new Error(s(405));return this[s(398)][s(412)][s(409)](v[s(400)](r,{camera:this._viewer[s(410)][s(401)],canvas:this._viewer.scene.canvas,clampToGround:i??!1}))}async[Q(408)](t){const e=Q;t instanceof Promise&&t[e(396)]((t=>{const s=e;this[s(398)].dataSources[s(408)](t),this[s(398)][s(410)][s(403)]()})),t instanceof v&&(this._viewer[e(412)][e(408)](t),this._viewer[e(410)][e(403)]())}locate(t,e){const s=Q;e instanceof Promise&&e.then((t=>{const e=H;this[e(398)][e(402)](t)})),e instanceof v&&this[s(398)].flyTo(e)}[Q(415)](t,e){const s=Q;t instanceof Promise&&t[s(396)]((t=>{const n=s;t[n(415)]=e,this[n(398)].scene[n(403)]()})),t instanceof v&&(t[s(415)]=e,this[s(398)].scene[s(403)]())}}function X(){const t=["remove","add","scene","the layer type is not 'KML' or 'KMZ","dataSources","6ntrcDv","KML","show","3486448TjiPlL","11BTJqgH","1610871QQgisX","type","16VhicZA","6358765mYchdf","then","9781510KXCKkQ","_viewer","2jDuNzD","load","camera","flyTo","requestRender","2855409vbDlXb","the url is needed","191313zyjfOr","2788885APMJHN"];return(X=function(){return t})()}const $=et;function tt(){const t=["_load","_typeClassMap","_locate","get","load","showById","_type","_layersMap","4kGdZtp","KML","775960fpgiZf","3055980QUlRBG","WMTS","loadAsync","457493XPtQOg","bind","3DTILES","_remove","_url","2439944cJjvFa","remove","_viewer","_id","384651PVXCzm","656274ccKCNE","destroy","104NeDzdk","3453968olQEWS","locate","the layer with id '","请输入Viewer对象!","url","set","removeById","URLTemplate","' is already loaded","_show","_isSupport","the type '","includes","TERRAIN","_initLoader","show","type","WMS","_typeClass","delete","ARCGIS","the url is needed"];return(tt=function(){return t})()}function et(t,e){const s=tt();return(et=function(t,e){return s[t-=348]})(t,e)}!function(){const t=et,e=tt();for(;;)try{if(338008===parseInt(t(377))/1+-parseInt(t(371))/2*(parseInt(t(387))/3)+parseInt(t(382))/4+parseInt(t(373))/5+-parseInt(t(374))/6+-parseInt(t(390))/7+parseInt(t(389))/8*(parseInt(t(386))/9))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class st{constructor(t){const e=et;if(!t)throw new Error(e(393));this[e(384)]=t,this[e(370)]=new Map,this._typeClassMap=new Map}[$(355)](){const t=$,e=this._typeClassMap[t(366)](this[t(369)]);e?this._typeClass=e:(this[t(369)]===t(354)?this[t(359)]=new R(this[t(384)]):this._type===t(379)?this[t(359)]=new b(this[t(384)]):this[t(369)]===t(361)?this._typeClass=new C(this._viewer):this[t(369)]===t(348)?this[t(359)]=new O(this._viewer):this[t(369)]===t(358)?this._typeClass=new U(this[t(384)]):this[t(369)]===t(375)?this[t(359)]=new K(this[t(384)]):this[t(369)]===t(372)?this._typeClass=new Y(this[t(384)]):"GEOJSON"===this[t(369)]&&(this[t(359)]=new N(this[t(384)])),this[t(364)].set(this[t(369)],this[t(359)])),this._load=this[t(359)][t(367)][t(378)](this[t(359)]),this[t(380)]=this[t(359)][t(383)].bind(this._typeClass),this[t(365)]=this[t(359)][t(391)][t(378)](this[t(359)]),this[t(350)]=this[t(359)][t(356)].bind(this._typeClass)}async[$(376)](e){const s=$;if(e=t(e,{}),this[s(385)]=t(e.id,void 0),this[s(370)].has(this[s(385)]))throw new Error(s(392)+this[s(385)]+s(349));if(this[s(381)]=t(e[s(394)],void 0),!this._url)throw new Error(s(362));if(this[s(369)]=t(e[s(357)],void 0),!this[s(351)](e.type))throw new Error(s(352)+e[s(357)]+"' is not support");if(this._initLoader(),"KML"===e[s(357)]){const t=this._load(e);t instanceof Promise&&this[s(370)][s(395)](e.id,{options:e,layer:t})}else{const t=await this[s(363)](e);this._layersMap[s(395)](e.id,{options:e,layer:t})}}[$(351)](t){const e=$;return["TERRAIN",e(379),e(361),e(348),e(358),e(375),e(372),"GEOJSON"][e(353)](t)}[$(396)](t){const e=$,s=this._layersMap[e(366)](t);if(this[e(370)][e(360)](t),!s)return;const{options:n,layer:r}=s;r&&(this._type=n.type,this[e(355)](),this[e(380)](r))}locateById(t){const e=$,s=this._layersMap[e(366)](t);if(!s)return;const{options:n,layer:r}=s;r&&(this._type=n.type,this[e(355)](),this._locate(n,r))}[$(368)](t,e){const s=$,n=this[s(370)].get(t);if(!n)return;const{options:r,layer:i}=n;i&&(this._type=r[s(357)],this[s(355)](),this[s(350)](i,e))}[$(388)](){}}export{st as default};
1
+ import{Terrain as e,CesiumTerrainProvider as t,EllipsoidTerrainProvider as n,Rectangle as s,Cesium3DTileset as r,Matrix4 as i,Cartographic as o,Cartesian3 as a,Transforms as c,Matrix3 as h,Math as l,ArcGisMapServerImageryProvider as u,ImageryLayer as f,GeographicTilingScheme as p,Ellipsoid as d,UrlTemplateImageryProvider as y,defaultValue as w,WebMapServiceImageryProvider as m,WebMapTileServiceImageryProvider as I,KmlDataSource as v,WebMercatorTilingScheme as g}from"cesium";import{GeoJsonPrimitiveLayer as _}from"@nsc-earth-2/primitive-geojson";const E=M;!function(){const e=M,t=T();for(;;)try{if(824363===parseInt(e(343))/1*(parseInt(e(356))/2)+-parseInt(e(337))/3*(parseInt(e(360))/4)+-parseInt(e(355))/5*(-parseInt(e(335))/6)+parseInt(e(340))/7*(-parseInt(e(368))/8)+-parseInt(e(342))/9*(parseInt(e(358))/10)+parseInt(e(336))/11*(parseInt(e(371))/12)+-parseInt(e(357))/13)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class S{constructor(e){this[M(361)]=e}[E(347)](n){const s=E;if((n=n??{})[s(364)]!==s(348))throw new Error(s(365));const r=n[s(345)],i=new e(t[s(352)](r));return this[s(361)][s(349)][s(350)](i),this[s(361)].scene[s(359)](),Promise[s(338)](i)}[E(367)](e){const t=E,s=new n;this[t(361)][t(362)]=s,this[t(361)].scene.requestRender()}[E(353)](e,t){const n=E,r=(e=e??{})[n(345)];fetch(r+n(370))[n(351)]((e=>e[n(363)]())).then((e=>{const t=n;e[t(346)]&&Array.isArray(e[t(346)])&&4===e[t(346)][t(369)]?this[t(361)][t(339)][t(341)]({destination:s[t(354)](e.valid_bounds[0],e[t(346)][1],e[t(346)][2],e.valid_bounds[3])}):e[t(344)]&&Array[t(366)](e.bounds)&&4==e.bounds.length&&this[t(361)][t(339)][t(341)]({destination:s[t(354)](e[t(344)][0],e[t(344)][1],e[t(344)][2],e[t(344)][3])})}))}show(t,s){const r=E;if(t instanceof e){if(s)this._viewer.scene[r(350)](t);else{const e=new n;this._viewer[r(362)]=e}this._viewer[r(349)].requestRender()}}}function T(){const e=["1408lOdukE","15TILfNL","resolve","camera","4613QvKHpa","flyTo","64953OPhvtt","26juileJ","bounds","url","valid_bounds","load","TERRAIN","scene","setTerrain","then","fromUrl","locate","fromDegrees","4748060lnYiaM","57902gDgzZf","841776rXugrg","120ZjxKIC","requestRender","656836IJOMSp","_viewer","terrainProvider","json","type","the layer type is not 'TERRAIN'","isArray","remove","2064xZzXXi","length","/layer.json","24792JWmlWE","6CIQgbV"];return(T=function(){return e})()}function M(e,t){const n=T();return(M=function(e,t){return n[e-=335]})(e,t)}const R=b;function b(e,t){const n=x();return(b=function(e,t){return n[e-=176]})(e,t)}function x(){const e=["multiply","2298376xHbMdF","primitives","transform","36bQLwrg","331509daaAVq","the layer type is not '3DTILES'","the url is needed","245362DAErvI","remove","fromUrl","altitude","load","scene","1560kfrfzJ","_viewer","longitude","fromDegrees","flyTo","multiplyByMatrix3","13128hGBAVx","9wsgeOM","73254CzOADX","getHeight","show","azimuth","transferTileSet","root","fromCartesian","type","toDegrees","requestRender","3DTILES","toRadians","fromRotationZ","url","add","eastNorthUpToFixedFrame","globe","4037075CHvhZO","latitude","55550AOryJh","95lRRSYz","locate"];return(x=function(){return e})()}!function(){const e=b,t=x();for(;;)try{if(679636===parseInt(e(179))/1+parseInt(e(182))/2*(parseInt(e(195))/3)+-parseInt(e(194))/4+-parseInt(e(216))/5*(parseInt(e(196))/6)+parseInt(e(213))/7+parseInt(e(219))/8*(-parseInt(e(178))/9)+parseInt(e(188))/10*(parseInt(e(215))/11))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class L{constructor(e){this[b(189)]=e}async[R(186)](e){const t=R;if((e=e??{})[t(203)]!==t(206))throw new Error(t(180));const n=e[t(209)];if(!n)throw new Error(t(181));const s={longitude:e[t(190)]??0,latitude:e[t(214)]??0,altitude:e[t(185)]??0,azimuth:e[t(199)]??0},i=await r[t(184)](n,{dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:.00278,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceErrorHeightFalloff:.25});return this[t(200)](i,s),this[t(189)][t(187)][t(176)][t(210)](i),this[t(189)].scene[t(205)](),i}transferTileSet(e,t){const n=R,{longitude:s,latitude:r,altitude:u,azimuth:f}=t;let p=new i;if(s&&r){let e=u;0==u&&(e=this[n(189)].scene[n(212)][n(197)](o[n(191)](s,r))||0);const t=a[n(191)](s,r,e),d=c[n(211)](t),y=new h(1,0,0,0,1,0,0,0,1),w=h[n(208)](l.toRadians(f));h[n(218)](y,w,y),p=i.multiplyByMatrix3(d,y,new i)}else if(u){const t=new a;i.getTranslation(e[n(201)][n(177)],t);const s=o[n(202)](t);if(s){const e=l[n(204)](s[n(214)]),t=l[n(204)](s.longitude),r=a[n(191)](t,e,u),o=c[n(211)](r),d=new h(1,0,0,0,1,0,0,0,1),y=h[n(208)](l[n(207)](f));h.multiply(d,y,d),p=i[n(193)](o,d,new i)}}else if(f){const t=new h(1,0,0,0,1,0,0,0,1),s=h[n(208)](l[n(207)](f));h[n(218)](t,s,t),p=i[n(193)](e[n(201)][n(177)],t,new i)}else p=e.root[n(177)];e[n(201)][n(177)]=p}[R(183)](e){const t=R;e instanceof r&&(this[t(189)][t(187)][t(176)].remove(e),this[t(189)][t(187)][t(205)]())}[R(217)](e,t){const n=R;t instanceof r&&this[n(189)][n(192)](t)}[R(198)](e,t){const n=R;e instanceof r&&(e[n(198)]=t,this[n(189)][n(187)][n(205)]())}}const C=k;function k(e,t){const n=q();return(k=function(e,t){return n[e-=263]})(e,t)}function q(){const e=["fromUrl","alpha","isArray","type","18inCKbN","getImageryRectangle","extent","remove","1255624SLlHkY","7PRQbcf","token","ready","/info/iteminfo?f=pjson&token=","_viewer","camera","fromProviderAsync","795WSvScM","ARCGIS","rectangle","requestRender","300sFVuJS","load","json","then","2904054lzfxIv","flyTo","448195wvKqaR","imageryLayers","scene","366908PjvXkZ","the url is needed","show","addEventListener","1549415MApdtS","12390180vXzysu","add","locate"];return(q=function(){return e})()}!function(){const e=k,t=q();for(;;)try{if(354768===-parseInt(e(270))/1+parseInt(e(264))/2*(-parseInt(e(297))/3)+parseInt(e(273))/4+parseInt(e(277))/5+parseInt(e(268))/6*(-parseInt(e(290))/7)+parseInt(e(289))/8*(-parseInt(e(285))/9)+parseInt(e(278))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class A{constructor(e){this[k(294)]=e}async[C(265)](e){const t=C;if((e=e??{})[t(284)]!==t(298))throw new Error("the layer type is not 'ARCGIS'");const{url:n,alpha:r,token:i}=e;if(!n)throw new Error(t(274));let o=n;o=i?n+t(293)+i:n+"/info/iteminfo?f=pjson";const a=await fetch(o,{method:"GET"}).then((e=>e[t(266)]()))[t(267)]((e=>{const n=t,r={};return i&&(r[n(291)]=i),e&&e[n(287)]&&Array[n(283)](e[n(287)])&&(r[n(299)]=s.fromDegrees(e.extent[0][0],e[n(287)][0][1],e.extent[1][0],e[n(287)][1][1])),r})),c=u[t(281)](n,a),h=f[t(296)](c,{});return r&&(h[t(282)]=r),this[t(294)][t(271)][t(279)](h),this[t(294)][t(272)][t(263)](),h}async[C(288)](e){const t=C;e instanceof f&&(this[t(294)][t(271)][t(288)](e,!0),this[t(294)].scene[t(263)]())}[C(280)](e,t){const n=C;if(t instanceof f)if(t[n(292)]){const e=t[n(286)]();this[n(294)].scene[n(295)][n(269)]({destination:e})}else t.readyEvent[n(276)]((e=>{const s=n,r=t.getImageryRectangle();this._viewer[s(272)][s(295)].flyTo({destination:r})}))}[C(275)](e,t){const n=C;e instanceof f&&(e[n(275)]=t,this[n(294)][n(272)][n(263)]())}}function W(e,t){const n=P();return(W=function(e,t){return n[e-=302]})(e,t)}const j=W;function P(){const e=["367396UmYedK","bounds","camera","alpha","west","URLTemplate","meta.json fetch failed:","rectangle","json","scene","imageryLayers","locate","tilingScheme","tileHeight","minzoom","WGS84","getImageryRectangle","maxzoom","east","addEventListener","requestRender","fromDegrees","ready","type","show","{z}/{x}/{y}.png","add","north","5696551rgPzRo","2798874SkqZYD","proj","the layer type is not 'URLTemplate'","maximumLevel","south","106941epIFFb","flyTo","110146DDuxUT","remove","load","_viewer","1506790BVKLGP","1358255eYjtvZ","includes","the url is needed"];return(P=function(){return e})()}!function(){const e=W,t=P();for(;;)try{if(492868===parseInt(e(324))/1+-parseInt(e(328))/2+parseInt(e(322))/3+parseInt(e(332))/4+-parseInt(e(329))/5+parseInt(e(317))/6+parseInt(e(316))/7)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class z{constructor(e){this[W(327)]=e}async[j(326)](e){const t=j;if((e=e??{})[t(311)]!==t(337))throw new Error(t(319));const{url:n,alpha:r}=e;if(!n)throw new Error(t(331));const i=t(313),o=n[t(330)](i)?n.substring(0,n.indexOf(i))+"meta.json":null,a=o?await async function(e){const t=W;try{const n=await fetch(e,{method:"GET"});return n.ok?await n[t(340)]():null}catch(n){return console.warn(t(338),e),null}}(o):null,c={url:n};(null==a?void 0:a.bounds)&&(c[t(339)]=s[t(309)](a[t(333)][t(336)],a.bounds[t(321)],a[t(333)][t(306)],a[t(333)][t(315)])),4326===(null==a?void 0:a[t(318)])&&(c[t(344)]=new p({ellipsoid:d[t(303)]})),null!=(null==a?void 0:a.maxzoom)&&(c[t(320)]=a[t(305)]),null!=(null==a?void 0:a[t(302)])&&(c.minimumLevel=a[t(302)]),(null==a?void 0:a.tilesize)&&(c.tileWidth=c[t(345)]=a.tilesize);const h=new y(c),l=new f(h,{});return r&&(l[t(335)]=r),this[t(327)][t(342)][t(314)](l),this[t(327)][t(341)].requestRender(),l}async[j(325)](e){const t=j;e instanceof f&&(this._viewer.imageryLayers.remove(e,!0),this._viewer[t(341)][t(308)]())}[j(343)](e,t){const n=j;if(t instanceof f)if(t[n(310)]){const e=t[n(304)]();this[n(327)].scene[n(334)][n(323)]({destination:e})}else t.readyEvent[n(307)]((e=>{const s=n,r=t[s(304)]();this._viewer[s(341)].camera.flyTo({destination:r})}))}[j(312)](e,t){const n=j;e instanceof f&&(e[n(312)]=t,this[n(327)][n(341)][n(308)]())}}const D=G;function G(e,t){const n=U();return(G=function(e,t){return n[e-=256]})(e,t)}function U(){const e=["flyTo","alpha","maximumLevel","minimumLevel","scene","1031675FGajqe","tilingScheme","tilesize","1754184ccqNOs","camera","7559419RqJSZp",".json","maxzoom","then","410430lhjBPm","2247384HDCsST","proj","readyEvent","show","type","getImageryRectangle","_viewer","ready","/{z}/{x}/{y}.png","the layer type is not 'Mbtiles'","tileHeight","bounds","json","628gHeUxK","the url is needed","load","add","5523WuvwwQ","imageryLayers","minzoom","22036130daQldT","requestRender","locate","remove","9wwuVul","70sHKWIk","rectangle","substr","addEventListener"];return(U=function(){return e})()}!function(){const e=G,t=U();for(;;)try{if(582311===parseInt(e(261))/1+parseInt(e(271))/2+parseInt(e(288))/3*(parseInt(e(284))/4)+parseInt(e(296))/5*(-parseInt(e(270))/6)+parseInt(e(266))/7+parseInt(e(264))/8+parseInt(e(295))/9*(-parseInt(e(291))/10))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class N{constructor(e){this._viewer=e}async[D(286)](e){const t=D;e=w(e,{});if("Mbtiles"!==w(e[t(275)],void 0))throw new Error(t(280));const{url:n,alpha:r}=e;if(!n)throw new Error(t(285));let i=t(279),o=n[t(298)](0,n.indexOf(i))+t(267);const a=await fetch(o,{method:"GET"})[t(269)]((e=>e[t(283)]())).then((e=>{const r=t,i={url:n};return e&&e[r(282)]&&(i[r(297)]=s.fromDegrees(e[r(282)][0],e[r(282)][1],e[r(282)][2],e[r(282)][2])),e&&4326==e[r(272)]&&(i[r(262)]=new p({ellipsoid:d.WGS84})),e&&e[r(268)]&&(i[r(258)]=e.maxzoom),e&&e[r(290)]&&(i[r(259)]=e[r(290)]),e&&e[r(263)]&&(i.tileWidth=i[r(281)]=e[r(263)]),i})),c=new y(a),h=new f(c,{});return r&&(h[t(257)]=r),this[t(277)][t(289)][t(287)](h),this[t(277)][t(260)][t(292)](),h}async[D(294)](e){const t=D;e instanceof f&&(this._viewer[t(289)][t(294)](e,!0),this._viewer.scene[t(292)]())}[D(293)](e,t){const n=D;if(t instanceof f)if(t[n(278)]){const e=t[n(276)]();this._viewer[n(260)][n(265)][n(256)]({destination:e})}else t[n(273)][n(299)]((e=>{const s=n,r=t[s(276)]();this[s(277)].scene.camera[s(256)]({destination:r})}))}[D(274)](e,t){const n=D;e instanceof f&&(e.show=t,this._viewer.scene[n(292)]())}}const O=B;function B(e,t){const n=K();return(B=function(e,t){return n[e-=302]})(e,t)}!function(){const e=B,t=K();for(;;)try{if(825688===parseInt(e(307))/1+-parseInt(e(316))/2*(-parseInt(e(314))/3)+parseInt(e(306))/4+-parseInt(e(311))/5+parseInt(e(319))/6+parseInt(e(322))/7+-parseInt(e(308))/8*(parseInt(e(302))/9))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class Z{constructor(e){this._viewer=e}async load(e){const t=B;if("GEOJSON"!==(e=e??{})[t(309)])throw new Error(t(321));const{url:n,clampToGround:s}=e;if(!n)throw new Error(t(313));const r=new _({options:{useGroundGeometry:s??!1,clampToGround:s??!1,scene:this[t(312)][t(320)]}});return await r.load(n),this[t(312)][t(320)][t(303)][t(310)](r[t(305)]),this[t(312)][t(320)][t(317)](),r}async remove(e){const t=B;e instanceof _&&(this[t(312)][t(320)].primitives.remove(e.primitiveCollection),this[t(312)][t(320)][t(317)]())}[O(304)](e,t){const n=O;t instanceof _&&t[n(318)](this[n(312)],{tolerance:.015})}show(e,t){const n=O;e instanceof _&&(e[n(305)][n(315)]=t,this[n(312)][n(320)][n(317)]())}}function K(){const e=["9BkLtwa","primitives","locate","primitiveCollection","5112652bwqcFE","1239233oEQlJr","29711752pBaWHq","type","add","1229090YHkvgm","_viewer","the url is needed","6234PTZrAi","show","430UToZzR","requestRender","flyTo","2743464zCfQtn","scene","the layer type is not 'GEOJSON'","9548455ZAKqQc"];return(K=function(){return e})()}const H=F;function F(e,t){const n=J();return(F=function(e,t){return n[e-=178]})(e,t)}!function(){const e=F,t=J();for(;;)try{if(394976===-parseInt(e(189))/1*(-parseInt(e(190))/2)+parseInt(e(193))/3+parseInt(e(178))/4+parseInt(e(186))/5*(-parseInt(e(181))/6)+-parseInt(e(205))/7+-parseInt(e(191))/8*(parseInt(e(184))/9)+-parseInt(e(199))/10*(-parseInt(e(200))/11))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class Q{constructor(e){this._viewer=e}async[H(185)](e){const t=H;if((e=e??{})[t(188)]!==t(195))throw new Error(t(187));const{url:n,layers:s}=e;if(!n)throw new Error(t(197));if(!s)throw new Error(t(192));const r=new m(e),i=new f(r,{});return this._viewer.imageryLayers.add(i),this._viewer[t(198)].requestRender(),i}async[H(203)](e){const t=H;e instanceof f&&(this[t(180)][t(179)][t(203)](e,!0),this[t(180)][t(198)].requestRender())}[H(182)](e,t){const n=H;if(t instanceof f)if(t[n(183)]){const e=t[n(206)]();this[n(180)].scene.camera.flyTo({destination:e})}else t[n(194)][n(204)]((e=>{const s=n,r=t[s(206)]();this[s(180)][s(198)][s(196)][s(201)]({destination:r})}))}[H(202)](e,t){const n=H;e instanceof f&&(e[n(202)]=t,this[n(180)].scene.requestRender())}}function J(){const e=["1106842CcaxGW","flyTo","show","remove","addEventListener","1186556AoSVhW","getImageryRectangle","2601528qUIJxK","imageryLayers","_viewer","1548930ZgQPdj","locate","ready","126jtTqyn","load","15jPJFfl","the layer type is not 'WMS'","type","1AOBlDY","676394QUWazg","176744xREAvT","the layers is needed","167820nAbfwu","readyEvent","WMS","camera","the url is needed","scene","60WNtBjW"];return(J=function(){return e})()}function V(){const e=["format","the layer type is not 'WMTS'","3013846Wtjwjl","3USyFFM","getImageryRectangle","addEventListener","flyTo","24URMgOx","898PCkrsL","requestRender","show","readyEvent","add","1276372Tdikja","the style is needed","tileMatrixLabels","677eMjvse","scene","2197296fKWUOM","_viewer","83040hZhXbw","761082knKyZH","2007yfKYAv","the layer is needed","the url is needed","camera","subdomains","2600uBVEuo","80JQNzwd","ready","the tileMatrixSetID is needed"];return(V=function(){return e})()}function Y(e,t){const n=V();return(Y=function(e,t){return n[e-=141]})(e,t)}!function(){const e=Y,t=V();for(;;)try{if(163624===-parseInt(e(143))/1*(parseInt(e(166))/2)+-parseInt(e(161))/3*(-parseInt(e(171))/4)+-parseInt(e(155))/5*(-parseInt(e(147))/6)+parseInt(e(148))/7*(parseInt(e(165))/8)+-parseInt(e(149))/9*(-parseInt(e(154))/10)+-parseInt(e(160))/11+-parseInt(e(145))/12)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class X{constructor(e){this._viewer=e}async load(e){const t=Y;if("WMTS"!==(e=e??{}).type)throw new Error(t(159));const{url:n,layer:s,style:r,tileMatrixSetID:i,subdomains:o,format:a,tilingScheme:c,tileMatrixLabels:h}=e;if(!n)throw new Error(t(151));if(!s)throw new Error(t(150));if(!r)throw new Error(t(141));if(!i)throw new Error(t(157));const l={url:n,layer:s,style:r,tileMatrixSetID:i};o&&(l[t(153)]=o),a&&(l[t(158)]=a),c&&(l.tilingScheme=c),h&&(l[t(142)]=h);const u=new I(l),p=new f(u,{});return this[t(146)].imageryLayers[t(170)](p),this._viewer[t(144)].requestRender(),p}async remove(e){e instanceof f&&(this._viewer.imageryLayers.remove(e,!0),this._viewer.scene.requestRender())}locate(e,t){const n=Y;if(t instanceof f)if(t[n(156)]){const e=t[n(162)]();this[n(146)][n(144)][n(152)][n(164)]({destination:e})}else t[n(169)][n(163)]((e=>{const s=n,r=t[s(162)]();this[s(146)][s(144)][s(152)][s(164)]({destination:r})}))}show(e,t){const n=Y;e instanceof f&&(e[n(168)]=t,this._viewer[n(144)][n(167)]())}}function $(e,t){const n=te();return($=function(e,t){return n[e-=286]})(e,t)}const ee=$;function te(){const e=["camera","flyTo","scene","the url is needed","4NKBBgH","then","show","739560xGBKcN","dataSources","KMZ","5888780nnUzFZ","load","requestRender","2XaiUYk","2416527MpEFrV","type","16492lrfHqm","9vUvrGQ","720503PXAJlf","4552EvYgZj","add","4113465lXwnzw","19581496CXStcc","canvas","_viewer","locate","remove"];return(te=function(){return e})()}!function(){const e=$,t=te();for(;;)try{if(711641===-parseInt(e(292))/1*(-parseInt(e(287))/2)+parseInt(e(288))/3*(-parseInt(e(305))/4)+parseInt(e(295))/5+parseInt(e(308))/6+parseInt(e(290))/7*(-parseInt(e(293))/8)+parseInt(e(291))/9*(-parseInt(e(311))/10)+parseInt(e(296))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class ne{constructor(e){this._viewer=e}async[ee(312)](e){const t=ee,n=(e=e??{})[t(289)];if("KML"!==n&&n!==t(310))throw new Error("the layer type is not 'KML' or 'KMZ");const{url:s,clampToGround:r}=e;if(!s)throw new Error(t(304));return this[t(298)].dataSources[t(294)](v.load(s,{camera:this[t(298)][t(303)][t(301)],canvas:this[t(298)][t(303)][t(297)],clampToGround:r??!1}))}async remove(e){const t=ee;(null==e?void 0:e[t(306)])&&e.then((e=>{const n=t;this[n(298)][n(309)][n(300)](e),this[n(298)].scene[n(286)]()})),e instanceof v&&(this._viewer[t(309)][t(300)](e),this[t(298)].scene[t(286)]())}[ee(299)](e,t){const n=ee;(null==t?void 0:t[n(306)])&&t.then((e=>{const t=n;this[t(298)][t(302)](e)})),t instanceof v&&this[n(298)][n(302)](t)}[ee(307)](e,t){const n=ee;(null==e?void 0:e.then)&&e.then((e=>{const n=$;e[n(307)]=t,this[n(298)][n(303)][n(286)]()})),e instanceof v&&(e.show=t,this[n(298)].scene[n(286)]())}}const se=re;function re(e,t){const n=ie();return(re=function(e,t){return n[e-=422]})(e,t)}function ie(){const e=["638323qEBCCp","3690615epsdbj","text/xml","default","options","ows:LowerCorner","?SERVICE=WMTS&REQUEST=GetCapabilities","_extentCache","4326","8WwZgZU","has","__layerType","layer","180drNeQM","split","_getLayerRectangle","ows:Identifier","210067MGDhjv","_extentPromiseCache","fromDegrees","readyEvent","requestRender","from","flyTo","ows:UpperCorner","?token=","_imageryProvider","2ZwOnOt","locate","ows:WGS84BoundingBox","show","_createProvider","parseFromString","defineProperty","364113WsNFLf","set","7xPmIqm","image/png","4056525IoHOWb","get","token","the layer type is not 'SUPERMAP_WMTS'","_viewer","includes","_getCapabilitiesUrl","text","textContent","?SERVICE=WMTS&REQUEST=GetCapabilities&token=","imageryLayers","ows:Title","remove","url / layer / tileMatrixSetID is required","3373764TLQIoR","112192EHaubC","getElementsByTagName","scene","_options","SUPERMAP_WMTS","camera"];return(ie=function(){return e})()}!function(){const e=re,t=ie();for(;;)try{if(405696===-parseInt(e(477))/1*(parseInt(e(445))/2)+-parseInt(e(452))/3+-parseInt(e(471))/4+parseInt(e(478))/5+parseInt(e(470))/6*(parseInt(e(454))/7)+-parseInt(e(427))/8*(parseInt(e(456))/9)+parseInt(e(431))/10*(parseInt(e(435))/11))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const oe=class{constructor(e){this[re(460)]=e}async load(e){const t=re,{type:n,url:s,layer:r,tileMatrixSetID:i,style:o="default",format:a=t(455)}=e;if(n!==t(475))throw new Error(t(459));if(!s||!r||!i)throw new Error(t(469));this[t(474)]={...e};const c=new f(this[t(449)](e));return Object[t(451)](c,t(429),{value:t(475),enumerable:!1}),this._imageryLayer=c,this[t(460)][t(466)].add(c),this._viewer[t(473)][t(439)](),c}refreshToken(e,t){const n=re;if(!(e[n(430)]instanceof f))return;e[n(422)][n(458)]=t;const s=this[n(449)](e[n(422)]);e[n(430)][n(444)]=s,this[n(460)][n(473)][n(439)]()}[se(449)](e){const t=se,{url:n,layer:s,tileMatrixSetID:r,style:i=t(480),format:o="image/png",token:a}=e;if(!n||!s||!r)throw new Error("url / layer / tileMatrixSetID is required");const c=a?n+t(443)+a:n,h=r[t(461)](t(426))?new p:new g,l=Array[t(440)]({length:22},((e,t)=>t.toString()));return new I({url:c,layer:s,style:i,format:o,tileMatrixSetID:r,tileMatrixLabels:l,tilingScheme:h})}async[se(446)](e,t){const n=se;if(!(t instanceof f))return;const s=async()=>{const n=re,s=await this._getLayerRectangle(e);if(s)return void this[n(460)][n(473)].camera.flyTo({destination:s});const r=t.getImageryRectangle();r&&this[n(460)].scene[n(476)][n(441)]({destination:r})};t.ready?s():t[n(438)].addEventListener((()=>s()))}[se(462)](e){const t=se,{url:n,token:s}=e;return s?n+t(465)+s:n+t(424)}async[se(433)](e){const t=se,{layer:n}=e;if(!n)return;const r=this[t(462)](e)+"#"+n;if(oe._extentCache[t(428)](r))return oe[t(425)].get(r);if(oe[t(436)][t(428)](r))return oe[t(436)][t(457)](r);const i=(async()=>{const i=t,o=this[i(462)](e),a=await fetch(o).then((e=>e[i(463)]())),c=(new DOMParser)[i(450)](a,i(479)),h=Array[i(440)](c.getElementsByTagName("Layer")).find((e=>{const t=i;var s,r;return((null==(s=e[t(472)](t(434))[0])?void 0:s[t(464)])||(null==(r=e[t(472)](t(467))[0])?void 0:r.textContent))===n}));if(!h)return;const l=h.getElementsByTagName(i(447))[0];if(!l)return;const u=l[i(472)](i(423))[0][i(464)][i(432)](" "),f=l[i(472)](i(442))[0][i(464)][i(432)](" "),p=s[i(437)](Number(u[0]),Number(u[1]),Number(f[0]),Number(f[1]));return oe._extentCache[i(453)](r,p),oe[i(436)].delete(r),p})();return oe[t(436)].set(r,i),i}[se(468)](e){const t=se;e instanceof f&&(this._viewer[t(466)][t(468)](e,!0),this._viewer[t(473)][t(439)]())}[se(448)](e,t){const n=se;e instanceof f&&(e[n(448)]=t,this[n(460)].scene[n(439)]())}};let ae=oe;ae[se(425)]=new Map,ae[se(436)]=new Map;const ce=he;function he(e,t){const n=le();return(he=function(e,t){return n[e-=162]})(e,t)}function le(){const e=["url","2493480xWCGHe","the type '","URLTemplate","GEOJSON","请输入Viewer对象!","3DTILES","3660hefPOC","TERRAIN","9iBgemQ","8732680ijsykT","KML","' is not support","Mbtiles","_load","locate","_typeClassMap","includes","_initLoader","type","SUPERMAP_WMTS","destroy","set","_remove","_type","_url","2708SFVGNc","_typeClass","loadAsync","_id","604215kLvvqs","_show","ARCGIS","7212462YsTquz","getById","bind","the layer with id '","has","_locate","showById","the url is needed","_layersMap","load","WMTS","_refreshToken","9079736ZvmEMg","' is already loaded","refreshToken","1461000MyxcoL","_viewer","delete","locateById","WMS","get","7jdJPrv"];return(le=function(){return e})()}!function(){const e=he,t=le();for(;;)try{if(646851===-parseInt(e(172))/1+parseInt(e(190))/2+parseInt(e(198))/3+-parseInt(e(168))/4*(-parseInt(e(204))/5)+-parseInt(e(175))/6*(-parseInt(e(196))/7)+-parseInt(e(187))/8*(parseInt(e(206))/9)+-parseInt(e(207))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class ue{constructor(e){const t=he;if(!e)throw new Error(t(202));this[t(191)]=e,this._layersMap=new Map,this[t(213)]=new Map}[ce(215)](){const e=ce,t=this._typeClassMap[e(195)](this[e(166)]);t?this[e(169)]=t:this[e(166)]===e(205)?this[e(169)]=new S(this[e(191)]):this[e(166)]===e(203)?this[e(169)]=new L(this[e(191)]):this._type===e(174)?this[e(169)]=new A(this[e(191)]):"URLTemplate"===this[e(166)]?this[e(169)]=new z(this[e(191)]):this[e(166)]===e(210)?this[e(169)]=new N(this[e(191)]):this[e(166)]===e(194)?this[e(169)]=new Q(this[e(191)]):this[e(166)]===e(185)?this[e(169)]=new X(this[e(191)]):this[e(166)]===e(208)?this[e(169)]=new ne(this._viewer):this._type===e(201)?this._typeClass=new Z(this[e(191)]):this[e(166)]===e(162)&&(this[e(169)]=new ae(this[e(191)]),this._refreshToken=this[e(169)].refreshToken.bind(this._typeClass)),this[e(211)]=this[e(169)][e(184)][e(177)](this[e(169)]),this[e(165)]=this[e(169)].remove[e(177)](this[e(169)]),this[e(180)]=this[e(169)][e(212)][e(177)](this._typeClass),this[e(173)]=this[e(169)].show[e(177)](this[e(169)])}async[ce(170)](e){const t=ce;if(e=e??{},this[t(171)]=e.id,this[t(183)][t(179)](this[t(171)]))throw new Error(t(178)+this._id+t(188));if(this[t(167)]=e[t(197)],!this[t(167)])throw new Error(t(182));if(this._type=e.type,!this._isSupport(e.type))throw new Error(t(199)+e.type+t(209));if(this[t(215)](),e[t(216)]===t(208)){const n=this[t(211)](e);n instanceof Promise&&this._layersMap[t(164)](e.id,{options:e,layer:n})}else{const n=await this[t(211)](e);this[t(183)][t(164)](e.id,{options:e,layer:n})}}_isSupport(e){const t=ce;return["TERRAIN",t(203),t(174),t(200),"Mbtiles",t(194),"WMTS","KML",t(201),"SUPERMAP_WMTS"][t(214)](e)}[ce(176)](e){const t=ce;return this[t(183)][t(195)](e)}removeById(e){const t=ce,n=this._layersMap[t(195)](e);if(this[t(183)][t(192)](e),!n)return;const{options:s,layer:r}=n;r&&(this._type=s.type,this[t(215)](),this[t(165)](r))}[ce(193)](e){const t=ce,n=this[t(183)][t(195)](e);if(!n)return;const{options:s,layer:r}=n;r&&(this[t(166)]=s[t(216)],this[t(215)](),this[t(180)](s,r))}[ce(181)](e,t){const n=ce,s=this._layersMap[n(195)](e);if(!s)return;const{options:r,layer:i}=s;i&&(this[n(166)]=r.type,this[n(215)](),this[n(173)](i,t))}[ce(189)](e,t){const n=ce;var s;const r=this[n(183)][n(195)](e);r&&r.options[n(216)]===n(162)&&(null==(s=this[n(186)])||s.call(this,r,t))}[ce(163)](){}}export{ue as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsc-earth-2/layer",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -31,6 +31,6 @@
31
31
  "cesium": "^1.104.0"
32
32
  },
33
33
  "dependencies": {
34
- "@nsc-earth-2/primitive-geojson": "1.0.10"
34
+ "@nsc-earth-2/primitive-geojson": "1.0.11"
35
35
  }
36
36
  }