@nsc-earth-2/layer 1.1.0 → 1.1.1

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 y,UrlTemplateImageryProvider as d,defaultValue as w,WebMapServiceImageryProvider as m,WebMapTileServiceImageryProvider as I,KmlDataSource as g,WebMercatorTilingScheme as v}from"cesium";import{GeoJsonPrimitiveLayer as E}from"@nsc-earth-2/primitive-geojson";const _=T;function T(e,t){const n=R();return(T=function(e,t){return n[e-=128]})(e,t)}!function(e,t){const n=T,s=R();for(;;)try{if(498955===parseInt(n(138))/1+-parseInt(n(134))/2*(parseInt(n(133))/3)+parseInt(n(159))/4*(parseInt(n(157))/5)+-parseInt(n(144))/6*(parseInt(n(151))/7)+parseInt(n(135))/8*(parseInt(n(131))/9)+-parseInt(n(153))/10+parseInt(n(149))/11*(parseInt(n(160))/12))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class S{constructor(e){this[T(145)]=e}load(n){const s=T;if((n=n??{})[s(141)]!==s(155))throw new Error(s(129));const r=n[s(146)],i=new e(t[s(156)](r));return this[s(145)][s(140)].setTerrain(i),this[s(145)][s(140)][s(130)](),Promise[s(161)](i)}[_(148)](e){const t=_,s=new n;this[t(145)][t(136)]=s,this._viewer.scene[t(130)]()}locate(e,t){const n=_,r=(e=e??{})[n(146)];fetch(r+n(142))[n(128)]((e=>e.json()))[n(128)]((e=>{const t=n;e[t(139)]&&Array[t(152)](e[t(139)])&&4===e[t(139)][t(143)]?this[t(145)][t(158)].flyTo({destination:s[t(147)](e.valid_bounds[0],e[t(139)][1],e[t(139)][2],e[t(139)][3])}):e[t(154)]&&Array[t(152)](e[t(154)])&&4==e[t(154)][t(143)]&&this[t(145)][t(158)][t(150)]({destination:s[t(147)](e[t(154)][0],e[t(154)][1],e[t(154)][2],e[t(154)][3])})}))}[_(137)](t,s){const r=_;if(t instanceof e){if(s)this[r(145)].scene[r(132)](t);else{const e=new n;this[r(145)][r(136)]=e}this._viewer.scene[r(130)]()}}}function R(){const e=["fromUrl","610370nOqFhF","camera","28txQFlY","48UvHHpg","resolve","then","the layer type is not 'TERRAIN'","requestRender","9rHddrl","setTerrain","807DNIoKS","5338aibQTn","1924392NrbUCj","terrainProvider","show","829254HeBhkw","valid_bounds","scene","type","/layer.json","length","39036KRSqlS","_viewer","url","fromDegrees","remove","1993354gktCnH","flyTo","658bFxtkJ","isArray","8206970iPiUQJ","bounds","TERRAIN"];return(R=function(){return e})()}const M=b;function b(e,t){const n=x();return(b=function(e,t){return n[e-=243]})(e,t)}!function(e,t){const n=b,s=x();for(;;)try{if(990165===-parseInt(n(247))/1+-parseInt(n(274))/2*(parseInt(n(249))/3)+-parseInt(n(282))/4*(parseInt(n(248))/5)+-parseInt(n(276))/6*(parseInt(n(273))/7)+parseInt(n(260))/8*(-parseInt(n(264))/9)+-parseInt(n(255))/10*(-parseInt(n(278))/11)+parseInt(n(252))/12)break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class C{constructor(e){this[b(257)]=e}async[M(283)](e){const t=M;if((e=e??{})[t(256)]!==t(253))throw new Error("the layer type is not '3DTILES'");const n=e[t(258)];if(!n)throw new Error(t(261));const s={longitude:e[t(284)]??0,latitude:e[t(251)]??0,altitude:e[t(265)]??0,azimuth:e[t(266)]??0},i=await r[t(271)](n,{dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:.00278,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceErrorHeightFalloff:.25});return this[t(270)](i,s),this[t(257)][t(277)][t(250)][t(280)](i),this[t(257)][t(277)][t(259)](),i}[M(270)](e,t){const n=M,{longitude:s,latitude:r,altitude:u,azimuth:f}=t;let p=new i;if(s&&r){let e=u;0==u&&(e=this[n(257)][n(277)][n(246)].getHeight(o[n(268)](s,r))||0);const t=a[n(268)](s,r,e),y=c[n(279)](t),d=new h(1,0,0,0,1,0,0,0,1),w=h.fromRotationZ(l[n(281)](f));h.multiply(d,w,d),p=i[n(275)](y,d,new i)}else if(u){const t=new a;i.getTranslation(e[n(245)][n(267)],t);const s=o[n(272)](t);if(s){const e=l[n(254)](s[n(251)]),t=l.toDegrees(s.longitude),r=a[n(268)](t,e,u),o=c[n(279)](r),y=new h(1,0,0,0,1,0,0,0,1),d=h[n(269)](l[n(281)](f));h[n(243)](y,d,y),p=i.multiplyByMatrix3(o,y,new i)}}else if(f){const t=new h(1,0,0,0,1,0,0,0,1),s=h.fromRotationZ(l[n(281)](f));h[n(243)](t,s,t),p=i[n(275)](e[n(245)][n(267)],t,new i)}else p=e[n(245)][n(267)];e.root[n(267)]=p}[M(263)](e){const t=M;e instanceof r&&(this[t(257)].scene[t(250)][t(263)](e),this._viewer[t(277)][t(259)]())}locate(e,t){const n=M;t instanceof r&&this[n(257)][n(262)](t)}[M(244)](e,t){const n=M;e instanceof r&&(e[n(244)]=t,this[n(257)][n(277)][n(259)]())}}function x(){const e=["70276356NCdKUJ","3DTILES","toDegrees","7870GCNVMf","type","_viewer","url","requestRender","8gHOVwE","the url is needed","flyTo","remove","7183287ceXPhN","altitude","azimuth","transform","fromDegrees","fromRotationZ","transferTileSet","fromUrl","fromCartesian","1813yQAibM","565118JwhTPn","multiplyByMatrix3","27162baDDXr","scene","495KMRLVA","eastNorthUpToFixedFrame","add","toRadians","673996XNoNex","load","longitude","multiply","show","root","globe","398310hdWSbC","50NjUNWd","9cczWNW","primitives","latitude"];return(x=function(){return e})()}function L(e,t){const n=D();return(L=function(e,t){return n[e-=291]})(e,t)}const W=L;function D(){const e=["getImageryRectangle","368VYpOAj","imageryLayers","the url is needed","1646CYNsEx","flyTo","ready","72UayrFE","948265baMURx","6iwOAIw","102655eQtgav","fromDegrees","json","token","_viewer","/info/iteminfo?f=pjson&token=","load","show","4851431qFMqjA","readyEvent","4LyQUWt","fromProviderAsync","1187lGunFT","2820CytgTI","rectangle","14277120TdQPpo","1483161CHOWwp","then","scene","remove","extent","type","17991eHrFYT","camera","the layer type is not 'ARCGIS'"];return(D=function(){return e})()}!function(e,t){const n=L,s=D();for(;;)try{if(759213===-parseInt(n(301))/1*(parseInt(n(318))/2)+-parseInt(n(305))/3*(-parseInt(n(299))/4)+-parseInt(n(322))/5*(-parseInt(n(323))/6)+-parseInt(n(324))/7*(-parseInt(n(315))/8)+parseInt(n(311))/9*(-parseInt(n(302))/10)+-parseInt(n(304))/11+-parseInt(n(321))/12*(-parseInt(n(297))/13))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class N{constructor(e){this[L(293)]=e}async[W(295)](e){const t=W;if("ARCGIS"!==(e=e??{})[t(310)])throw new Error(t(313));const{url:n,alpha:r,token:i}=e;if(!n)throw new Error(t(317));let o=n;o=i?n+t(294)+i:n+"/info/iteminfo?f=pjson";const a=await fetch(o,{method:"GET"})[t(306)]((e=>e[t(291)]()))[t(306)]((e=>{const n=t,r={};return i&&(r[n(292)]=i),e&&e[n(309)]&&Array.isArray(e[n(309)])&&(r[n(303)]=s[n(325)](e[n(309)][0][0],e.extent[0][1],e[n(309)][1][0],e[n(309)][1][1])),r})),c=u.fromUrl(n,a),h=f[t(300)](c,{});return r&&(h.alpha=r),this[t(293)][t(316)].add(h),this._viewer[t(307)].requestRender(),h}async remove(e){const t=W;e instanceof f&&(this[t(293)].imageryLayers[t(308)](e,!0),this[t(293)][t(307)].requestRender())}locate(e,t){const n=W;if(t instanceof f)if(t[n(320)]){const e=t[n(314)]();this[n(293)][n(307)][n(312)].flyTo({destination:e})}else t[n(298)].addEventListener((e=>{const s=n,r=t.getImageryRectangle();this[s(293)].scene[s(312)][s(319)]({destination:r})}))}[W(296)](e,t){const n=W;e instanceof f&&(e[n(296)]=t,this._viewer[n(307)].requestRender())}}function P(){const e=["_viewer","6243504zigmfu","proj","remove","rectangle","43541366RTdyPL","addEventListener","fromDegrees","alpha","tilingScheme","flyTo","east","4819304eJIusJ","maximumLevel","835sZJHVU","10hRYKfy","385251XdTvRy","{z}/{x}/{y}.png","readyEvent","the url is needed","camera","URLTemplate","imageryLayers","substr","scene","load","south","then","minimumLevel","meta.json","bounds","requestRender","indexOf","tilesize","6043328DCpwyo","maxzoom","524GFhuiE","5BZiDQB","locate","west","north","GET","28uWOzmS","json","getImageryRectangle","add","15077070dlEHdt","the layer type is not 'URLTemplate'","tileWidth","minzoom","ready"];return(P=function(){return e})()}const U=q;function q(e,t){const n=P();return(q=function(e,t){return n[e-=285]})(e,t)}!function(e,t){const n=q,s=P();for(;;)try{if(916293===-parseInt(n(324))/1*(-parseInt(n(295))/2)+parseInt(n(326))/3*(parseInt(n(301))/4)+-parseInt(n(296))/5*(parseInt(n(311))/6)+-parseInt(n(322))/7+-parseInt(n(293))/8+-parseInt(n(305))/9+parseInt(n(325))/10*(parseInt(n(315))/11))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class k{constructor(e){this[q(310)]=e}async[U(335)](e){const t=U;if((e=e??{}).type!==t(331))throw new Error(t(306));const{url:n,alpha:r}=e;if(!n)throw new Error(t(329));let i=t(327),o=n[t(333)](0,n[t(291)](i))+t(288);const a=await fetch(o,{method:t(300)})[t(286)]((e=>e[t(302)]()))[t(286)]((e=>{const r=t,i={url:n};return e&&e[r(289)]&&(i[r(314)]=s[r(317)](e[r(289)][r(298)],e[r(289)][r(285)],e[r(289)][r(321)],e.bounds[r(299)])),e&&4326==e[r(312)]&&(i[r(319)]=new p({ellipsoid:y.WGS84})),e&&e[r(294)]&&(i[r(323)]=e[r(294)]),e&&e[r(308)]&&(i[r(287)]=e[r(308)]),e&&e[r(292)]&&(i[r(307)]=i.tileHeight=e[r(292)]),i})),c=new d(a),h=new f(c,{});return r&&(h[t(318)]=r),this[t(310)].imageryLayers[t(304)](h),this._viewer[t(334)].requestRender(),h}async[U(313)](e){const t=U;e instanceof f&&(this[t(310)][t(332)].remove(e,!0),this[t(310)][t(334)][t(290)]())}[U(297)](e,t){const n=U;if(t instanceof f)if(t[n(309)]){const e=t[n(303)]();this[n(310)][n(334)][n(330)][n(320)]({destination:e})}else t[n(328)][n(316)]((e=>{const s=n,r=t.getImageryRectangle();this[s(310)].scene[s(330)].flyTo({destination:r})}))}show(e,t){const n=U;e instanceof f&&(e.show=t,this[n(310)][n(334)][n(290)]())}}function G(e,t){const n=O();return(G=function(e,t){return n[e-=206]})(e,t)}const z=G;function O(){const e=["locate","20667350QdWzqv","7ebLoKV","imageryLayers","/{z}/{x}/{y}.png","json","camera","indexOf","2065128WTskWF","70PFuWwt","substr","fromDegrees","type","then","requestRender","remove","maximumLevel","scene","tileWidth","getImageryRectangle","1178205NCXFKQ","2455464diCNEv","938279fgFVDT","256023HbmBMR","minzoom","25itnrOg","add","flyTo","the layer type is not 'Mbtiles'","tilesize","show","_viewer","tilingScheme","alpha","bounds","1171878CmgSNU","tileHeight","2cFagOD","load","readyEvent","GET"];return(O=function(){return e})()}!function(e,t){const n=G,s=O();for(;;)try{if(642407===-parseInt(n(219))/1+parseInt(n(234))/2*(-parseInt(n(217))/3)+parseInt(n(218))/4+parseInt(n(222))/5*(-parseInt(n(232))/6)+parseInt(n(240))/7*(parseInt(n(246))/8)+-parseInt(n(220))/9*(-parseInt(n(206))/10)+parseInt(n(239))/11)break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class A{constructor(e){this._viewer=e}async[z(235)](e){const t=z;e=w(e,{});if("Mbtiles"!==w(e[t(209)],void 0))throw new Error(t(225));const{url:n,alpha:r}=e;if(!n)throw new Error("the url is needed");let i=t(242),o=n[t(207)](0,n[t(245)](i))+".json";const a=await fetch(o,{method:t(237)})[t(210)]((e=>e[t(243)]())).then((e=>{const r=t,i={url:n};return e&&e[r(231)]&&(i.rectangle=s[r(208)](e.bounds[0],e[r(231)][1],e[r(231)][2],e[r(231)][2])),e&&4326==e.proj&&(i[r(229)]=new p({ellipsoid:y.WGS84})),e&&e.maxzoom&&(i[r(213)]=e.maxzoom),e&&e[r(221)]&&(i.minimumLevel=e[r(221)]),e&&e.tilesize&&(i[r(215)]=i[r(233)]=e[r(226)]),i})),c=new d(a),h=new f(c,{});return r&&(h[t(230)]=r),this[t(228)][t(241)][t(223)](h),this[t(228)].scene.requestRender(),h}async[z(212)](e){const t=z;e instanceof f&&(this[t(228)][t(241)][t(212)](e,!0),this[t(228)].scene[t(211)]())}[z(238)](e,t){const n=z;if(t instanceof f)if(t.ready){const e=t[n(216)]();this._viewer.scene[n(244)][n(224)]({destination:e})}else t[n(236)].addEventListener((e=>{const s=n,r=t[s(216)]();this[s(228)][s(214)][s(244)].flyTo({destination:r})}))}show(e,t){const n=z;e instanceof f&&(e[n(227)]=t,this[n(228)].scene.requestRender())}}const j=K;function F(){const e=["primitiveCollection","48sZYIYg","12313GWBsau","3869118JuNrbJ","the url is needed","remove","load","show","51ymplXb","primitives","scene","the layer type is not 'GEOJSON'","70946JcfznP","flyTo","6mDrIev","1288MgJNZF","1026610KxXKgV","40732rOYhuM","requestRender","13960fphuex","locate","672966OmmWOI","_viewer"];return(F=function(){return e})()}function K(e,t){const n=F();return(K=function(e,t){return n[e-=281]})(e,t)}!function(e,t){const n=K,s=F();for(;;)try{if(162311===-parseInt(n(288))/1*(-parseInt(n(290))/2)+-parseInt(n(284))/3*(-parseInt(n(293))/4)+parseInt(n(295))/5*(parseInt(n(300))/6)+parseInt(n(301))/7*(parseInt(n(291))/8)+-parseInt(n(297))/9+-parseInt(n(292))/10+-parseInt(n(302))/11)break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class B{constructor(e){this[K(298)]=e}async load(e){const t=K;if("GEOJSON"!==(e=e??{}).type)throw new Error(t(287));const{url:n,clampToGround:s}=e;if(!n)throw new Error(t(303));const r=new E({options:{useGroundGeometry:s??!1,clampToGround:s??!1,scene:this[t(298)][t(286)]}});return await r[t(282)](n),this[t(298)][t(286)].primitives.add(r[t(299)]),this[t(298)][t(286)][t(294)](),r}async remove(e){const t=K;e instanceof E&&(this[t(298)][t(286)][t(285)][t(281)](e[t(299)]),this._viewer[t(286)][t(294)]())}[j(296)](e,t){const n=j;t instanceof E&&t[n(289)](this[n(298)],{tolerance:.015})}[j(283)](e,t){const n=j;e instanceof E&&(e.primitiveCollection.show=t,this[n(298)][n(286)][n(294)]())}}const Y=H;function H(e,t){const n=V();return(H=function(e,t){return n[e-=267]})(e,t)}!function(e,t){const n=H,s=V();for(;;)try{if(170990===-parseInt(n(271))/1*(-parseInt(n(269))/2)+-parseInt(n(280))/3+-parseInt(n(285))/4*(parseInt(n(276))/5)+parseInt(n(294))/6+-parseInt(n(270))/7*(parseInt(n(274))/8)+-parseInt(n(279))/9*(-parseInt(n(275))/10)+parseInt(n(281))/11*(parseInt(n(268))/12))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class Q{constructor(e){this._viewer=e}async load(e){const t=H;if((e=e??{})[t(291)]!==t(293))throw new Error(t(289));const{url:n,layers:s}=e;if(!n)throw new Error(t(283));if(!s)throw new Error(t(290));const r=new m(e),i=new f(r,{});return this[t(295)][t(292)].add(i),this[t(295)][t(272)][t(273)](),i}async[Y(278)](e){const t=Y;e instanceof f&&(this[t(295)][t(292)][t(278)](e,!0),this._viewer.scene[t(273)]())}[Y(267)](e,t){const n=Y;if(t instanceof f)if(t.ready){const e=t[n(286)]();this._viewer.scene[n(287)].flyTo({destination:e})}else t[n(277)][n(284)]((e=>{const s=n,r=t[s(286)]();this[s(295)][s(272)][s(287)][s(288)]({destination:r})}))}[Y(282)](e,t){const n=Y;e instanceof f&&(e.show=t,this[n(295)][n(272)][n(273)]())}}function V(){const e=["type","imageryLayers","WMS","716190ngEgQj","_viewer","locate","1164oUQYmS","6884lNzZXC","1632554kSlMqn","19rZSvDx","scene","requestRender","8jpgrSu","930fmfnzw","10EaxbeI","readyEvent","remove","16434FpGwzj","699642UPlOwK","48345nUhOWJ","show","the url is needed","addEventListener","286940lRCfSf","getImageryRectangle","camera","flyTo","the layer type is not 'WMS'","the layers is needed"];return(V=function(){return e})()}const J=X;!function(e,t){const n=X,s=$();for(;;)try{if(419469===-parseInt(n(463))/1+parseInt(n(481))/2*(-parseInt(n(478))/3)+-parseInt(n(464))/4+parseInt(n(489))/5*(-parseInt(n(488))/6)+parseInt(n(469))/7*(-parseInt(n(466))/8)+-parseInt(n(479))/9+-parseInt(n(484))/10*(-parseInt(n(467))/11))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class Z{constructor(e){this[X(471)]=e}async[J(465)](e){const t=J;if("WMTS"!==(e=e??{})[t(462)])throw new Error(t(492));const{url:n,layer:s,style:r,tileMatrixSetID:i,subdomains:o,format:a,tilingScheme:c,tileMatrixLabels:h}=e;if(!n)throw new Error("the url is needed");if(!s)throw new Error(t(472));if(!r)throw new Error("the style is needed");if(!i)throw new Error(t(474));const l={url:n,layer:s,style:r,tileMatrixSetID:i};o&&(l.subdomains=o),a&&(l.format=a),c&&(l[t(476)]=c),h&&(l.tileMatrixLabels=h);const u=new I(l),p=new f(u,{});return this._viewer.imageryLayers[t(468)](p),this[t(471)][t(485)].requestRender(),p}async[J(470)](e){const t=J;e instanceof f&&(this[t(471)][t(491)][t(470)](e,!0),this[t(471)][t(485)][t(487)]())}[J(486)](e,t){const n=J;if(t instanceof f)if(t[n(482)]){const e=t[n(475)]();this[n(471)][n(485)][n(490)][n(480)]({destination:e})}else t[n(483)][n(477)]((e=>{const s=n,r=t[s(475)]();this[s(471)].scene[s(490)][s(480)]({destination:r})}))}[J(473)](e,t){const n=J;e instanceof f&&(e.show=t,this[n(471)][n(485)][n(487)]())}}function X(e,t){const n=$();return(X=function(e,t){return n[e-=462]})(e,t)}function $(){const e=["32940YrYVhW","scene","locate","requestRender","6vZyUnV","2477015zPEfVb","camera","imageryLayers","the layer type is not 'WMTS'","type","314737EZyRHO","2572564ndObXT","load","6002600kqtwoO","12210BcCGIM","add","7ykkKWZ","remove","_viewer","the layer is needed","show","the tileMatrixSetID is needed","getImageryRectangle","tilingScheme","addEventListener","30eOWPzs","3739095MIKMKo","flyTo","123562jVcTQe","ready","readyEvent"];return($=function(){return e})()}function ee(e,t){const n=se();return(ee=function(e,t){return n[e-=181]})(e,t)}const te=ee;!function(e,t){const n=ee,s=se();for(;;)try{if(580554===parseInt(n(196))/1+-parseInt(n(185))/2+parseInt(n(187))/3*(parseInt(n(200))/4)+parseInt(n(195))/5+parseInt(n(189))/6+parseInt(n(197))/7+-parseInt(n(203))/8)break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class ne{constructor(e){this[ee(188)]=e}async[te(199)](e){const t=te,n=(e=e??{}).type;if(n!==t(193)&&n!==t(186))throw new Error(t(194));const{url:s,clampToGround:r}=e;if(!s)throw new Error(t(192));return this[t(188)][t(201)][t(183)](g.load(s,{camera:this._viewer[t(184)].camera,canvas:this[t(188)][t(184)][t(191)],clampToGround:r??!1}))}async remove(e){const t=te;(null==e?void 0:e.then)&&e[t(204)]((e=>{const n=t;this._viewer[n(201)].remove(e),this._viewer[n(184)][n(202)]()})),e instanceof g&&(this[t(188)][t(201)][t(190)](e),this[t(188)][t(184)][t(202)]())}[te(181)](e,t){const n=te;(null==t?void 0:t.then)&&t[n(204)]((e=>{this[n(188)].flyTo(e)})),t instanceof g&&this._viewer[n(198)](t)}[te(182)](e,t){const n=te;(null==e?void 0:e[n(204)])&&e[n(204)]((e=>{const s=n;e.show=t,this[s(188)][s(184)][s(202)]()})),e instanceof g&&(e.show=t,this[n(188)][n(184)][n(202)]())}}function se(){const e=["requestRender","20196760lOQOmC","then","locate","show","add","scene","49958Lfxgqn","KMZ","3cdvPpq","_viewer","5245086YvfDcY","remove","canvas","the url is needed","KML","the layer type is not 'KML' or 'KMZ","1374760DsUera","912081YbfzGC","6804749UasFGV","flyTo","load","387228CjIDqc","dataSources"];return(se=function(){return e})()}const re=ae;!function(e,t){const n=ae,s=oe();for(;;)try{if(633425===parseInt(n(451))/1+-parseInt(n(468))/2*(parseInt(n(452))/3)+-parseInt(n(480))/4+-parseInt(n(431))/5+-parseInt(n(446))/6+-parseInt(n(460))/7+-parseInt(n(481))/8*(-parseInt(n(483))/9))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();const ie=class{constructor(e){this[ae(448)]=e}async[re(440)](e){const t=re,{type:n,url:s,layer:r,tileMatrixSetID:i,style:o="default",format:a="image/png"}=e;if("SUPERMAP_WMTS"!==n)throw new Error(t(482));if(!s||!r||!i)throw new Error("url / layer / tileMatrixSetID is required");this[t(462)]={...e};const c=new f(this[t(439)](e));return Object[t(449)](c,t(465),{value:t(447),enumerable:!1}),this[t(445)]=c,this._viewer.imageryLayers.add(c),this[t(448)][t(467)].requestRender(),c}refreshToken(e,t){const n=re;if(!(e.layer instanceof f))return;e[n(450)][n(474)]=t;const s=this._createProvider(e[n(450)]);e[n(429)][n(433)]=s,this[n(448)][n(467)].requestRender()}_createProvider(e){const t=re,{url:n,layer:s,tileMatrixSetID:r,style:i="default",format:o="image/png",token:a}=e;if(!n||!s||!r)throw new Error("url / layer / tileMatrixSetID is required");const c=a?n+t(466)+a:n,h=r[t(436)](t(476))?new p:new v,l=Array.from({length:22},((e,n)=>n[t(478)]()));return new I({url:c,layer:s,style:i,format:o,tileMatrixSetID:r,tileMatrixLabels:l,tilingScheme:h})}async locate(e,t){const n=re;if(!(t instanceof f))return;const s=async()=>{const n=ae,s=await this[n(461)](e);if(s)return void this[n(448)][n(467)][n(437)][n(470)]({destination:s});const r=t.getImageryRectangle();r&&this[n(448)][n(467)][n(437)][n(470)]({destination:r})};t.ready?s():t[n(441)].addEventListener((()=>s()))}[re(444)](e){const t=re,{url:n,token:s}=e;return s?n+t(471)+s:n+t(458)}async[re(461)](e){const t=re,{layer:n}=e;if(!n)return;const r=this[t(444)](e)+"#"+n;if(ie[t(453)].has(r))return ie[t(453)][t(456)](r);if(ie[t(472)].has(r))return ie._extentPromiseCache[t(456)](r);const i=(async()=>{const i=t,o=this[i(444)](e),a=await fetch(o)[i(479)]((e=>e[i(442)]())),c=(new DOMParser)[i(434)](a,"text/xml"),h=Array[i(454)](c[i(464)](i(457)))[i(469)]((e=>{const t=i;var s,r;return((null==(s=e.getElementsByTagName("ows:Identifier")[0])?void 0:s.textContent)||(null==(r=e.getElementsByTagName("ows:Title")[0])?void 0:r[t(473)]))===n}));if(!h)return;const l=h[i(464)](i(430))[0];if(!l)return;const u=l.getElementsByTagName(i(432))[0][i(473)][i(475)](" "),f=l[i(464)](i(477))[0].textContent.split(" "),p=s[i(459)](Number(u[0]),Number(u[1]),Number(f[0]),Number(f[1]));return ie._extentCache[i(463)](r,p),ie[i(472)][i(435)](r),p})();return ie[t(472)][t(463)](r,i),i}remove(e){const t=re;e instanceof f&&(this[t(448)].imageryLayers[t(438)](e,!0),this._viewer.scene[t(443)]())}[re(455)](e,t){const n=re;e instanceof f&&(e[n(455)]=t,this[n(448)][n(467)][n(443)]())}};function oe(){const e=["ows:WGS84BoundingBox","4953790WWXTEl","ows:LowerCorner","_imageryProvider","parseFromString","delete","includes","camera","remove","_createProvider","load","readyEvent","text","requestRender","_getCapabilitiesUrl","_imageryLayer","5789094YozDkN","SUPERMAP_WMTS","_viewer","defineProperty","options","133274zveCNt","3IJPfwG","_extentCache","from","show","get","Layer","?SERVICE=WMTS&REQUEST=GetCapabilities","fromDegrees","1942962nBqgHi","_getLayerRectangle","_options","set","getElementsByTagName","__layerType","?token=","scene","2014756LbsTmE","find","flyTo","?SERVICE=WMTS&REQUEST=GetCapabilities&token=","_extentPromiseCache","textContent","token","split","4326","ows:UpperCorner","toString","then","3970720zHoMdD","12622352mZvyYK","the layer type is not 'SUPERMAP_WMTS'","27UryCRH","layer"];return(oe=function(){return e})()}function ae(e,t){const n=oe();return(ae=function(e,t){return n[e-=429]})(e,t)}let ce=ie;ce[re(453)]=new Map,ce._extentPromiseCache=new Map;const he=ue;function le(){const e=["_url","delete","_remove","1977220UxTpYN","_locate","61agyDpu","_show","remove","the layer with id '","99GLvdQW","WMTS","get","options","type","Mbtiles","_initLoader","url","bind","the type '","_id","_load","573Ylqmdm","17542STjIYm","_typeClass","GEOJSON","TERRAIN","3214400oLbKzW","_typeClassMap","loadAsync","3DTILES","_viewer","545424Dyifkp","WMS","582020qotQVl","' is not support","1606024zQoYzC","set","refreshToken","ARCGIS","_refreshToken","URLTemplate","_layersMap","_isSupport","SUPERMAP_WMTS","call","KML","showById","getById","load","_type","16444WBNecX","the url is needed","destroy"];return(le=function(){return e})()}function ue(e,t){const n=le();return(ue=function(e,t){return n[e-=252]})(e,t)}!function(e,t){const n=ue,s=le();for(;;)try{if(576412===parseInt(n(275))/1*(-parseInt(n(292))/2)+parseInt(n(291))/3*(parseInt(n(267))/4)+-parseInt(n(273))/5+-parseInt(n(301))/6+-parseInt(n(252))/7+parseInt(n(296))/8+parseInt(n(279))/9*(parseInt(n(303))/10))break;s.push(s.shift())}catch(e){s.push(s.shift())}}();class fe{constructor(e){const t=ue;if(!e)throw new Error("请输入Viewer对象!");this[t(300)]=e,this[t(258)]=new Map,this[t(297)]=new Map}[he(285)](){const e=he,t=this[e(297)][e(281)](this._type);t?this._typeClass=t:"TERRAIN"===this[e(266)]?this._typeClass=new S(this[e(300)]):this[e(266)]===e(299)?this[e(293)]=new C(this[e(300)]):this._type===e(255)?this[e(293)]=new N(this._viewer):this[e(266)]===e(257)?this[e(293)]=new k(this._viewer):this[e(266)]===e(284)?this[e(293)]=new A(this[e(300)]):this[e(266)]===e(302)?this[e(293)]=new Q(this._viewer):this[e(266)]===e(280)?this[e(293)]=new Z(this[e(300)]):this._type===e(262)?this[e(293)]=new ne(this[e(300)]):this[e(266)]===e(294)?this._typeClass=new B(this[e(300)]):this[e(266)]===e(260)&&(this._typeClass=new ce(this[e(300)]),this[e(256)]=this._typeClass[e(254)][e(287)](this[e(293)])),this._load=this._typeClass[e(265)][e(287)](this[e(293)]),this[e(272)]=this[e(293)][e(277)][e(287)](this._typeClass),this[e(274)]=this[e(293)].locate.bind(this[e(293)]),this[e(276)]=this[e(293)].show[e(287)](this[e(293)])}async[he(298)](e){const t=he;if(e=e??{},this._id=e.id,this._layersMap.has(this[t(289)]))throw new Error(t(278)+this._id+"' is already loaded");if(this._url=e[t(286)],!this[t(270)])throw new Error(t(268));if(this._type=e[t(283)],!this[t(259)](e[t(283)]))throw new Error(t(288)+e.type+t(304));if(this[t(285)](),"KML"===e[t(283)]){const n=this[t(290)](e);n instanceof Promise&&this[t(258)][t(253)](e.id,{options:e,layer:n})}else{const n=await this[t(290)](e);this[t(258)].set(e.id,{options:e,layer:n})}}[he(259)](e){const t=he;return[t(295),t(299),"ARCGIS",t(257),t(284),t(302),"WMTS","KML",t(294),t(260)].includes(e)}[he(264)](e){const t=he;return this[t(258)][t(281)](e)}removeById(e){const t=he,n=this[t(258)].get(e);if(this[t(258)][t(271)](e),!n)return;const{options:s,layer:r}=n;r&&(this._type=s[t(283)],this[t(285)](),this[t(272)](r))}locateById(e){const t=he,n=this[t(258)][t(281)](e);if(!n)return;const{options:s,layer:r}=n;r&&(this[t(266)]=s[t(283)],this[t(285)](),this[t(274)](s,r))}[he(263)](e,t){const n=he,s=this[n(258)][n(281)](e);if(!s)return;const{options:r,layer:i}=s;i&&(this[n(266)]=r[n(283)],this._initLoader(),this[n(276)](i,t))}[he(254)](e,t){const n=he;var s;const r=this[n(258)].get(e);r&&"SUPERMAP_WMTS"===r[n(282)].type&&(null==(s=this[n(256)])||s[n(261)](this,r,t))}[he(269)](){}}export{fe 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.1",
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
  }