@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.03 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as t}from"tslib";import o from"../../../core/Logger.js";import{destroyMaybe as e}from"../../../core/maybe.js";import{EsriPromise as r}from"../../../core/Promise.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";let c=class extends r{constructor(t){super(t),this.autoLoad=!1,this.customParameters=null,this.datasetFormat=null,this.url=null,this.rotation=null}destroy(){this._cache=e(this._cache)}get layer(){return this._cache}get size(){if(!this._cache?.loaded||!this._cache.serviceRasterInfo)return;const{serviceRasterInfo:t}=this._cache;return[t.width,t.height]}async load(t){if(this._cache?.loaded)return await this._cache.load(t),{layer:this._cache,size:this.size};const{url:e,customParameters:r}=this;let s=this.datasetFormat;if(!e)throw new Error("URL is required to load NonPanoramicMedia.");const i=await import("./urlUtils.js");if(a(t),!s){s=i.guessExtensionFromURI(e)}if(!s){try{s=await i.getDatasetFormat(e)}catch(h){o.getLogger(this).warn("non-panoramic-media:dataset-format",h)}a(t)}s??="UNKNOWN FORMAT",this.datasetFormat=s;const c=(await import("../../../layers/ImageryTileLayer.js")).default;a(t),this._cache=new c({url:e,ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:s},customParameters:r??void 0});const m=this._cache.load(t);return this.addResolvingPromise(m),await m,a(t),{layer:this._cache,size:this.size}}};t([s()],c.prototype,"_cache",void 0),t([s()],c.prototype,"autoLoad",void 0),t([s()],c.prototype,"customParameters",void 0),t([s()],c.prototype,"datasetFormat",void 0),t([s()],c.prototype,"url",void 0),t([s()],c.prototype,"layer",null),t([s()],c.prototype,"rotation",void 0),t([s()],c.prototype,"size",null),c=t([i("esri.widgets.OrientedImageryViewer.support.NonPanoramicMedia")],c);const m=c;export{m as default};