@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.58 kB
JavaScript
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Error.js";import{isSome as s}from"../../../../core/maybe.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as o,populateMissingFields as a}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as p,getRequiredFields as i}from"../../../layers/support/popupUtils.js";const c=c=>{let l=class extends c{_validateFetchPopupFeatures(e){const{layer:s}=this,{popupEnabled:t}=s;if(!t)throw new r("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:s});if(!p(s,e))throw new r("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:s})}async prepareFetchPopupFeatures(e){}async fetchPopupFeatures(e,r){this._validateFetchPopupFeatures(r);const t=s(r)?r.clientGraphics:null;if(!t||0===t.length)return[];const c="scene"===this.layer.type&&s(this.layer.associatedLayer)?this.layer.associatedLayer:this.layer;let l=[];"fieldsIndex"in this.layer&&(l=o(this.layer.fieldsIndex,await i(c,p(this.layer,r)))),await this.prepareFetchPopupFeatures(l);const n=new Set,u=[],h=[];for(const s of t)a(l,s,n)?h.push(s):u.push(s);return 0===h.length?u:this.whenGraphicAttributes(h,[...n]).catch((()=>h)).then((e=>u.concat(e)))}};return l=e([t("esri.views.3d.layers.support.PopupSceneLayerView")],l),l};export{c as PopupSceneLayerView};