UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 2.15 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{property as s}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import{load as i,getSourceScale as a}from"../../layers/raster/functions/rasterProjectionHelper.js";import p from"../../layers/support/FieldsIndex.js";import{rasterFieldPrefix as n}from"../../layers/support/rasterFieldUtils.js";import{combineTimeExtent as l}from"../../layers/support/timeSupport.js";import m from"../../rest/support/Query.js";import u from"./LayerView.js";import{getFetchPopupTemplate as c}from"./support/popupUtils.js";class y extends u{constructor(...e){super(...e),this.view=null}get timeExtent(){return l(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,s){const{layer:i}=this;if(!e)throw new t("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:i});const{popupEnabled:a}=i,l=c(i,s);if(!a||null==l)return[];const u=await l.getRequiredFields(null,{index:new p(i.rasterFields),partitions:new Map([["$pixel",i.rasterFields.filter(e=>e.name.startsWith(n)).map(e=>e.name)],["$imageCollectionItem",i.fields.map(e=>e.name)]])});r(s);const y=new m;y.timeExtent=this.timeExtent,y.geometry=e,y.outFields=u,y.outSpatialReference=e.spatialReference;const{resolution:f,spatialReference:d}=this.view,h="2d"===this.view.type?new o(f,f,d):new o(.5*f,.5*f,d),{returnTopmostRaster:w,showNoDataRecords:R}=l.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},x={returnDomainValues:!0,returnTopmostRaster:w,pixelSize:h,showNoDataRecords:R,signal:s?.signal};return i.queryVisibleRasters(y,x)}async getSourceScale(){return await i(),await this.layer.load(),a(this.layer.serviceRasterInfo,this.view.spatialReference)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}}e([s()],y.prototype,"layer",void 0),e([s()],y.prototype,"suspended",void 0),e([s({readOnly:!0})],y.prototype,"timeExtent",null),e([s()],y.prototype,"view",void 0);export{y as default};