UNPKG

s2maps-gpu

Version:

S2 Maps GPU - An open source, high-performance, and GPU-accelerated map engine for rendering large-scale, interactive maps.

40 lines (39 loc) 1.9 kB
import VectorWorker from './vectorWorker.js'; import type { TileRequest } from '../worker.spec.js'; import type { HeatmapDefinition, HeatmapWorkerLayer, PointDefinition, PointWorkerLayer } from 'style/style.spec.js'; import type { HeatmapFeature, PointFeature, PointWorker as PointWorkerSpec, VTFeature } from './process.spec.js'; /** Internal organization to hold specific point features */ export interface Features { point: PointFeature[]; heatmap: HeatmapFeature[]; } /** Worker for processing point data */ export default class PointWorker extends VectorWorker implements PointWorkerSpec { #private; featureStore: Map<string, Features>; /** * Setup a layer for future data processing * @param layerDefinition - layer definition * @returns the pre-processed layer */ setupLayer(layerDefinition: PointDefinition | HeatmapDefinition): PointWorkerLayer | HeatmapWorkerLayer; /** * Build a point feature * @param tile - the tile request * @param extent - the tile extent * @param feature - the vector tile feature * @param layer - the layer definition * @param mapID - the map id to ship the data back to * @param sourceName - the source name for the data to belong to * @returns true if the feature was built */ buildFeature(tile: TileRequest, extent: number, feature: VTFeature, layer: PointWorkerLayer | HeatmapWorkerLayer, mapID: string, sourceName: string): boolean; /** * Flush the feature store (all processed data is sent back to the main thread) * @param mapID - the map id to ship the data back to * @param tile - the tile request * @param sourceName - the source name the data to belongs to * @param wait - this promise must be resloved before flushing. */ flush(mapID: string, tile: TileRequest, sourceName: string, wait: Promise<void>): Promise<void>; }