12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{releaseMaybe as o,isSome as i}from"../core/maybe.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a,throwIfAborted as l}from"../core/promiseUtils.js";import{objectToQuery as p}from"../core/urlUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"../geometry/HeightModelInfo.js";import u from"./Layer.js";import{ArcGISCachedService as m}from"./mixins/ArcGISCachedService.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as f}from"./mixins/PortalLayer.js";import{url as g}from"./support/commonProperties.js";import{acquireDecoder as S}from"./support/LercDecoder.js";let j=class extends(m(y(v(f(s(u)))))){constructor(...e){super(...e),this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=S()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}destroy(){this._lercDecoder=o(this._lercDecoder)}readVersion(e,r){let t=r.currentVersion;return t||(t=9.3),t}load(e){const r=i(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:e=>{for(let r=0;r<e.typeKeywords.length;r++)if("elevation 3d layer"===e.typeKeywords[r].toLowerCase())return!0;throw new t("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}' ",{type:"Image Service",expectedType:"Image Service Elevation 3D Layer"})}},e).catch(a).then((()=>this._fetchImageService(r)))),Promise.resolve(this)}fetchTile(e,t,o,s){const a=i((s=s||{signal:null}).signal)?s.signal:s.signal=(new AbortController).signal,l={responseType:"array-buffer",signal:a},p={noDataValue:s.noDataValue,returnFileInfo:!0};return this.load().then((()=>this._fetchTileAvailability(e,t,o,s))).then((()=>r(this.getTileUrl(e,t,o),l))).then((e=>this._lercDecoder.decode(e.data,p,a))).then((e=>({values:e.pixelData,width:e.width,height:e.height,maxZError:e.fileInfo?.maxZError,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue})))}getTileUrl(e,r,t){const o=!this.tilemapCache&&this.supportsBlankTile,i=p({...this.parsedUrl.query,blankTile:!o&&null});return`${this.parsedUrl.path}/tile/${e}/${r}/${t}${i?"?"+i:""}`}async queryElevation(e,r){const{ElevationQuery:t}=await import("./support/ElevationQuery.js");l(r);return(new t).query(this,e,r)}async createElevationSampler(e,r){const{ElevationQuery:t}=await import("./support/ElevationQuery.js");l(r);return(new t).createSampler(this,e,r)}_fetchTileAvailability(e,r,t,o){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,r,t,o):Promise.resolve("unknown")}async _fetchImageService(e){if(this.sourceJSON)return this.sourceJSON;const t={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},o=await r(this.parsedUrl.path,t);o.ssl&&(this.url=this.url?.replace(/^http:/i,"https:")),this.sourceJSON=o.data,this.read(o.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile.__isDefault__}};e([n({json:{read:{source:"copyrightText"}}})],j.prototype,"copyright",void 0),e([n({readOnly:!0,type:h})],j.prototype,"heightModelInfo",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],j.prototype,"path",void 0),e([n({type:["show","hide"]})],j.prototype,"listMode",void 0),e([n({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],j.prototype,"minScale",void 0),e([n({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],j.prototype,"maxScale",void 0),e([n({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],j.prototype,"opacity",void 0),e([n({type:["ArcGISTiledElevationServiceLayer"]})],j.prototype,"operationalLayerType",void 0),e([n()],j.prototype,"sourceJSON",void 0),e([n({json:{read:!1},value:"elevation",readOnly:!0})],j.prototype,"type",void 0),e([n(g)],j.prototype,"url",void 0),e([n()],j.prototype,"version",void 0),e([c("version",["currentVersion"])],j.prototype,"readVersion",null),j=e([d("esri.layers.ElevationLayer")],j),j.prototype.fetchTile.__isDefault__=!0;const w=j;export{w as default};
|