11import { LRUCache } from '../utilities/LRUCache' ;
22import { PriorityQueue } from '../utilities/PriorityQueue' ;
3+ import { Tile } from './Tile' ;
34
4- export class TilesRendererBase {
5+ export type Attribution =
6+ | { type : 'string' ; value : string }
7+ | { type : 'html' ; value : string }
8+ | { type : 'image' ; value : string } ;
9+
10+ export interface TilesRendererBasePlugin {
11+ init ?: ( renderer : TilesRendererBase ) => void ;
12+
13+ fetchData ?: ( url : RequestInfo , options : RequestInit ) => Promise < Response > ;
14+ parseTile ?: ( content : ArrayBuffer | DataView , tile : Tile , extension : string , uri : string ) => Promise < void > ;
15+ preprocessURL ?: ( uri : string ) => string ;
16+ preprocessNode ?: ( tile : Tile , tileSetDir : string , parentTile : Tile | null ) => void ;
17+ loadRootTileSet ?: ( ) => Promise < void > ;
18+ disposeTile ?: ( tile : Tile ) => void ;
19+ getAttributions ?: ( target : Attribution [ ] ) => void ;
20+
21+ dispose ?: ( ) => void ;
22+ }
23+
24+ export class TilesRendererBase < TPlugin extends TilesRendererBasePlugin = TilesRendererBasePlugin > {
525
626 readonly rootTileSet : object | null ;
727 readonly root : object | null ;
@@ -20,9 +40,9 @@ export class TilesRendererBase {
2040
2141 constructor ( url ?: string ) ;
2242 update ( ) : void ;
23- registerPlugin ( plugin : object ) : void ;
24- unregisterPlugin ( plugin : object | string ) : boolean ;
25- getPluginByName ( plugin : object | string ) : object ;
43+ registerPlugin ( plugin : TPlugin ) : void ;
44+ unregisterPlugin ( plugin : TPlugin | string ) : boolean ;
45+ getPluginByName ( plugin : string ) : TPlugin ;
2646 traverse (
2747 beforeCb : ( ( tile : object , parent : object , depth : number ) => boolean ) | null ,
2848 afterCb : ( ( tile : object , parent : object , depth : number ) => boolean ) | null
0 commit comments