s2maps-gpu
Version:
S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.
44 lines (43 loc) • 2.13 kB
TypeScript
import VectorWorker from './vectorWorker.js';
import type ImageStore from './imageStore.js';
import type { TileRequest } from '../worker.spec.js';
import type { FillDefinition, FillWorkerLayer, GPUType } from 'style/style.spec.js';
import type { FillFeature, FillWorker as FillWorkerSpec, IDGen, VTFeature } from './process.spec.js';
/** Worker for processing fill data */
export default class FillWorker extends VectorWorker implements FillWorkerSpec {
#private;
featureStore: Map<string, FillFeature[]>;
invertLayers: Map<number, FillWorkerLayer>;
imageStore: ImageStore;
/**
* @param idGen - id generator to ensure features don't overlap
* @param gpuType - the GPU context of the map renderer (WebGL(1|2) | WebGPU)
* @param imageStore - the image store to pull/request the needed pattern images
*/
constructor(idGen: IDGen, gpuType: GPUType, imageStore: ImageStore);
/**
* Setup a fill layer for processing
* @param fillLayer - the fill layer
* @returns the worker layer to process future fill data
*/
setupLayer(fillLayer: FillDefinition): FillWorkerLayer;
/**
* Build a fill feature from input vector features
* @param tile - the tile request
* @param extent - the tile extent
* @param feature - the vector tile feature
* @param fillLayer - the fill worker layer
* @param mapID - the map id to ship the data back to
* @param sourceName - the source name the data to belongs to
* @returns true if the feature was built
*/
buildFeature(tile: TileRequest, extent: number, feature: VTFeature, fillLayer: FillWorkerLayer, mapID: string, sourceName: string): Promise<boolean>;
/**
* Flush the fill feature data to be shipped out
* @param mapID - id of the map to ship the data back to
* @param tile - tile request
* @param sourceName - source name the data to belongs to
* @param wait - this promise must be resloved before flushing. Ensures pattern data is ready
*/
flush(mapID: string, tile: TileRequest, sourceName: string, wait: Promise<void>): Promise<void>;
}