UNPKG

@allmaps/render

Version:

Render functions for WebGL and image buffers

701 lines (700 loc) 26.6 kB
import { mergeOptions, mergePartialOptions, computeBbox, squaredDistance, bboxToCenter, intersectBboxes, bboxToRectangle } from "@allmaps/stdlib"; import { isEqualProjection } from "@allmaps/project"; import { TileCache } from "../tilecache/TileCache.js"; import { WarpedMapList } from "../maps/WarpedMapList.js"; import { FetchableTile } from "../tilecache/FetchableTile.js"; import { WarpedMapEventType, WarpedMapEvent } from "../shared/events.js"; import { getTileResolution, getTileZoomLevelForScale, computeTilesCoveringRingAtTileZoomLevel, squaredDistanceTileToPoint, getTileZoomLevelResolution, getTilesAtScaleFactor } from "../shared/tiles.js"; const DEFAULT_BASE_RENDER_OPTIONS = {}; const REQUEST_VIEWPORT_BUFFER_RATIO = 0; const OVERVIEW_REQUEST_VIEWPORT_BUFFER_RATIO = 8; const PRUNE_VIEWPORT_BUFFER_RATIO = 8; const OVERVIEW_PRUNE_VIEWPORT_BUFFER_RATIO = 16; const SCALE_FACTOR_CORRECTION = 0; const LOG2_SCALE_FACTOR_CORRECTION = -0.5; const SPRITES_MAX_HIGHER_LOG2_SCALE_FACTOR_DIFF = Infinity; const SPRITES_MAX_LOWER_LOG2_SCALE_FACTOR_DIFF = 1; const MAX_MAP_OVERVIEW_RESOLUTION = 1024 * 1024; const MAX_TOTAL_OVERVIEW_RESOLUTION_RATIO = 50; const MAX_GCPS_EXACT_TPS_TO_RESOURCE = 100; class BaseRenderer extends EventTarget { warpedMapList; tileCache; spritesTileCache; mapsInPreviousViewport = /* @__PURE__ */ new Set(); mapsInViewport = /* @__PURE__ */ new Set(); mapsWithFetchableTilesForPreviousViewport = /* @__PURE__ */ new Set(); mapsWithFetchableTilesForViewport = /* @__PURE__ */ new Set(); mapsWithRequestedTilesForViewport = /* @__PURE__ */ new Set(); viewport; options; constructor(warpedMapFactory, cacheableTileFactory, options) { super(); this.options = mergeOptions(DEFAULT_BASE_RENDER_OPTIONS, options); this.warpedMapList = new WarpedMapList(warpedMapFactory, options); this.tileCache = new TileCache(cacheableTileFactory, options); this.spritesTileCache = new TileCache( cacheableTileFactory, mergePartialOptions(options, { tileCacheForSprites: this.tileCache }) ); } /** * Parses an annotation and adds its georeferenced map to this renderer's warped map list * * @param annotation - Annotation * @param mapOptions - Map options */ async addGeoreferenceAnnotation(annotation, mapOptions) { return this.warpedMapList.addGeoreferenceAnnotation(annotation, mapOptions); } /** * Adds a georeferenced map to this renderer's warped map list * * @param georeferencedMap - Georeferenced Map * @param mapOptions - Map options */ async addGeoreferencedMap(georeferencedMap, mapOptions) { return this.warpedMapList.addGeoreferencedMap(georeferencedMap, mapOptions); } async addSprites(sprites, imageUrl, imageSize) { const spritesInfo = { sprites, imageUrl, imageSize }; const width = spritesInfo.imageSize[0]; const height = spritesInfo.imageSize[1]; const tile = { column: 0, row: 0, tileZoomLevel: { scaleFactor: 1, // Unused width, height, originalWidth: 0, // Unused originalHeight: 0, // Unused columns: 1, rows: 1 }, imageSize: spritesInfo.imageSize }; const warpedMapsByResourceId = /* @__PURE__ */ new Map(); for (const warpedMap of this.warpedMapList.getWarpedMaps()) { if (!warpedMap.hasImage()) { await warpedMap.loadImage(this.warpedMapList.imagesById); } if (!warpedMap.hasImage()) { break; } const resourceId = warpedMap.georeferencedMap.resource.id; if (!warpedMapsByResourceId.has(resourceId)) { warpedMapsByResourceId.set(resourceId, []); } warpedMapsByResourceId.get(warpedMap.georeferencedMap.resource.id)?.push(warpedMap); } const promise = new Promise((resolve) => { this.spritesTileCache.addEventListener( WarpedMapEventType.MAPTILESLOADEDFROMSPRITES, resolve, { once: true } ); }); this.spritesTileCache.requestFetchableTiles([ new FetchableTile(tile, spritesInfo.imageUrl, spritesInfo.imageUrl, { spritesInfo, warpedMapsByResourceId }) ]); return promise; } /** * Get the default options of the renderer and list */ getDefaultOptions() { return mergeOptions( DEFAULT_BASE_RENDER_OPTIONS, this.warpedMapList.getDefaultOptions() ); } /** * Get the default options of a map * * These come from the default option settings for WebGL2WarpedMaps and the map's georeferenced map proporties * * @param mapId - Map ID for which the options apply */ getMapDefaultOptions(mapId) { return this.warpedMapList.getMapDefaultOptions(mapId); } /** * Get the render and list options */ getOptions() { return mergePartialOptions(this.options, this.warpedMapList.getOptions()); } /** * Get the map-specific options of a map * * @param mapId - Map ID for which the options apply */ getMapMapOptions(mapId) { return this.warpedMapList.getMapMapOptions(mapId); } /** * Get the options of a map * * These options are the result of merging the default, georeferenced map, * layer and map-specific options of that map. * * @param mapId - Map ID for which the options apply */ getMapOptions(mapId) { return this.warpedMapList.getMapOptions(mapId); } /** * Set the renderer and list options * * @param renderAndListOptions - Render and list Options to set * @param animationOptions - Animation options */ setOptions(renderAndListOptions, animationOptions) { this.options = mergeOptions(this.options, renderAndListOptions); this.tileCache.setOptions(renderAndListOptions); this.warpedMapList.setOptions(renderAndListOptions, animationOptions); } /** * Set the map-specific options of maps (and the renderer and list options) * * @param mapIds - Map IDs for which to set the options * @param mapOptions - Map-specific options to set * @param renderAndListOptions - Render and list options to set * @param animationOptions - Animation options */ setMapsOptions(mapIds, mapOptions, renderAndListOptions, animationOptions) { if (renderAndListOptions) { this.options = mergePartialOptions(this.options, renderAndListOptions); this.tileCache.setOptions(renderAndListOptions); } this.warpedMapList.setMapsOptions( mapIds, mapOptions, renderAndListOptions, animationOptions ); } /** * Set the map-specific options of maps by map ID (and the render and list options) * * @param mapOptionsByMapId - Map-specific options to set by map ID * @param renderAndListOptions - Render and list options to set * @param animationOptions - Animation options */ setMapsOptionsByMapId(mapOptionsByMapId, renderAndListOptions, animationOptions) { if (renderAndListOptions) { this.options = mergePartialOptions(this.options, renderAndListOptions); this.tileCache.setOptions(renderAndListOptions); } this.warpedMapList.setMapsOptionsByMapId( mapOptionsByMapId, renderAndListOptions, animationOptions ); } /** * Resets the list options * * An empty array resets all options, undefined resets no options. * Only resets the list options, not the render options * * @param listOptionKeys - Keys of the render and list options to reset * @param animationOptions - Animation options */ resetOptions(listOptionKeys, animationOptions) { this.warpedMapList.resetOptions(listOptionKeys, animationOptions); } /** * Resets the map-specific options of maps (and the list options) * * An empty array resets all options, undefined resets no options. * Only resets the list options, not the render options * * @param mapIds - Map IDs for which to reset the options * @param mapOptionKeys - Keys of the map-specific options to reset * @param listOptionKeys - Keys of the render and list options to reset * @param animationOptions - Animation options */ resetMapsOptions(mapIds, mapOptionKeys, listOptionKeys, animationOptions) { this.warpedMapList.resetMapsOptions( mapIds, mapOptionKeys, listOptionKeys, animationOptions ); } /** * Resets the map-specific options of maps by map ID (and the list options) * * An empty array or map resets all options (for all maps), undefined resets no options. * Only resets the list options, not the render options * * @param mapOptionkeysByMapId - Keys of map-specific options to reset by map ID * @param listOptionKeys - Keys of the render and list options to reset * @param animationOptions - Animation options */ resetMapsOptionsByMapId(mapOptionkeysByMapId, listOptionKeys, animationOptions) { this.warpedMapList.resetMapsOptionsByMapId( mapOptionkeysByMapId, listOptionKeys, animationOptions ); } loadMissingImagesInViewport() { if (!this.viewport) { return []; } const geoBufferedViewportRectangleBbox = computeBbox( this.viewport.getGeoBufferedRectangle() ); return Array.from( this.warpedMapList.getWarpedMaps({ geoBbox: geoBufferedViewportRectangleBbox }) ).filter( (warpedMap) => !warpedMap.hasImage() && !warpedMap.fetchingImageInfo ).map((warpedMap) => warpedMap.loadImage(this.warpedMapList.imagesById)); } someImagesInViewport() { if (!this.viewport) { return false; } return Array.from( this.findMapsInViewport( this.shouldAnticipateInteraction() ? OVERVIEW_PRUNE_VIEWPORT_BUFFER_RATIO : 1 ) ).map((mapId) => this.warpedMapList.getWarpedMap(mapId)).map((warpedMap) => warpedMap.hasImage()).some(Boolean); } shouldRequestFetchableTiles() { return true; } // Should we anticipate user interaction (panning or zooming) // and hence buffer the viewport or get overview tiles shouldAnticipateInteraction() { return false; } assureProjection() { if (!this.viewport) { return; } if (!isEqualProjection( this.warpedMapList.options.projection, this.viewport.projection )) { this.warpedMapList.options.projection = this.viewport.projection; this.warpedMapList.setOptions({ projection: this.viewport.projection }); } } requestFetchableTiles() { if (!this.shouldRequestFetchableTiles()) { return; } const fetchableTilesForViewport = []; const overviewFetchableTilesForViewport = []; const mapsInViewportForRequest = this.findMapsInViewport( this.shouldAnticipateInteraction() ? REQUEST_VIEWPORT_BUFFER_RATIO : 1 ); const mapsInViewportForOverviewRequest = this.findMapsInViewport( this.shouldAnticipateInteraction() ? OVERVIEW_REQUEST_VIEWPORT_BUFFER_RATIO : 1 ); const mapsInViewportForPrune = this.findMapsInViewport( this.shouldAnticipateInteraction() ? PRUNE_VIEWPORT_BUFFER_RATIO : 1 ); const mapsInViewportForOverviewPrune = this.findMapsInViewport( this.shouldAnticipateInteraction() ? OVERVIEW_PRUNE_VIEWPORT_BUFFER_RATIO : 1 ); for (const warpedMap of this.warpedMapList.getWarpedMaps()) { warpedMap.resetForViewport(); } for (const mapId of mapsInViewportForPrune) { fetchableTilesForViewport.push( ...this.getMapFetchableTilesForViewport(mapId, mapsInViewportForRequest) ); } const fetchableTilesForViewportResolution = fetchableTilesForViewport.map((fetchableTile) => getTileResolution(fetchableTile.tile)).reduce((a, c) => a + c, 0); let overviewFetchableTilesForViewportResolution = 0; const spriteFetchableTiles = this.tileCache.getCachedTiles().filter((cachedTile) => cachedTile.isTileFromSprites()).filter( (cachedTile) => this.warpedMapList.getWarpedMap(cachedTile.fetchableTile.mapId)?.options.visible != false ).map((cachedTile) => cachedTile.fetchableTile); if (this.shouldAnticipateInteraction()) { for (const mapId of mapsInViewportForOverviewPrune) { const mapOverviewFetchableTilesForViewport = this.getMapOverviewFetchableTilesForViewport( mapId, fetchableTilesForViewportResolution + overviewFetchableTilesForViewportResolution, mapsInViewportForOverviewRequest, spriteFetchableTiles ); overviewFetchableTilesForViewportResolution += mapOverviewFetchableTilesForViewport.map((fetchableTile) => getTileResolution(fetchableTile.tile)).reduce((a, c) => a + c, 0); overviewFetchableTilesForViewport.push( ...mapOverviewFetchableTilesForViewport ); } } const allFetchableTilesForViewport = [ ...fetchableTilesForViewport, ...spriteFetchableTiles, ...overviewFetchableTilesForViewport ]; const allRequestedTilesForViewport = allFetchableTilesForViewport.filter( (fetchableTile) => this.warpedMapList.getWarpedMap(fetchableTile.mapId)?.shouldRenderMap() ); this.tileCache.requestFetchableTiles(allRequestedTilesForViewport); this.pruneTileCache(mapsInViewportForOverviewPrune); this.updateMapsForViewport(allFetchableTilesForViewport); } findMapsInViewport(viewportBufferRatio) { if (!this.viewport) { return /* @__PURE__ */ new Set(); } const viewport = this.viewport; const geoBufferedViewportRectangleBbox = computeBbox( this.viewport.getGeoBufferedRectangle(viewportBufferRatio) ); const mapsInViewport = new Set( Array.from( this.warpedMapList.getWarpedMaps({ geoBbox: geoBufferedViewportRectangleBbox }) ).map((warpedMap) => { return { warpedMap, projectedGeoSquaredDistanceToViewportCenter: squaredDistance( bboxToCenter(warpedMap.projectedGeoMaskBbox), viewport.projectedGeoCenter ) }; }).sort((warpedMapAndDistanceA, warpedMapAndDistanceB) => { if (warpedMapAndDistanceA && warpedMapAndDistanceB) { return warpedMapAndDistanceA.projectedGeoSquaredDistanceToViewportCenter - warpedMapAndDistanceB.projectedGeoSquaredDistanceToViewportCenter; } else { return 0; } }).map((warpedMapAndDistance) => warpedMapAndDistance.warpedMap.mapId) ); return mapsInViewport; } getMapFetchableTilesForViewport(mapId, mapsInViewportForRequest) { if (!this.viewport) { return []; } const viewport = this.viewport; const warpedMap = this.warpedMapList.getWarpedMap(mapId); if (!warpedMap) { return []; } if (!warpedMap.options.visible) { return []; } if (!warpedMap.hasImage()) { return []; } const tileZoomLevel = getTileZoomLevelForScale( warpedMap.image.tileZoomLevels, warpedMap.getResourceToViewportScale(viewport), SCALE_FACTOR_CORRECTION, LOG2_SCALE_FACTOR_CORRECTION ); warpedMap.setTileZoomLevelForViewport(tileZoomLevel); const transformerOptions = { maxDepth: 0, // maxDepth: 2, // minOffsetRatio: 0.00001, sourceIsGeographic: false, destinationIsGeographic: true }; const projectedGeoBufferedViewportRectangle = viewport.getProjectedGeoBufferedRectangle( this.shouldAnticipateInteraction() ? REQUEST_VIEWPORT_BUFFER_RATIO : 1 ); const projectedTransformer = warpedMap.transformationType === "thinPlateSpline" && warpedMap.gcps.length > MAX_GCPS_EXACT_TPS_TO_RESOURCE ? warpedMap.getProjectedTransformer("polynomial") : warpedMap.projectedTransformer; const resourceBufferedViewportRing = projectedTransformer.transformToResource( [projectedGeoBufferedViewportRectangle], transformerOptions )[0]; warpedMap.setProjectedGeoBufferedViewportRectangleForViewport( projectedGeoBufferedViewportRectangle ); warpedMap.setResourceBufferedViewportRingForViewport( resourceBufferedViewportRing ); if (!warpedMap.resourceBufferedViewportRingBboxForViewport || !warpedMap.resourceBufferedViewportRingBboxForViewport) { throw new Error( "No resourceBufferedViewportRingBboxForViewport or resourceBufferedViewportRingBboxForViewport" ); } const resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection = intersectBboxes( warpedMap.resourceBufferedViewportRingBboxForViewport, warpedMap.resourceMaskBbox ); warpedMap.setResourceBufferedViewportRingBboxAndResourceMaskBboxIntersectionForViewport( resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection ); if (!mapsInViewportForRequest.has(mapId)) { return []; } if (!resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection) { return []; } let tiles = computeTilesCoveringRingAtTileZoomLevel( bboxToRectangle( resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection ), tileZoomLevel, [warpedMap.image.width, warpedMap.image.height] ); tiles = this.filterOutTilesCloseToSpriteTiles(tiles, warpedMap); const resourceBufferedViewportRingCenter = bboxToCenter( warpedMap.resourceBufferedViewportRingBboxForViewport ); tiles.sort( (tileA, tileB) => squaredDistanceTileToPoint(tileA, resourceBufferedViewportRingCenter) - squaredDistanceTileToPoint(tileB, resourceBufferedViewportRingCenter) ); const fetchableTiles = tiles.map( (tile) => FetchableTile.fromWarpedMap(tile, warpedMap) ); warpedMap.setFetchableTilesForViewport(fetchableTiles); return fetchableTiles; } getMapOverviewFetchableTilesForViewport(mapId, totalFetchableTilesForViewportResolution, mapsInViewportForOverviewRequest, spriteFetchabelTiles) { if (!this.viewport) { return []; } const warpedMap = this.warpedMapList.getWarpedMap(mapId); if (!warpedMap) { return []; } if (!warpedMap.options.visible) { return []; } if (!warpedMap.hasImage()) { return []; } const maxTotalFetchableTilesResolution = this.viewport.viewportResolution * MAX_TOTAL_OVERVIEW_RESOLUTION_RATIO; if (totalFetchableTilesForViewportResolution > maxTotalFetchableTilesResolution || spriteFetchabelTiles.length > 0) { return []; } const overviewTileZoomLevel = warpedMap.image.tileZoomLevels.filter( (tileZoomLevel) => getTileZoomLevelResolution(tileZoomLevel) <= MAX_MAP_OVERVIEW_RESOLUTION // Neglect zoomlevels that contain too many pixels ).sort( (tileZoomLevel0, tileZoomLevel1) => tileZoomLevel0.scaleFactor - tileZoomLevel1.scaleFactor // Enforcing default ascending order, e.g. from 1 to 16 ).at(-1); warpedMap.setOverviewTileZoomLevelForViewport(overviewTileZoomLevel); if (!mapsInViewportForOverviewRequest.has(mapId)) { return []; } if (!overviewTileZoomLevel || warpedMap.tileZoomLevelForViewport && overviewTileZoomLevel.scaleFactor <= warpedMap.tileZoomLevelForViewport.scaleFactor) { return []; } let overviewTiles = getTilesAtScaleFactor( overviewTileZoomLevel.scaleFactor, warpedMap.image ); overviewTiles = this.filterOutTilesCloseToSpriteTiles( overviewTiles, warpedMap ); const overviewFetchableTiles = overviewTiles.map( (tile) => FetchableTile.fromWarpedMap(tile, warpedMap) ); warpedMap.setOverviewFetchableTilesForViewport(overviewFetchableTiles); return overviewFetchableTiles; } updateMapsForViewport(allFechableTilesForViewport) { this.mapsWithFetchableTilesForPreviousViewport = this.mapsWithFetchableTilesForViewport; this.mapsWithFetchableTilesForViewport = new Set( allFechableTilesForViewport.map((tile) => tile.mapId).sort( (mapId0, mapId1) => this.warpedMapList.orderMapIdsByZIndex(mapId0, mapId1) ) ); this.mapsInPreviousViewport = this.mapsInViewport; this.mapsInViewport = this.findMapsInViewport(); const { mapsForViewportEntering: mapsWithFetchableTilesForViewportEntering, mapsForViewportLeaving: mapsWithFetchableTilesForViewportLeaving } = this.mapsInViewportsToEnteringAndLeaving( Array.from(this.mapsWithFetchableTilesForPreviousViewport), Array.from(this.mapsWithFetchableTilesForViewport) ); const { mapsForViewportEntering: mapsInViewportEntering, mapsForViewportLeaving: mapsInViewportLeaving } = this.mapsInViewportsToEnteringAndLeaving( Array.from(this.mapsInPreviousViewport), Array.from(this.mapsInViewport) ); for (const mapId of mapsInViewportEntering) { this.dispatchEvent( new WarpedMapEvent(WarpedMapEventType.WARPEDMAPENTERED, { mapIds: [mapId] }) ); } for (const mapId of mapsInViewportLeaving) { this.clearMap(mapId); this.dispatchEvent( new WarpedMapEvent(WarpedMapEventType.WARPEDMAPLEFT, { mapIds: [mapId] }) ); } return { mapsWithFetchableTilesForViewportEntering, mapsWithFetchableTilesForViewportLeaving, mapsInViewportEntering, mapsInViewportLeaving }; } mapsInViewportsToEnteringAndLeaving(mapsForPreviousViewport, mapsForViewport) { const mapsForViewportEntering = mapsForViewport.filter( (mapId) => !mapsForPreviousViewport.includes(mapId) ); const mapsForViewportLeaving = mapsForPreviousViewport.filter( (mapId) => !mapsForViewport.includes(mapId) ); return { mapsForViewportEntering, mapsForViewportLeaving }; } pruneTileCache(mapsInViewportForOverviewPrune) { const pruneInfoByMapId = /* @__PURE__ */ new Map(); for (const warpedMap of this.warpedMapList.getWarpedMaps({ mapIds: mapsInViewportForOverviewPrune })) { pruneInfoByMapId.set(warpedMap.mapId, { tileZoomLevelForViewport: warpedMap.tileZoomLevelForViewport, overviewTileZoomLevelForViewport: warpedMap.overviewTileZoomLevelForViewport, resourceViewportRingBboxForViewport: warpedMap.resourceBufferedViewportRingBboxForViewport }); } this.tileCache.prune(pruneInfoByMapId); } filterOutTilesCloseToSpriteTiles(tiles, warpedMap) { const spriteCachedTiles = this.tileCache.getMapCachedTiles(warpedMap.mapId).filter((cachedTile) => cachedTile.isTileFromSprites()); const spriteCachedTilesScaleFactors = spriteCachedTiles.map( (cachedTile) => cachedTile.fetchableTile.tile.tileZoomLevel.scaleFactor ); return tiles.filter((tile) => { for (const spriteCachedTilesScaleFactor of spriteCachedTilesScaleFactors) { const log2ScaleFactorDiff = Math.log2(tile.tileZoomLevel.scaleFactor) - Math.log2(spriteCachedTilesScaleFactor); const scaleFactorDiffWithinHigherTolerance = log2ScaleFactorDiff <= SPRITES_MAX_HIGHER_LOG2_SCALE_FACTOR_DIFF; const scaleFactorDiffWithinLowerTolerance = -log2ScaleFactorDiff <= SPRITES_MAX_LOWER_LOG2_SCALE_FACTOR_DIFF; if (scaleFactorDiffWithinHigherTolerance && scaleFactorDiffWithinLowerTolerance) { return false; } } return true; }); } destroy() { this.tileCache.destroy(); this.warpedMapList.destroy(); } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars clearMap(mapId) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars mapTileLoaded(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars mapTileDeleted(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars imageLoaded(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars warpedMapAdded(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars warpedMapRemoved(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars prepareChange(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars immediateChange(event) { } // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars animatedChange(event) { } addEventListeners() { this.tileCache.addEventListener( WarpedMapEventType.MAPTILELOADED, this.mapTileLoaded.bind(this) ); this.tileCache.addEventListener( WarpedMapEventType.MAPTILEDELETED, this.mapTileDeleted.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.IMAGELOADED, this.imageLoaded.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.WARPEDMAPADDED, this.warpedMapAdded.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.WARPEDMAPREMOVED, this.warpedMapRemoved.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.PREPARECHANGE, this.prepareChange.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.ANIMATEDCHANGE, this.animatedChange.bind(this) ); this.warpedMapList.addEventListener( WarpedMapEventType.IMMEDIATECHANGE, this.immediateChange.bind(this) ); } removeEventListeners() { this.tileCache.removeEventListener( WarpedMapEventType.MAPTILELOADED, this.mapTileLoaded.bind(this) ); this.tileCache.removeEventListener( WarpedMapEventType.MAPTILEDELETED, this.mapTileDeleted.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.IMAGELOADED, this.imageLoaded.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.WARPEDMAPADDED, this.warpedMapAdded.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.WARPEDMAPREMOVED, this.warpedMapRemoved.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.PREPARECHANGE, this.prepareChange.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.IMMEDIATECHANGE, this.immediateChange.bind(this) ); this.warpedMapList.removeEventListener( WarpedMapEventType.ANIMATEDCHANGE, this.animatedChange.bind(this) ); } } export { BaseRenderer }; //# sourceMappingURL=BaseRenderer.js.map