@nsc-earth-2/layer 1.0.11 → 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{Terrain as t,CesiumTerrainProvider as e,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 u,ArcGisMapServerImageryProvider as l,ImageryLayer as p,GeographicTilingScheme as f,Ellipsoid as d,UrlTemplateImageryProvider as y,WebMapServiceImageryProvider as w,WebMapTileServiceImageryProvider as I,KmlDataSource as m}from"cesium";import{GeoJsonPrimitiveLayer as v}from"@nsc-earth-2/primitive-geojson";const g=E;function E(t,e){const n=R();return(E=function(t,e){return n[t-=227]})(t,e)}function R(){const t=["terrainProvider","requestRender","isArray","91BUhciI","resolve","9sglujd","_viewer","scene","441504kaMmZR","type","camera","setTerrain","the layer type is not 'TERRAIN'","73195iIWWPE","json","flyTo","valid_bounds","393710AHcxJb","33672nJcXSW","22680GgaCbh","url","379782cAHDiB","bounds","fromDegrees","remove","24qayKSx","load","/layer.json","then","151782wZRYwq","TERRAIN"];return(R=function(){return t})()}!function(){const t=E,e=R();for(;;)try{if(134730===parseInt(t(236))/1+parseInt(t(256))/2+-parseInt(t(228))/3+parseInt(t(246))/4+-parseInt(t(251))/5*(-parseInt(t(232))/6)+parseInt(t(241))/7*(-parseInt(t(257))/8)+-parseInt(t(243))/9*(parseInt(t(255))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class _{constructor(t){this[E(244)]=t}[g(233)](n){const s=g;if((n=n??{})[s(247)]!==s(237))throw new Error(s(250));const r=n[s(227)],i=new t(e.fromUrl(r));return this._viewer[s(245)][s(249)](i),this[s(244)][s(245)].requestRender(),Promise[s(242)](i)}[g(231)](t){const e=g,s=new n;this[e(244)][e(238)]=s,this[e(244)][e(245)][e(239)]()}locate(t,e){const n=g,r=(t=t??{})[n(227)];fetch(r+n(234))[n(235)]((t=>t[n(252)]()))[n(235)]((t=>{const e=n;t[e(254)]&&Array.isArray(t[e(254)])&&4===t[e(254)].length?this[e(244)].camera[e(253)]({destination:s[e(230)](t.valid_bounds[0],t[e(254)][1],t[e(254)][2],t.valid_bounds[3])}):t[e(229)]&&Array[e(240)](t.bounds)&&4==t[e(229)].length&&this[e(244)][e(248)][e(253)]({destination:s[e(230)](t[e(229)][0],t[e(229)][1],t[e(229)][2],t[e(229)][3])})}))}show(e,s){const r=g;if(e instanceof t){if(s)this[r(244)][r(245)][r(249)](e);else{const t=new n;this[r(244)][r(238)]=t}this[r(244)].scene[r(239)]()}}}const S=T;function T(t,e){const n=q();return(T=function(t,e){return n[t-=481]})(t,e)}function q(){const t=["url","remove","getHeight","4377245HoMDow","14676152FOqGSP","1795059gFqVZM","transform","flyTo","transferTileSet","toDegrees","72TFDEHI","fromRotationZ","locate","globe","multiply","2552364KLRcHt","getTranslation","2563748SSbDqN","latitude","fromCartesian","scene","_viewer","2969512yeFHnq","load","fromDegrees","root","toRadians","eastNorthUpToFixedFrame","show","add","longitude","requestRender","14626AGyCiO","multiplyByMatrix3","azimuth"];return(q=function(){return t})()}!function(){const t=T,e=q();for(;;)try{if(473940===parseInt(t(501))/1*(-parseInt(t(514))/2)+-parseInt(t(509))/3+parseInt(t(486))/4+-parseInt(t(507))/5+-parseInt(t(484))/6+parseInt(t(491))/7+parseInt(t(508))/8)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class L{constructor(t){this[T(490)]=t}async[S(492)](t){const e=S;if("3DTILES"!==(t=t??{}).type)throw new Error("the layer type is not '3DTILES'");const n=t[e(504)];if(!n)throw new Error("the url is needed");const s={longitude:t.longitude??0,latitude:t[e(487)]??0,altitude:t.altitude??0,azimuth:t[e(503)]??0},i=await r.fromUrl(n,{dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:.00278,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceErrorHeightFalloff:.25});return this[e(512)](i,s),this[e(490)][e(489)].primitives[e(498)](i),this[e(490)][e(489)].requestRender(),i}[S(512)](t,e){const n=S,{longitude:s,latitude:r,altitude:l,azimuth:p}=e;let f=new i;if(s&&r){let t=l;0==l&&(t=this[n(490)][n(489)][n(482)][n(506)](o[n(493)](s,r))||0);const e=a[n(493)](s,r,t),d=c[n(496)](e),y=new h(1,0,0,0,1,0,0,0,1),w=h[n(515)](u[n(495)](p));h[n(483)](y,w,y),f=i[n(502)](d,y,new i)}else if(l){const e=new a;i[n(485)](t[n(494)].transform,e);const s=o[n(488)](e);if(s){const t=u[n(513)](s[n(487)]),e=u[n(513)](s[n(499)]),r=a[n(493)](e,t,l),o=c[n(496)](r),d=new h(1,0,0,0,1,0,0,0,1),y=h[n(515)](u.toRadians(p));h[n(483)](d,y,d),f=i[n(502)](o,d,new i)}}else if(p){const e=new h(1,0,0,0,1,0,0,0,1),s=h.fromRotationZ(u[n(495)](p));h[n(483)](e,s,e),f=i.multiplyByMatrix3(t.root[n(510)],e,new i)}else f=t.root[n(510)];t[n(494)].transform=f}[S(505)](t){const e=S;t instanceof r&&(this._viewer[e(489)].primitives[e(505)](t),this[e(490)][e(489)][e(500)]())}[S(481)](t,e){const n=S;e instanceof r&&this._viewer[n(511)](e)}show(t,e){const n=S;t instanceof r&&(t[n(497)]=e,this[n(490)][n(489)].requestRender())}}const M=b;function b(t,e){const n=A();return(b=function(t,e){return n[t-=122]})(t,e)}function A(){const t=["camera","token","6617105BJyFdA","_viewer","785722dSGwta","requestRender","16gXKoTT","the layer type is not 'ARCGIS'","1SsIRAx","fromProviderAsync","imageryLayers","180xGDAKv","flyTo","99453XghCyA","ready","getImageryRectangle","add","show","/info/iteminfo?f=pjson","ARCGIS","extent","fromDegrees","isArray","192rNTIGH","scene","1174613uBohuo","load","type","/info/iteminfo?f=pjson&token=","5304798OkzxyY","then","rectangle","GET","4953620jnKqXV","2469792EFpClw","json","remove","fromUrl","locate","readyEvent"];return(A=function(){return t})()}!function(){const t=b,e=A();for(;;)try{if(847140===-parseInt(t(156))/1*(parseInt(t(152))/2)+parseInt(t(161))/3*(-parseInt(t(131))/4)+parseInt(t(150))/5+parseInt(t(142))/6+-parseInt(t(141))/7*(parseInt(t(154))/8)+parseInt(t(137))/9+parseInt(t(159))/10*(parseInt(t(133))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class G{constructor(t){this[b(151)]=t}async[M(134)](t){const e=M;if((t=t??{})[e(135)]!==e(127))throw new Error(e(155));const{url:n,alpha:r,token:i}=t;if(!n)throw new Error("the url is needed");let o=n;o=i?n+e(136)+i:n+e(126);const a=await fetch(o,{method:e(140)})[e(138)]((t=>t[e(143)]())).then((t=>{const n=e,r={};return i&&(r[n(149)]=i),t&&t[n(128)]&&Array[n(130)](t.extent)&&(r[n(139)]=s[n(129)](t[n(128)][0][0],t[n(128)][0][1],t[n(128)][1][0],t[n(128)][1][1])),r})),c=l[e(145)](n,a),h=p[e(157)](c,{});return r&&(h.alpha=r),this[e(151)][e(158)][e(124)](h),this[e(151)][e(132)].requestRender(),h}async[M(144)](t){const e=M;t instanceof p&&(this._viewer[e(158)].remove(t,!0),this[e(151)].scene[e(153)]())}[M(146)](t,e){const n=M;if(e instanceof p)if(e[n(122)]){const t=e[n(123)]();this[n(151)].scene[n(148)].flyTo({destination:t})}else e[n(147)].addEventListener((t=>{const s=n,r=e[s(123)]();this[s(151)][s(132)][s(148)][s(160)]({destination:r})}))}[M(125)](t,e){const n=M;t instanceof p&&(t[n(125)]=e,this._viewer.scene[n(153)]())}}const x=C;function C(t,e){const n=F();return(C=function(t,e){return n[t-=177]})(t,e)}function F(){const t=["tileWidth","load","3132101oqgBWC","minimumLevel","alpha","east","22350550nNEPqN","imageryLayers","{z}/{x}/{y}.png","GET","_viewer","camera","substr","maxzoom","ready","bounds","north","show","type","tileHeight","meta.json","south","json","4832AMoPQI","then","add","maximumLevel","1555494mwcHdR","485003YrTqvX","getImageryRectangle","scene","remove","tilesize","4OQSIHA","URLTemplate","12186kjPUqe","minzoom","requestRender","5hlbyWT","tilingScheme","west","fromDegrees","1742640LBtLJQ","3050448gjAWEZ"];return(F=function(){return t})()}!function(){const t=C,e=F();for(;;)try{if(818583===-parseInt(t(194))/1*(parseInt(t(199))/2)+-parseInt(t(209))/3+-parseInt(t(208))/4+parseInt(t(204))/5*(-parseInt(t(193))/6)+parseInt(t(212))/7+parseInt(t(189))/8*(parseInt(t(201))/9)+parseInt(t(216))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class k{constructor(t){this[C(220)]=t}async[x(211)](t){const e=x;if((t=t??{})[e(184)]!==e(200))throw new Error("the layer type is not 'URLTemplate'");const{url:n,alpha:r}=t;if(!n)throw new Error("the url is needed");let i=e(218),o=n[e(178)](0,n.indexOf(i))+e(186);const a=await fetch(o,{method:e(219)}).then((t=>t[e(188)]()))[e(190)]((t=>{const r=e,i={url:n};return t&&t[r(181)]&&(i.rectangle=s[r(207)](t[r(181)][r(206)],t[r(181)][r(187)],t.bounds[r(215)],t.bounds[r(182)])),t&&4326==t.proj&&(i[r(205)]=new f({ellipsoid:d.WGS84})),t&&t[r(179)]&&(i[r(192)]=t[r(179)]),t&&t[r(202)]&&(i[r(213)]=t[r(202)]),t&&t[r(198)]&&(i[r(210)]=i[r(185)]=t[r(198)]),i})),c=new y(a),h=new p(c,{});return r&&(h[e(214)]=r),this[e(220)].imageryLayers[e(191)](h),this[e(220)][e(196)].requestRender(),h}async remove(t){const e=x;t instanceof p&&(this[e(220)][e(217)][e(197)](t,!0),this[e(220)][e(196)][e(203)]())}locate(t,e){const n=x;if(e instanceof p)if(e[n(180)]){const t=e[n(195)]();this._viewer[n(196)][n(177)].flyTo({destination:t})}else e.readyEvent.addEventListener((t=>{const s=n,r=e.getImageryRectangle();this._viewer[s(196)][s(177)].flyTo({destination:r})}))}[x(183)](t,e){const n=x;t instanceof p&&(t[n(183)]=e,this._viewer.scene[n(203)]())}}const D=j;function j(t,e){const n=W();return(j=function(t,e){return n[t-=208]})(t,e)}!function(){const t=j,e=W();for(;;)try{if(954816===-parseInt(t(224))/1+parseInt(t(227))/2+parseInt(t(212))/3*(-parseInt(t(209))/4)+-parseInt(t(217))/5*(parseInt(t(222))/6)+parseInt(t(223))/7*(parseInt(t(211))/8)+-parseInt(t(214))/9*(-parseInt(t(216))/10)+parseInt(t(226))/11)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class B{constructor(t){this[j(229)]=t}async load(t){const e=j;if((t=t??{})[e(210)]!==e(213))throw new Error(e(228));const{url:n,clampToGround:s}=t;if(!n)throw new Error("the url is needed");const r=new v({options:{useGroundGeometry:s??!1,clampToGround:s??!1,scene:this._viewer[e(230)]}});return await r[e(220)](n),this[e(229)][e(230)][e(221)].add(r[e(219)]),this[e(229)][e(230)][e(208)](),r}async[D(218)](t){const e=D;t instanceof v&&(this[e(229)][e(230)][e(221)].remove(t[e(219)]),this[e(229)][e(230)].requestRender())}locate(t,e){const n=D;e instanceof v&&e[n(215)](this[n(229)],{tolerance:.015})}show(t,e){const n=D;t instanceof v&&(t.primitiveCollection[n(225)]=e,this[n(229)][n(230)].requestRender())}}function W(){const t=["load","primitives","10406724RNUqZe","49FqfQkm","224674FqbAQh","show","6744793MlBPij","3398132KIbUVq","the layer type is not 'GEOJSON'","_viewer","scene","requestRender","8LHaVGR","type","301752tOKEdO","1660641uCjfGt","GEOJSON","351432hCiOEZ","flyTo","370BCiwNp","5eUYLjg","remove","primitiveCollection"];return(W=function(){return t})()}const K=O;function O(t,e){const n=U();return(O=function(t,e){return n[t-=359]})(t,e)}function U(){const t=["camera","add","the layer type is not 'WMS'","remove","addEventListener","WMS","locate","getImageryRectangle","requestRender","show","555618mqGHeV","3504948PvDxQW","48FMGrXR","308XqHTfV","5543mjWGRJ","441uizQzl","imageryLayers","19233368AxXMMZ","8694CQspFX","24170TrmksL","5624HkbgJR","the url is needed","scene","type","38860ywrclZ","_viewer"];return(U=function(){return t})()}!function(){const t=O,e=U();for(;;)try{if(525940===parseInt(t(378))/1*(-parseInt(t(377))/2)+-parseInt(t(374))/3+-parseInt(t(375))/4+parseInt(t(362))/5*(-parseInt(t(376))/6)+parseInt(t(382))/7*(parseInt(t(384))/8)+parseInt(t(379))/9*(-parseInt(t(383))/10)+parseInt(t(381))/11)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class Z{constructor(t){this[O(363)]=t}async load(t){const e=O;if((t=t??{})[e(361)]!==e(369))throw new Error(e(366));const{url:n,layers:s}=t;if(!n)throw new Error(e(359));if(!s)throw new Error("the layers is needed");const r=new w(t),i=new p(r,{});return this._viewer.imageryLayers[e(365)](i),this[e(363)][e(360)].requestRender(),i}async[K(367)](t){const e=K;t instanceof p&&(this[e(363)][e(380)][e(367)](t,!0),this[e(363)][e(360)].requestRender())}[K(370)](t,e){const n=K;if(e instanceof p)if(e.ready){const t=e[n(371)]();this[n(363)][n(360)].camera.flyTo({destination:t})}else e.readyEvent[n(368)]((t=>{const s=n,r=e[s(371)]();this[s(363)][s(360)][s(364)].flyTo({destination:r})}))}[K(373)](t,e){const n=K;t instanceof p&&(t.show=e,this._viewer[n(360)][n(372)]())}}const H=z;function N(){const t=["tileMatrixLabels","6129104dFOZpu","show","306OnodxR","20678jIdoSB","16tFwmUp","6041979ubQCSA","locate","10346680MSeByS","getImageryRectangle","scene","format","imageryLayers","1898135auqvwS","requestRender","remove","WMTS","the url is needed","tilingScheme","flyTo","1MsGrsR","the layer type is not 'WMTS'","the layer is needed","the tileMatrixSetID is needed","add","_viewer","load","549897TEhklI","387606IogWWU","addEventListener","camera"];return(N=function(){return t})()}!function(){const t=z,e=N();for(;;)try{if(411913===parseInt(t(418))/1*(-parseInt(t(426))/2)+parseInt(t(425))/3*(parseInt(t(434))/4)+-parseInt(t(442))/5+-parseInt(t(432))/6*(parseInt(t(433))/7)+parseInt(t(430))/8+parseInt(t(435))/9+-parseInt(t(437))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class P{constructor(t){this[z(423)]=t}async[H(424)](t){const e=H;if((t=t??{}).type!==e(445))throw new Error(e(419));const{url:n,layer:s,style:r,tileMatrixSetID:i,subdomains:o,format:a,tilingScheme:c,tileMatrixLabels:h}=t;if(!n)throw new Error(e(446));if(!s)throw new Error(e(420));if(!r)throw new Error("the style is needed");if(!i)throw new Error(e(421));const u={url:n,layer:s,style:r,tileMatrixSetID:i};o&&(u.subdomains=o),a&&(u[e(440)]=a),c&&(u[e(447)]=c),h&&(u[e(429)]=h);const l=new I(u),f=new p(l,{});return this[e(423)][e(441)][e(422)](f),this[e(423)][e(439)][e(443)](),f}async[H(444)](t){const e=H;t instanceof p&&(this[e(423)].imageryLayers[e(444)](t,!0),this._viewer.scene[e(443)]())}[H(436)](t,e){const n=H;if(e instanceof p)if(e.ready){const t=e.getImageryRectangle();this._viewer.scene[n(428)].flyTo({destination:t})}else e.readyEvent[n(427)]((t=>{const s=n,r=e[s(438)]();this[s(423)][s(439)][s(428)][s(417)]({destination:r})}))}[H(431)](t,e){const n=H;t instanceof p&&(t[n(431)]=e,this[n(423)].scene[n(443)]())}}function z(t,e){const n=N();return(z=function(t,e){return n[t-=417]})(t,e)}function J(){const t=["60ZUwwty","show","_viewer","flyTo","requestRender","then","267TEvOCc","63hpNEFK","dataSources","remove","load","add","canvas","879288DFGnKS","40zqyFAg","KMZ","90sJEpoa","15153SPdNff","724480fhHsqj","scene","KML","275824jwyANL","the layer type is not 'KML' or 'KMZ","499851WZDMiu","1194256hBkXqG"];return(J=function(){return t})()}const X=Q;function Q(t,e){const n=J();return(Q=function(t,e){return n[t-=430]})(t,e)}!function(){const t=Q,e=J();for(;;)try{if(176151===-parseInt(t(444))/1*(parseInt(t(454))/2)+-parseInt(t(430))/3*(-parseInt(t(452))/4)+parseInt(t(431))/5+-parseInt(t(451))/6+parseInt(t(437))/7+parseInt(t(434))/8*(parseInt(t(445))/9)+parseInt(t(438))/10*(-parseInt(t(436))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class V{constructor(t){this[Q(440)]=t}async[X(448)](t){const e=X,n=(t=t??{}).type;if(n!==e(433)&&n!==e(453))throw new Error(e(435));const{url:s,clampToGround:r}=t;if(!s)throw new Error("the url is needed");return this[e(440)][e(446)][e(449)](m[e(448)](s,{camera:this[e(440)][e(432)].camera,canvas:this[e(440)][e(432)][e(450)],clampToGround:r??!1}))}async[X(447)](t){const e=X;(null==t?void 0:t[e(443)])&&t[e(443)]((t=>{const n=e;this[n(440)][n(446)].remove(t),this[n(440)][n(432)][n(442)]()})),t instanceof m&&(this._viewer[e(446)][e(447)](t),this[e(440)].scene[e(442)]())}locate(t,e){const n=X;(null==e?void 0:e[n(443)])&&e.then((t=>{const e=n;this._viewer[e(441)](t)})),e instanceof m&&this[n(440)][n(441)](e)}[X(439)](t,e){const n=X;(null==t?void 0:t[n(443)])&&t.then((t=>{const s=n;t[s(439)]=e,this[s(440)][s(432)][s(442)]()})),t instanceof m&&(t.show=e,this[n(440)].scene.requestRender())}}const Y=tt;function $(){const t=["10KgvCBm","KML","28167iggFLa","_url","_remove","set","780258bSKPmP","_viewer","WMS","showById","83370dxbRLf","TERRAIN","_layersMap","has","50646057kEZzJZ","GEOJSON","type","URLTemplate","210uvuZBx","_show","120NTKxvm","_load","show","get","_typeClassMap","_id","url","the layer with id '","请输入Viewer对象!","removeById","ARCGIS","remove","includes","' is already loaded","bind","293144elnvDF","_initLoader","the url is needed","3DTILES","204sUBJgr","1011878hUFOMh","locate","delete","_type","loadAsync","' is not support","_typeClass","_isSupport","5647131aqVBoI","WMTS","_locate","the type '"];return($=function(){return t})()}function tt(t,e){const n=$();return(tt=function(t,e){return n[t-=217]})(t,e)}!function(){const t=tt,e=$();for(;;)try{if(663112===-parseInt(t(218))/1+-parseInt(t(236))/2+-parseInt(t(232))/3*(parseInt(t(217))/4)+-parseInt(t(250))/5*(parseInt(t(240))/6)+-parseInt(t(248))/7*(parseInt(t(265))/8)+-parseInt(t(226))/9*(parseInt(t(230))/10)+parseInt(t(244))/11)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class et{constructor(t){const e=tt;if(!t)throw new Error(e(258));this[e(237)]=t,this[e(242)]=new Map,this[e(254)]=new Map}[Y(266)](){const t=Y,e=this[t(254)][t(253)](this[t(221)]);e?this[t(224)]=e:(this[t(221)]===t(241)?this[t(224)]=new _(this[t(237)]):this[t(221)]===t(268)?this._typeClass=new L(this._viewer):this[t(221)]===t(260)?this[t(224)]=new G(this[t(237)]):"URLTemplate"===this[t(221)]?this[t(224)]=new k(this[t(237)]):"WMS"===this[t(221)]?this[t(224)]=new Z(this[t(237)]):this[t(221)]===t(227)?this[t(224)]=new P(this._viewer):"KML"===this[t(221)]?this[t(224)]=new V(this[t(237)]):this[t(221)]===t(245)&&(this[t(224)]=new B(this._viewer)),this._typeClassMap[t(235)](this[t(221)],this[t(224)])),this[t(251)]=this[t(224)].load[t(264)](this[t(224)]),this[t(234)]=this._typeClass[t(261)][t(264)](this[t(224)]),this._locate=this[t(224)][t(219)].bind(this[t(224)]),this[t(249)]=this[t(224)][t(252)][t(264)](this[t(224)])}async[Y(222)](t){const e=Y;if(t=t??{},this._id=t.id,this[e(242)][e(243)](this[e(255)]))throw new Error(e(257)+this._id+e(263));if(this[e(233)]=t[e(256)],!this[e(233)])throw new Error(e(267));if(this[e(221)]=t[e(246)],!this[e(225)](t.type))throw new Error(e(229)+t.type+e(223));if(this[e(266)](),"KML"===t.type){const n=this[e(251)](t);n instanceof Promise&&this[e(242)].set(t.id,{options:t,layer:n})}else{const e=await this._load(t);this._layersMap.set(t.id,{options:t,layer:e})}}[Y(225)](t){const e=Y;return[e(241),e(268),e(260),e(247),e(238),e(227),e(231),e(245)][e(262)](t)}[Y(259)](t){const e=Y,n=this[e(242)][e(253)](t);if(this[e(242)][e(220)](t),!n)return;const{options:s,layer:r}=n;r&&(this[e(221)]=s.type,this._initLoader(),this[e(234)](r))}locateById(t){const e=Y,n=this[e(242)][e(253)](t);if(!n)return;const{options:s,layer:r}=n;r&&(this[e(221)]=s[e(246)],this[e(266)](),this[e(228)](s,r))}[Y(239)](t,e){const n=Y,s=this[n(242)].get(t);if(!s)return;const{options:r,layer:i}=s;i&&(this._type=r[n(246)],this._initLoader(),this._show(i,e))}destroy(){}}export{et 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.0.11",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",