@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.19 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import has from"../../../../../../core/has.js";import{FeatureCache as e}from"../FeatureCache.js";import{AFetchLoadStrategy as t}from"./AFetchLoadStrategy.js";class s extends t{constructor(t,s,h,r,d){super(t,s,h,r,d),this._chunksById=new Map,this._featureCache=new e(h,s,this._options,this._fetch.bind(this))}prepareCacheUpdate(e,t){return this._featureCache.prepareCacheUpdate(e,t)}applyCacheUpdate(){return this._featureCache.applyCacheUpdate()}unload(e){this._removeChunks(e.tile)}_addChunk(e){const t=e.tile.id;this._chunksById.has(t)||this._chunksById.set(t,[]);const s=e.size();(s||e.first||e.end)&&(has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`),this._chunksById.get(t).push(e),this._store.insert(e))}_removeChunks(e){const t=this._chunksById.get(e.key.id)??[];for(const s of t)has("esri-2d-update-debug")&&console.debug(`Tile[${e.key.id}] Chunk[${s.chunkId}] ATileLoadStrategy.removeChunk`),this._store.remove(s);this._chunksById.delete(e.key.id)}}export{s as ATileLoadStrategy};