@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.59 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{unpackFieldNames as s,populateMissingFields as a}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as o,getRequiredFields as p}from"../../../layers/support/popupUtils.js";const i=i=>{const c=i;let n=class extends c{_validateFetchPopupFeatures(e){const{layer:r}=this,{popupEnabled:s}=r;if(!s)throw new t("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:r});if(!o(r,e))throw new t("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:r})}async prepareFetchPopupFeatures(e){}async fetchPopupFeaturesFromGraphics(e,t){if(this._validateFetchPopupFeatures(t),0===e.length)return[];const r="scene"===this.layer.type&&null!=this.layer.associatedLayer?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=s(this.layer.fieldsIndex,await p(r,o(this.layer,t)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],l=[];for(const s of e)a(s,i,c)?l.push(s):n.push(s);if(0===l.length)return n;const u=new Map;for(let s=0;s<e.length;s++)u.set(e[s].getObjectId()??0,s);const h=await this.whenGraphicAttributes(l,[...c]).catch(()=>l).then(e=>n.concat(e));return h.sort((e,t)=>{const r=e.getObjectId()??0,s=u.get(r)??0,a=t.getObjectId()??0;return s-(u.get(a)??0)}),h}};return n=e([r("esri.views.3d.layers.support.PopupSceneLayerView")],n),n};export{i as PopupSceneLayerView};