@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.58 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../../geometry/Polygon.js";import{toExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import{TileKey as n}from"../../../../layers/support/TileKey.js";import{TileTreeDebugger as l}from"../../../support/TileTreeDebugger.js";let a=class extends l{constructor(e){super(e)}initialize(){const e=setInterval(()=>this._fetchDebugInfo(),2e3);this.addHandles(t(()=>clearInterval(e)))}getTiles(){if(!this._debugInfo)return[];const e=new Map,t=new Map;this._debugInfo.storedTiles.forEach(t=>e.set(n.fromJSON(t.key).id,t.featureCount)),this._debugInfo.pendingTiles.forEach(r=>{e.set(r.key.id,r.featureCount),t.set(r.key.id,r.state)});const r=r=>{const o=t.get(r),s=e.get(r)??"?";return o?`${o}:${s}\n${r}`:`store:${s}\n${r}`},o=new Map;return this._debugInfo.storedTiles.forEach(e=>{const t=n.fromJSON(e.key);o.set(t.id,t)}),this._debugInfo.pendingTiles.forEach(e=>{o.set(e.key.id,e.key)}),Array.from(o.values()).map(e=>({lij:[e.level,e.row,e.col],level:e.level,geometry:s.fromExtent(i(e.extent,this.view.spatialReference)),label:r(e.id)}))}_fetchDebugInfo(){this.handle.getDebugInfo(null).then(e=>{this._debugInfo=e,this.update()})}};e([r({constructOnly:!0})],a.prototype,"handle",void 0),a=e([o("esri.views.interactive.snapping.featureSources.WorkerTileTreeDebugger")],a);export{a as WorkerTileTreeDebugger};