12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.24/esri/copyright.txt for details.
- */
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Error.js";import{unwrap as i,isNone as o}from"../../core/maybe.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{combinedViewLayerTimeExtentProperty as n}from"../../layers/support/commonProperties.js";import{getDefaultDatumTransformationForDataset as l,projectExtent as u}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as p}from"./support/popupUtils.js";const m=m=>{let f=class extends m{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}_getfullExtent(){return this.projectFullExtent(this.view.spatialReference)}get hasTilingEffects(){return this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment}get datumTransformation(){return l(i(this.layer.fullExtent),this.view.spatialReference,!0)}supportsSpatialReference(t){return!!this.projectFullExtent(t)}projectFullExtent(t){const e=i(this.layer.fullExtent),r=l(e,t,!1);return u(e,t,r)}async fetchPopupFeatures(t,i){const{layer:s}=this;if(!t)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,n=p(s,i);if(!a||o(n))throw new r("imageryTileLayerView:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:a,popupTemplate:n});const l=[],{value:u,magdirValue:m}=await s.identify(t,{timeExtent:this.timeExtent});let f="";if(u&&u.length){f="imagery-tile"===s.type&&s.hasStandardTime()&&null!=u[0]?u.map((t=>s.getStandardTimeValue(t))).join(", "):u.join(", ");const t={ObjectId:0},r="Raster.ServicePixelValue";t[r]=this._formatAttributeValue(f,r);const i=s.rasterInfo?.attributeTable?.features;if(i&&i.length>0){const e=i.filter((t=>{const e=t.attributes.value||t.attributes.Value||t.attributes.VALUE;return String(e)===f}));if(e.length>0){const r=e[0];if(r)for(const e in r.attributes)if(r.attributes.hasOwnProperty(e)){const i=this._rasterFieldPrefix+e;t[i]=this._formatAttributeValue(r.attributes[e],i)}}}const o=s.rasterInfo.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(t["Raster.Magnitude"]=m?.[0],t["Raster.Direction"]=m?.[1]);const a=new e(this.fullExtent.clone(),null,t);a.layer=s,a.sourceLayer=a.layer,l.push(a)}return l}_formatAttributeValue(t,e){if("string"==typeof t){const r=this.layer.popupTemplate&&this.layer.popupTemplate.fieldInfos,i=this._getFieldInfo(r,e),o=i&&i.format;if(o){let e,r;return t.trim().includes(",")?(e=",",r=e+" ",this._formatDelimitedString(t,e,r,o)):t.trim().includes(" ")?(e=r=" ",this._formatDelimitedString(t,e,r,o)):this._formatNumberFromString(t,o)}}return t}_getFieldInfo(t,e){if(!t||!t.length||!e)return;const r=e.toLowerCase();let i;return t.some((t=>!(!t.fieldName||t.fieldName.toLowerCase()!==r&&t.fieldName.toLowerCase()!==r.replace(/ /g,"_"))&&(i=t,!0))),i}_formatDelimitedString(t,e,r,i){return t&&e&&r&&i?t.trim().split(e).map((t=>this._formatNumberFromString(t,i))).join(r):t}_formatNumberFromString(t,e){if(!t||!e)return t;const r=Number(t);return isNaN(r)?t:e.format(r)}};return t([s()],f.prototype,"layer",void 0),t([s(n)],f.prototype,"timeExtent",void 0),t([s()],f.prototype,"view",void 0),t([s()],f.prototype,"fullExtent",null),t([s()],f.prototype,"tileInfo",void 0),t([s({readOnly:!0})],f.prototype,"hasTilingEffects",null),f=t([a("esri.views.layers.ImageryTileLayerView")],f),f};export{m as default};
|