/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import{create as i}from"../../../geometry/support/aaBoundingRect.js";import{equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import r from"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import"../tiling/TileQueue.js";import"../tiling/TileStrategy.js";import{LayerView2D as l}from"./LayerView2D.js";import{Display as n}from"./support/Display.js";import a from"../../layers/LayerView.js";import{RefreshableLayerView as p}from"../../layers/RefreshableLayerView.js";const h=new Set,d=[],c=[];class u{constructor(e,t,s,o,r,l,n,a=[0,0],p=i()){this.id=e,this.level=t,this.row=s,this.col=o,this.world=r,this.resolution=l,this.scale=n,this.coords=a,this.bounds=p}}let f=class extends(p(l(a))){constructor(e){super(e),this._tileMap=new Map,this.layer=null,this.tiles=[]}initialize(){this.display=new n(this),this.container.addChild(this.display)}get _tileInfoView(){const e=this.layer?.tileInfo;return e?new r(e):null}attach(){}detach(){}requestRender(){this.display.requestRender()}tilesChanged(e,t){}supportsSpatialReference(e){const t=this.layer?.tileInfo;return!t||o(t.spatialReference,e)}async doRefresh(){}isUpdating(){return!1}update(e){const t=this._tileInfoView,s=this.tiles;if(t){const i=t.getTileCoverage(e.state,0),{spans:o,lodInfo:r}=i??{};if(o?.length&&r)for(const{row:e,colFrom:t,colTo:l}of o)for(let i=t;i<=l;i++){const t=r.normalizeCol(i),o=r.getWorldForColumn(i),l=`${r.level}/${e}/${t}/${o}`;if(!this._tileMap.has(l)){const i=new u(l,r.level,e,t,o,r.resolution,r.scale),n=i;r.getTileCoords(n.coords,n,!1),r.getTileBounds(i.bounds,n,!0),this._tileMap.set(l,n),s.push(n),d.push(n)}h.add(l)}}for(let i=s.length-1;i>=0;i--){const e=s[i];h.has(e.id)||(s.splice(i,1),c.push(e),this._tileMap.delete(e.id))}(d.length||c.length)&&(this.tilesChanged(d,c),d.length=c.length=0),h.clear(),this.requestRender()}viewChange(){this.requestUpdate()}moveEnd(){}};e([t()],f.prototype,"_tileInfoView",null),e([t()],f.prototype,"layer",void 0),f=e([s("esri.views.2d.layers.BaseLayerView2D")],f);const m=f;export{m as default};
