@@ -20,20 +20,10 @@ import type {TaskMetadata} from '../util/scheduler';
2020import type { RtlTextPlugin } from './rtl_text_plugin' ;
2121import type { RasterizedImageMap } from '../render/image_manager' ;
2222import type { ActorMessage , ActorMessages } from '../util/actor_messages' ;
23- import type { WorkerSource , WorkerSourceConstructor } from './worker_source' ;
23+ import type { WorkerSourceType , WorkerSource , WorkerSourceConstructor , WorkerSourceRequest } from './worker_source' ;
2424import type { StyleModelMap } from '../style/style_mode' ;
2525import type { Callback } from '../types/callback' ;
2626
27- /**
28- * Source types that can instantiate a {@link WorkerSource} in {@link MapWorker}.
29- */
30- type WorkerSourceType =
31- | 'vector'
32- | 'geojson'
33- | 'raster-dem'
34- | 'raster-array'
35- | 'batched-model' ;
36-
3727/**
3828 * Generic type for grouping items by mapId and style scope.
3929 */
@@ -232,27 +222,27 @@ export default class MapWorker {
232222 loadTile ( mapId : number , params : ActorMessages [ 'loadTile' ] [ 'params' ] , callback : ActorMessages [ 'loadTile' ] [ 'callback' ] ) {
233223 assert ( params . type ) ;
234224 params . projection = this . projections [ mapId ] || this . defaultProjection ;
235- this . getWorkerSource ( mapId , params . type , params . source , params . scope ) . loadTile ( params , callback ) ;
225+ this . getWorkerSource ( mapId , params ) . loadTile ( params , callback ) ;
236226 }
237227
238228 decodeRasterArray ( mapId : number , params : ActorMessages [ 'decodeRasterArray' ] [ 'params' ] , callback : ActorMessages [ 'decodeRasterArray' ] [ 'callback' ] ) {
239- ( this . getWorkerSource ( mapId , params . type , params . source , params . scope ) as RasterArrayTileWorkerSource ) . decodeRasterArray ( params , callback ) ;
229+ ( this . getWorkerSource ( mapId , params ) as RasterArrayTileWorkerSource ) . decodeRasterArray ( params , callback ) ;
240230 }
241231
242232 reloadTile ( mapId : number , params : ActorMessages [ 'reloadTile' ] [ 'params' ] , callback : ActorMessages [ 'reloadTile' ] [ 'callback' ] ) {
243233 assert ( params . type ) ;
244234 params . projection = this . projections [ mapId ] || this . defaultProjection ;
245- this . getWorkerSource ( mapId , params . type , params . source , params . scope ) . reloadTile ( params , callback ) ;
235+ this . getWorkerSource ( mapId , params ) . reloadTile ( params , callback ) ;
246236 }
247237
248238 abortTile ( mapId : number , params : ActorMessages [ 'abortTile' ] [ 'params' ] , callback : ActorMessages [ 'abortTile' ] [ 'callback' ] ) {
249239 assert ( params . type ) ;
250- this . getWorkerSource ( mapId , params . type , params . source , params . scope ) . abortTile ( params , callback ) ;
240+ this . getWorkerSource ( mapId , params ) . abortTile ( params , callback ) ;
251241 }
252242
253243 removeTile ( mapId : number , params : ActorMessages [ 'removeTile' ] [ 'params' ] , callback : ActorMessages [ 'removeTile' ] [ 'callback' ] ) {
254244 assert ( params . type ) ;
255- this . getWorkerSource ( mapId , params . type , params . source , params . scope ) . removeTile ( params , callback ) ;
245+ this . getWorkerSource ( mapId , params ) . removeTile ( params , callback ) ;
256246 }
257247
258248 removeSource ( mapId : number , params : ActorMessages [ 'removeSource' ] [ 'params' ] , callback : ActorMessages [ 'removeSource' ] [ 'callback' ] ) {
@@ -374,7 +364,8 @@ export default class MapWorker {
374364 return layerIndex ;
375365 }
376366
377- getWorkerSource ( mapId : number , type : string , source : string , scope : string ) : WorkerSource {
367+ getWorkerSource ( mapId : number , params : WorkerSourceRequest ) : WorkerSource {
368+ const { type, source, scope} = params ;
378369 const workerSources = this . workerSources ;
379370
380371 if ( ! workerSources [ mapId ] )
0 commit comments