@nsc-earth-2/layer 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{defaultValue as t,Terrain as s,CesiumTerrainProvider as i,EllipsoidTerrainProvider as e,Rectangle as n,Cesium3DTileset as o,Matrix4 as r,Cartographic as h,Cartesian3 as a,Transforms as c,Matrix3 as l,Math as w,ArcGisMapServerImageryProvider as d,ImageryLayer as f,GeographicTilingScheme as y,Ellipsoid as u,UrlTemplateImageryProvider as m,WebMapServiceImageryProvider as p,WebMapTileServiceImageryProvider as E,KmlDataSource as S}from"cesium";import{GeoJsonPrimitiveLayer as v}from"@nsc-earth-2/primitive-geojson";class T{constructor(t){this.t=t}load(e){e=t(e,{});if("TERRAIN"!==t(e.type,void 0))throw new Error("the layer type is not 'TERRAIN'");const n=t(e.url,void 0),o=new s(i.i(n));return this.t.h.o(o),this.t.h.l(),Promise.resolve(o)}remove(t){const s=new e;this.t.u=s,this.t.h.l()}m(s,i){s=t(s,{});const e=t(s.url,void 0);fetch(`${e}/layer.json`).then((t=>t.json())).then((t=>{t.p&&Array.isArray(t.p)&&4===t.p.length?this.t.v.S({destination:n.T(t.p[0],t.p[1],t.p[2],t.p[3])}):t.bounds&&Array.isArray(t.bounds)&&4==t.bounds.length&&this.t.v.S({destination:n.T(t.bounds[0],t.bounds[1],t.bounds[2],t.bounds[3])})}))}show(t,i){if(t instanceof s){if(i)this.t.h.o(t);else{const t=new e;this.t.u=t}this.t.h.l()}}}class M{constructor(t){this.t=t}async load(s){s=t(s,{});if("3DTILES"!==t(s.type,void 0))throw new Error("the layer type is not '3DTILES'");const i=s.url;if(!i)throw new Error("the url is needed");const e={longitude:t(s.longitude,0),latitude:t(s.latitude,0),altitude:t(s.altitude,0),azimuth:t(s.azimuth,0)},n=await o.i(i,{M:!0,I:.00278,G:4,R:.25});return this.L(n,e),this.t.h.A.add(n),this.t.h.l(),n}L(t,s){const{longitude:i,latitude:e,altitude:n,azimuth:o}=s;let d=new r;if(i&&e){let t=n;0==n&&(t=this.t.h.N.D(h.T(i,e))||0);const s=a.T(i,e,t),f=c.O(s),y=new l(1,0,0,0,1,0,0,0,1),u=l.W(w.K(o));l.multiply(y,u,y),d=r.j(f,y,new r)}else if(n){const s=new a;r.P(t.root.transform,s);const i=h.C(s);if(i){const t=w.J(i.latitude),s=w.J(i.longitude),e=a.T(s,t,n),h=c.O(e),f=new l(1,0,0,0,1,0,0,0,1),y=l.W(w.K(o));l.multiply(f,y,f),d=r.j(h,f,new r)}}else if(o){const s=new l(1,0,0,0,1,0,0,0,1),i=l.W(w.K(o));l.multiply(s,i,s),d=r.j(t.root.transform,s,new r)}else d=t.root.transform;t.root.transform=d}remove(t){t instanceof o&&(this.t.h.A.remove(t),this.t.h.l())}m(t,s){s instanceof o&&this.t.S(s)}show(t,s){t instanceof o&&(t.show=s,this.t.h.l())}}class I{constructor(t){this.t=t}async load(s){s=t(s,{});if("ARCGIS"!==t(s.type,void 0))throw new Error("the layer type is not 'ARCGIS'");const{url:i,alpha:e,U:o}=s;if(!i)throw new Error("the url is needed");let r=i;r=o?i+"/info/iteminfo?f=pjson&token="+o:i+"/info/iteminfo?f=pjson";const h=await fetch(r,{method:"GET"}).then((t=>t.json())).then((t=>{const s={};return o&&(s.U=o),t&&t.B&&Array.isArray(t.B)&&(s.$=n.T(t.B[0][0],t.B[0][1],t.B[1][0],t.B[1][1])),s})),a=d.i(i,h),c=f.k(a,{});return e&&(c.alpha=e),this.t.F.add(c),this.t.h.l(),c}async remove(t){t instanceof f&&(this.t.F.remove(t,!0),this.t.h.l())}m(t,s){if(s instanceof f)if(s.ready){const t=s.Z();this.t.h.v.S({destination:t})}else s._.addEventListener((t=>{const i=s.Z();this.t.h.v.S({destination:i})}))}show(t,s){t instanceof f&&(t.show=s,this.t.h.l())}}class G{constructor(t){this.t=t}async load(s){s=t(s,{});if("URLTemplate"!==t(s.type,void 0))throw new Error("the layer type is not 'URLTemplate'");const{url:i,alpha:e}=s;if(!i)throw new Error("the url is needed");let o=i.substr(0,i.indexOf("{z}/{x}/{y}.png"))+"meta.json";const r=await fetch(o,{method:"GET"}).then((t=>t.json())).then((t=>{const s={url:i};return t&&t.bounds&&(s.$=n.T(t.bounds.H,t.bounds.V,t.bounds.q,t.bounds.X)),t&&4326==t.Y&&(s.tt=new y({st:u.it})),t&&t.et&&(s.nt=t.et),t&&t.ot&&(s.rt=t.ot),t&&t.ht&&(s.ct=s.lt=t.ht),s})),h=new m(r),a=new f(h,{});return e&&(a.alpha=e),this.t.F.add(a),this.t.h.l(),a}async remove(t){t instanceof f&&(this.t.F.remove(t,!0),this.t.h.l())}m(t,s){if(s instanceof f)if(s.ready){const t=s.Z();this.t.h.v.S({destination:t})}else s._.addEventListener((t=>{const i=s.Z();this.t.h.v.S({destination:i})}))}show(t,s){t instanceof f&&(t.show=s,this.t.h.l())}}class R{constructor(t){this.t=t}async load(s){s=t(s,{});if("GEOJSON"!==t(s.type,void 0))throw new Error("the layer type is not 'GEOJSON'");const{url:i,wt:e}=s;if(!i)throw new Error("the url is needed");const n=new v({options:{dt:e??!1,wt:e??!1,h:this.t.h}});return await n.load(i),this.t.h.A.add(n.ft),this.t.h.l(),n}async remove(t){t instanceof v&&(this.t.h.A.remove(t.ft),this.t.h.l())}m(t,s){s instanceof v&&s.S(this.t,{yt:.015})}show(t,s){t instanceof v&&(t.ft.show=s,this.t.h.l())}}class L{constructor(t){this.t=t}async load(s){s=t(s,{});if("WMS"!==t(s.type,void 0))throw new Error("the layer type is not 'WMS'");const{url:i,ut:e}=s;if(!i)throw new Error("the url is needed");if(!e)throw new Error("the layers is needed");const n=new p({url:i}),o=new f(n,{});return this.t.F.add(o),this.t.h.l(),o}async remove(t){t instanceof f&&(this.t.F.remove(t,!0),this.t.h.l())}m(t,s){if(s instanceof f)if(s.ready){const t=s.Z();this.t.h.v.S({destination:t})}else s._.addEventListener((t=>{const i=s.Z();this.t.h.v.S({destination:i})}))}show(t,s){t instanceof f&&(t.show=s,this.t.h.l())}}class A{constructor(t){this.t=t}async load(s){s=t(s,{});if("WMTS"!==t(s.type,void 0))throw new Error("the layer type is not 'WMTS'");const{url:i,Et:e,style:n,St:o,vt:r,format:h,tt:a,Tt:c}=s;if(!i)throw new Error("the url is needed");if(!e)throw new Error("the layer is needed");if(!n)throw new Error("the style is needed");if(!o)throw new Error("the tileMatrixSetID is needed");const l={url:i,Et:e,style:n,St:o};r&&(l.vt=r),h&&(l.format=h),a&&(l.tt=a),c&&(l.Tt=c);const w=new E(l),d=new f(w,{});return this.t.F.add(d),this.t.h.l(),d}async remove(t){t instanceof f&&(this.t.F.remove(t,!0),this.t.h.l())}m(t,s){if(s instanceof f)if(s.ready){const t=s.Z();this.t.h.v.S({destination:t})}else s._.addEventListener((t=>{const i=s.Z();this.t.h.v.S({destination:i})}))}show(t,s){t instanceof f&&(t.show=s,this.t.h.l())}}class D{constructor(t){this.t=t}async load(s){s=t(s,{});const i=t(s.type,void 0);if("KML"!==i&&"KMZ"!==i)throw new Error("the layer type is not 'KML' or 'KMZ");const{url:e,wt:n}=s;if(!e)throw new Error("the url is needed");return this.t.Mt.add(S.load(e,{v:this.t.h.v,canvas:this.t.h.canvas,wt:n??!1}))}async remove(t){t instanceof Promise&&t.then((t=>{this.t.Mt.remove(t),this.t.h.l()})),t instanceof S&&(this.t.Mt.remove(t),this.t.h.l())}m(t,s){s instanceof Promise&&s.then((t=>{this.t.S(t)})),s instanceof S&&this.t.S(s)}show(t,s){t instanceof Promise&&t.then((t=>{t.show=s,this.t.h.l()})),t instanceof S&&(t.show=s,this.t.h.l())}}class N{constructor(t){if(!t)throw new Error("请输入Viewer对象!");this.t=t,this.It=new Map,this.Gt=new Map}Rt(){const t=this.Gt.get(this.Lt);t?this.At=t:("TERRAIN"===this.Lt?this.At=new T(this.t):"3DTILES"===this.Lt?this.At=new M(this.t):"ARCGIS"===this.Lt?this.At=new I(this.t):"URLTemplate"===this.Lt?this.At=new G(this.t):"WMS"===this.Lt?this.At=new L(this.t):"WMTS"===this.Lt?this.At=new A(this.t):"KML"===this.Lt?this.At=new D(this.t):"GEOJSON"===this.Lt&&(this.At=new R(this.t)),this.Gt.set(this.Lt,this.At)),this.Dt=this.At.load.bind(this.At),this.Nt=this.At.remove.bind(this.At),this.Ot=this.At.m.bind(this.At),this.Wt=this.At.show.bind(this.At)}async Kt(s){if(s=t(s,{}),this.gt=t(s.id,void 0),this.It.has(this.gt))throw new Error(`the layer with id '${this.gt}' is already loaded`);if(this.xt=t(s.url,void 0),!this.xt)throw new Error("the url is needed");if(this.Lt=t(s.type,void 0),!this.jt(s.type))throw new Error(`the type '${s.type}' is not support`);if(this.Rt(),"KML"===s.type){const t=this.Dt(s);t instanceof Promise&&this.It.set(s.id,{options:s,Et:t})}else{const t=await this.Dt(s);this.It.set(s.id,{options:s,Et:t})}}jt(t){return["TERRAIN","3DTILES","ARCGIS","URLTemplate","WMS","WMTS","KML","GEOJSON"].includes(t)}Pt(t){const s=this.It.get(t);if(this.It.delete(t),!s)return;const{options:i,Et:e}=s;e&&(this.Lt=i.type,this.Rt(),this.Nt(e))}Ct(t){const s=this.It.get(t);if(!s)return;const{options:i,Et:e}=s;e&&(this.Lt=i.type,this.Rt(),this.Ot(i,e))}Jt(t,s){const i=this.It.get(t);if(!i)return;const{options:e,Et:n}=i;n&&(this.Lt=e.type,this.Rt(),this.Wt(n,s))}destroy(){}}export{N as default};
1
+ import{defaultValue as e,Terrain as t,CesiumTerrainProvider as s,EllipsoidTerrainProvider as r,Rectangle as i,Cesium3DTileset as n,Matrix4 as o,Cartographic as a,Cartesian3 as h,Transforms as l,Matrix3 as c,Math as d,ArcGisMapServerImageryProvider as w,ImageryLayer as y,GeographicTilingScheme as _,Ellipsoid as v,UrlTemplateImageryProvider as m,WebMapServiceImageryProvider as u,WebMapTileServiceImageryProvider as p,KmlDataSource as f}from"cesium";import{GeoJsonPrimitiveLayer as g}from"@nsc-earth-2/primitive-geojson";class R{constructor(e){this._viewer=e}load(r){r=e(r,{});if("TERRAIN"!==e(r.type,void 0))throw new Error("the layer type is not 'TERRAIN'");const i=e(r.url,void 0),n=new t(s.fromUrl(i));return this._viewer.scene.setTerrain(n),this._viewer.scene.requestRender(),Promise.resolve(n)}remove(e){const t=new r;this._viewer.terrainProvider=t,this._viewer.scene.requestRender()}locate(t,s){t=e(t,{});const r=e(t.url,void 0);fetch(`${r}/layer.json`).then((e=>e.json())).then((e=>{e.valid_bounds&&Array.isArray(e.valid_bounds)&&4===e.valid_bounds.length?this._viewer.camera.flyTo({destination:i.fromDegrees(e.valid_bounds[0],e.valid_bounds[1],e.valid_bounds[2],e.valid_bounds[3])}):e.bounds&&Array.isArray(e.bounds)&&4==e.bounds.length&&this._viewer.camera.flyTo({destination:i.fromDegrees(e.bounds[0],e.bounds[1],e.bounds[2],e.bounds[3])})}))}show(e,s){if(e instanceof t){if(s)this._viewer.scene.setTerrain(e);else{const e=new r;this._viewer.terrainProvider=e}this._viewer.scene.requestRender()}}}class E{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("3DTILES"!==e(t.type,void 0))throw new Error("the layer type is not '3DTILES'");const s=t.url;if(!s)throw new Error("the url is needed");const r={longitude:e(t.longitude,0),latitude:e(t.latitude,0),altitude:e(t.altitude,0),azimuth:e(t.azimuth,0)},i=await n.fromUrl(s,{dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:.00278,dynamicScreenSpaceErrorFactor:4,dynamicScreenSpaceErrorHeightFalloff:.25});return this.transferTileSet(i,r),this._viewer.scene.primitives.add(i),this._viewer.scene.requestRender(),i}transferTileSet(e,t){const{longitude:s,latitude:r,altitude:i,azimuth:n}=t;let w=new o;if(s&&r){let e=i;0==i&&(e=this._viewer.scene.globe.getHeight(a.fromDegrees(s,r))||0);const t=h.fromDegrees(s,r,e),y=l.eastNorthUpToFixedFrame(t),_=new c(1,0,0,0,1,0,0,0,1),v=c.fromRotationZ(d.toRadians(n));c.multiply(_,v,_),w=o.multiplyByMatrix3(y,_,new o)}else if(i){const t=new h;o.getTranslation(e.root.transform,t);const s=a.fromCartesian(t);if(s){const e=d.toDegrees(s.latitude),t=d.toDegrees(s.longitude),r=h.fromDegrees(t,e,i),a=l.eastNorthUpToFixedFrame(r),y=new c(1,0,0,0,1,0,0,0,1),_=c.fromRotationZ(d.toRadians(n));c.multiply(y,_,y),w=o.multiplyByMatrix3(a,y,new o)}}else if(n){const t=new c(1,0,0,0,1,0,0,0,1),s=c.fromRotationZ(d.toRadians(n));c.multiply(t,s,t),w=o.multiplyByMatrix3(e.root.transform,t,new o)}else w=e.root.transform;e.root.transform=w}remove(e){e instanceof n&&(this._viewer.scene.primitives.remove(e),this._viewer.scene.requestRender())}locate(e,t){t instanceof n&&this._viewer.flyTo(t)}show(e,t){e instanceof n&&(e.show=t,this._viewer.scene.requestRender())}}class T{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("ARCGIS"!==e(t.type,void 0))throw new Error("the layer type is not 'ARCGIS'");const{url:s,alpha:r,token:n}=t;if(!s)throw new Error("the url is needed");let o=s;o=n?s+"/info/iteminfo?f=pjson&token="+n:s+"/info/iteminfo?f=pjson";const a=await fetch(o,{method:"GET"}).then((e=>e.json())).then((e=>{const t={};return n&&(t.token=n),e&&e.extent&&Array.isArray(e.extent)&&(t.rectangle=i.fromDegrees(e.extent[0][0],e.extent[0][1],e.extent[1][0],e.extent[1][1])),t})),h=w.fromUrl(s,a),l=y.fromProviderAsync(h,{});return r&&(l.alpha=r),this._viewer.imageryLayers.add(l),this._viewer.scene.requestRender(),l}async remove(e){e instanceof y&&(this._viewer.imageryLayers.remove(e,!0),this._viewer.scene.requestRender())}locate(e,t){if(t instanceof y)if(t.ready){const e=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:e})}else t.readyEvent.addEventListener((e=>{const s=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:s})}))}show(e,t){e instanceof y&&(e.show=t,this._viewer.scene.requestRender())}}class S{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("URLTemplate"!==e(t.type,void 0))throw new Error("the layer type is not 'URLTemplate'");const{url:s,alpha:r}=t;if(!s)throw new Error("the url is needed");let n=s.substr(0,s.indexOf("{z}/{x}/{y}.png"))+"meta.json";const o=await fetch(n,{method:"GET"}).then((e=>e.json())).then((e=>{const t={url:s};return e&&e.bounds&&(t.rectangle=i.fromDegrees(e.bounds.west,e.bounds.south,e.bounds.east,e.bounds.north)),e&&4326==e.proj&&(t.tilingScheme=new _({ellipsoid:v.WGS84})),e&&e.maxzoom&&(t.maximumLevel=e.maxzoom),e&&e.minzoom&&(t.minimumLevel=e.minzoom),e&&e.tilesize&&(t.tileWidth=t.tileHeight=e.tilesize),t})),a=new m(o),h=new y(a,{});return r&&(h.alpha=r),this._viewer.imageryLayers.add(h),this._viewer.scene.requestRender(),h}async remove(e){e instanceof y&&(this._viewer.imageryLayers.remove(e,!0),this._viewer.scene.requestRender())}locate(e,t){if(t instanceof y)if(t.ready){const e=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:e})}else t.readyEvent.addEventListener((e=>{const s=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:s})}))}show(e,t){e instanceof y&&(e.show=t,this._viewer.scene.requestRender())}}class M{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("GEOJSON"!==e(t.type,void 0))throw new Error("the layer type is not 'GEOJSON'");const{url:s,clampToGround:r}=t;if(!s)throw new Error("the url is needed");const i=new g({options:{useGroundGeometry:r??!1,clampToGround:r??!1,scene:this._viewer.scene}});return await i.load(s),this._viewer.scene.primitives.add(i.primitiveCollection),this._viewer.scene.requestRender(),i}async remove(e){e instanceof g&&(this._viewer.scene.primitives.remove(e.primitiveCollection),this._viewer.scene.requestRender())}locate(e,t){t instanceof g&&t.flyTo(this._viewer,{tolerance:.015})}show(e,t){e instanceof g&&(e.primitiveCollection.show=t,this._viewer.scene.requestRender())}}class L{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("WMS"!==e(t.type,void 0))throw new Error("the layer type is not 'WMS'");const{url:s,layers:r}=t;if(!s)throw new Error("the url is needed");if(!r)throw new Error("the layers is needed");const i=new u({url:s}),n=new y(i,{});return this._viewer.imageryLayers.add(n),this._viewer.scene.requestRender(),n}async remove(e){e instanceof y&&(this._viewer.imageryLayers.remove(e,!0),this._viewer.scene.requestRender())}locate(e,t){if(t instanceof y)if(t.ready){const e=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:e})}else t.readyEvent.addEventListener((e=>{const s=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:s})}))}show(e,t){e instanceof y&&(e.show=t,this._viewer.scene.requestRender())}}class b{constructor(e){this._viewer=e}async load(t){t=e(t,{});if("WMTS"!==e(t.type,void 0))throw new Error("the layer type is not 'WMTS'");const{url:s,layer:r,style:i,tileMatrixSetID:n,subdomains:o,format:a,tilingScheme:h,tileMatrixLabels:l}=t;if(!s)throw new Error("the url is needed");if(!r)throw new Error("the layer is needed");if(!i)throw new Error("the style is needed");if(!n)throw new Error("the tileMatrixSetID is needed");const c={url:s,layer:r,style:i,tileMatrixSetID:n};o&&(c.subdomains=o),a&&(c.format=a),h&&(c.tilingScheme=h),l&&(c.tileMatrixLabels=l);const d=new p(c),w=new y(d,{});return this._viewer.imageryLayers.add(w),this._viewer.scene.requestRender(),w}async remove(e){e instanceof y&&(this._viewer.imageryLayers.remove(e,!0),this._viewer.scene.requestRender())}locate(e,t){if(t instanceof y)if(t.ready){const e=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:e})}else t.readyEvent.addEventListener((e=>{const s=t.getImageryRectangle();this._viewer.scene.camera.flyTo({destination:s})}))}show(e,t){e instanceof y&&(e.show=t,this._viewer.scene.requestRender())}}class C{constructor(e){this._viewer=e}async load(t){t=e(t,{});const s=e(t.type,void 0);if("KML"!==s&&"KMZ"!==s)throw new Error("the layer type is not 'KML' or 'KMZ");const{url:r,clampToGround:i}=t;if(!r)throw new Error("the url is needed");return this._viewer.dataSources.add(f.load(r,{camera:this._viewer.scene.camera,canvas:this._viewer.scene.canvas,clampToGround:i??!1}))}async remove(e){e instanceof Promise&&e.then((e=>{this._viewer.dataSources.remove(e),this._viewer.scene.requestRender()})),e instanceof f&&(this._viewer.dataSources.remove(e),this._viewer.scene.requestRender())}locate(e,t){t instanceof Promise&&t.then((e=>{this._viewer.flyTo(e)})),t instanceof f&&this._viewer.flyTo(t)}show(e,t){e instanceof Promise&&e.then((e=>{e.show=t,this._viewer.scene.requestRender()})),e instanceof f&&(e.show=t,this._viewer.scene.requestRender())}}class I{constructor(e){if(!e)throw new Error("请输入Viewer对象!");this._viewer=e,this._layersMap=new Map,this._typeClassMap=new Map}_initLoader(){const e=this._typeClassMap.get(this._type);e?this._typeClass=e:("TERRAIN"===this._type?this._typeClass=new R(this._viewer):"3DTILES"===this._type?this._typeClass=new E(this._viewer):"ARCGIS"===this._type?this._typeClass=new T(this._viewer):"URLTemplate"===this._type?this._typeClass=new S(this._viewer):"WMS"===this._type?this._typeClass=new L(this._viewer):"WMTS"===this._type?this._typeClass=new b(this._viewer):"KML"===this._type?this._typeClass=new C(this._viewer):"GEOJSON"===this._type&&(this._typeClass=new M(this._viewer)),this._typeClassMap.set(this._type,this._typeClass)),this._load=this._typeClass.load.bind(this._typeClass),this._remove=this._typeClass.remove.bind(this._typeClass),this._locate=this._typeClass.locate.bind(this._typeClass),this._show=this._typeClass.show.bind(this._typeClass)}async loadAsync(t){if(t=e(t,{}),this._id=e(t.id,void 0),this._layersMap.has(this._id))throw new Error(`the layer with id '${this._id}' is already loaded`);if(this._url=e(t.url,void 0),!this._url)throw new Error("the url is needed");if(this._type=e(t.type,void 0),!this._isSupport(t.type))throw new Error(`the type '${t.type}' is not support`);if(this._initLoader(),"KML"===t.type){const e=this._load(t);e instanceof Promise&&this._layersMap.set(t.id,{options:t,layer:e})}else{const e=await this._load(t);this._layersMap.set(t.id,{options:t,layer:e})}}_isSupport(e){return["TERRAIN","3DTILES","ARCGIS","URLTemplate","WMS","WMTS","KML","GEOJSON"].includes(e)}removeById(e){const t=this._layersMap.get(e);if(this._layersMap.delete(e),!t)return;const{options:s,layer:r}=t;r&&(this._type=s.type,this._initLoader(),this._remove(r))}locateById(e){const t=this._layersMap.get(e);if(!t)return;const{options:s,layer:r}=t;r&&(this._type=s.type,this._initLoader(),this._locate(s,r))}showById(e,t){const s=this._layersMap.get(e);if(!s)return;const{options:r,layer:i}=s;i&&(this._type=r.type,this._initLoader(),this._show(i,t))}destroy(){}}export{I as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsc-earth-2/layer",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",